diff options
Diffstat (limited to 'src/guiConfirmMenu.cpp')
-rw-r--r-- | src/guiConfirmMenu.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/guiConfirmMenu.cpp b/src/guiConfirmMenu.cpp index 00e26ac42..8ca02aa43 100644 --- a/src/guiConfirmMenu.cpp +++ b/src/guiConfirmMenu.cpp @@ -93,12 +93,21 @@ void GUIConfirmMenu::regenerateGui(v2u32 screensize) v2s32 size = rect.getSize(); + gui::IGUISkin *skin = Environment->getSkin(); + gui::IGUIFont *font = skin->getFont(); + s32 msg_h = font->getDimension(m_message_text.c_str()).Height; + s32 msg_w = font->getDimension(m_message_text.c_str()).Width; + if(msg_h > 200) + msg_h = 200; + if(msg_w > 540) + msg_w = 540; + /* Add stuff */ { - core::rect<s32> rect(0, 0, 300, 20); - rect += v2s32(size.X/2-300/2, size.Y/2-30/2-25); + core::rect<s32> rect(0, 0, msg_w, msg_h); + rect += v2s32(size.X/2-msg_w/2, size.Y/2-30/2 - msg_h/2); Environment->addStaticText(m_message_text.c_str(), rect, false, true, this, -1); } @@ -106,13 +115,13 @@ void GUIConfirmMenu::regenerateGui(v2u32 screensize) int bw = 100; { core::rect<s32> rect(0, 0, bw, 30); - rect = rect + v2s32(size.X/2-bw/2-(bw/2+5), size.Y/2-30/2+25); + rect = rect + v2s32(size.X/2-bw/2-(bw/2+5), size.Y/2-30/2+5 + msg_h/2); Environment->addButton(rect, this, GUI_ID_YES, wgettext("Yes")); } { core::rect<s32> rect(0, 0, bw, 30); - rect = rect + v2s32(size.X/2-bw/2+(bw/2+5), size.Y/2-30/2+25); + rect = rect + v2s32(size.X/2-bw/2+(bw/2+5), size.Y/2-30/2+5 + msg_h/2); Environment->addButton(rect, this, GUI_ID_NO, wgettext("No")); } |