@@ -8,17 +8,18 @@ bool MDPopup::setup(
8
8
std::string const & title, std::string const & info, char const * btn1Text, char const * btn2Text,
9
9
std::function<void (bool )> onClick
10
10
) {
11
- this ->setTitle (title.c_str (), " goldFont.fnt" , .9f , 33 .f );
12
-
13
11
m_onClick = onClick;
14
12
15
13
auto contentSize = CCSize {
16
- m_size.width - 70 .f ,
17
- m_size.height - 120 .f ,
14
+ m_size.width - 50 .f ,
15
+ m_size.height - 100 .f ,
18
16
};
19
17
auto content = MDTextArea::create (info, contentSize);
20
18
m_mainLayer->addChildAtPosition (content, Anchor::Center, ccp (0 , 0 ));
21
19
20
+ this ->setTitle (title.c_str (), " goldFont.fnt" , .9f , 28 .f );
21
+ m_title->limitLabelWidth (contentSize.width - 4 .f , .9f , .1f );
22
+
22
23
auto btnSpr = ButtonSprite::create (btn1Text);
23
24
24
25
auto btn = CCMenuItemSpriteExtra::create (btnSpr, this , menu_selector (MDPopup::onBtn));
@@ -41,6 +42,8 @@ bool MDPopup::setup(
41
42
menu->addChild (btn2);
42
43
}
43
44
45
+ m_closeBtn->setVisible (false );
46
+
44
47
m_buttonMenu->addChildAtPosition (menu, Anchor::Bottom, ccp (0 , 30 ));
45
48
menu->updateLayout ();
46
49
@@ -55,7 +58,7 @@ void MDPopup::onBtn(CCObject* sender) {
55
58
}
56
59
57
60
float MDPopup::estimateHeight (std::string const & content) {
58
- return clamp (string::count (content, ' \n ' ) * 30 .f , 200 .f , 280 .f );
61
+ return clamp (string::count (content, ' \n ' ) * 50 .f , 180 .f , 280 .f );
59
62
}
60
63
61
64
MDPopup* MDPopup::create (
@@ -64,12 +67,12 @@ MDPopup* MDPopup::create(
64
67
) {
65
68
auto ret = new MDPopup ();
66
69
if (ret->initAnchored (
67
- 320 .f , MDPopup::estimateHeight (content), title, content, btn1, btn2, onClick,
70
+ 400 .f , MDPopup::estimateHeight (content), title, content, btn1, btn2, onClick,
68
71
" square01_001.png" , { 0 , 0 , 94 , 94 }
69
72
)) {
70
73
ret->autorelease ();
71
74
return ret;
72
75
}
73
76
delete ret;
74
77
return nullptr ;
75
- }
78
+ }
0 commit comments