Improved looks of pause dialog
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/irrlicht@3996 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
02b7c4b155
commit
b5fc0fdf1a
@ -969,10 +969,14 @@ void Skin::process3DPane(IGUIElement *element, const core::rect< s32 > &rect, co
|
||||
//if (id == -1) return;
|
||||
|
||||
Widget* widget = GUIEngine::getWidget(id);
|
||||
|
||||
//std::cout << "3D Pane " << id << " : ";
|
||||
//if(widget == NULL) std::cout << "widget=NULL\n";
|
||||
//else std::cout << widget->m_properties[PROP_ID].c_str() << std::endl;
|
||||
|
||||
/*
|
||||
std::cout << "Skin (3D Pane) : " << (widget == NULL ? "NULL!!" : widget->m_properties[PROP_ID].c_str()) << std::endl;
|
||||
if (widget == NULL) std::cout << "Null widget: ID=" << id << " type=" << element->getTypeName() <<
|
||||
" x=" << rect.UpperLeftCorner.X <<
|
||||
" y=" << rect.UpperLeftCorner.Y <<
|
||||
" w=" << rect.getWidth() << " h=" << rect.getHeight() << std::endl;
|
||||
*/
|
||||
|
||||
if (widget == NULL) return;
|
||||
|
||||
|
@ -35,14 +35,15 @@ void IconButtonWidget::add()
|
||||
ITexture* texture = GUIEngine::getDriver()->getTexture((file_manager->getDataDir() + "/" +m_properties[PROP_ICON]).c_str());
|
||||
assert(texture != NULL);
|
||||
const int texture_w = texture->getSize().Width, texture_h = texture->getSize().Height;
|
||||
/*
|
||||
if(w < texture_w) ... ;
|
||||
if(h < texture_h) ... ;
|
||||
*/
|
||||
|
||||
// irrlicht widgets don't support scaling while keeping aspect ratio
|
||||
// so, happily, let's implement it ourselves
|
||||
const int x_gap = (int)((float)w - (float)texture_w * (float)h / texture_h);
|
||||
|
||||
rect<s32> widget_size;
|
||||
if (clickable)
|
||||
{
|
||||
widget_size = rect<s32>(x, y, x + w, y + h);
|
||||
widget_size = rect<s32>(x + x_gap/2, y, x + w - x_gap/2, y + h);
|
||||
|
||||
MyGUIButton* btn = new MyGUIButton(GUIEngine::getGUIEnv(), m_parent, getNewID(), widget_size, true);
|
||||
//IGUIButton* btn = GUIEngine::getGUIEnv()->addButton(widget_size, m_parent, getNewID(), L"");
|
||||
@ -54,17 +55,12 @@ void IconButtonWidget::add()
|
||||
}
|
||||
else
|
||||
{
|
||||
// irrlicht widgets don't support scaling while keeping aspect ratio
|
||||
// so, happily, let's implement it ourselves
|
||||
const int x_gap = (int)((float)w - (float)texture_w * (float)h / texture_h);
|
||||
|
||||
widget_size = rect<s32>(x + x_gap/2, y, x + w - x_gap/2, y + h);
|
||||
|
||||
IGUIImage* btn = GUIEngine::getGUIEnv()->addImage(widget_size, m_parent, getNewNoFocusID());
|
||||
m_element = btn;
|
||||
btn->setUseAlphaChannel(true);
|
||||
btn->setImage(texture);
|
||||
//btn->setDrawBorder(false);
|
||||
btn->setTabStop(false);
|
||||
btn->setScaleImage(true);
|
||||
}
|
||||
@ -73,7 +69,8 @@ void IconButtonWidget::add()
|
||||
stringw& message = m_text;
|
||||
if (message.size() > 0)
|
||||
{
|
||||
widget_size += position2d<s32>(0, widget_size.getHeight());
|
||||
widget_size = rect<s32>(x, y + h, x + w, y + h*2);
|
||||
|
||||
label = GUIEngine::getGUIEnv()->addStaticText(message.c_str(), widget_size, false, false /* word wrap */, m_parent);
|
||||
label->setTextAlignment(EGUIA_CENTER, EGUIA_UPPERLEFT);
|
||||
label->setTabStop(false);
|
||||
|
@ -28,15 +28,6 @@ using namespace GUIEngine;
|
||||
|
||||
RacePausedDialog::RacePausedDialog(const float percentWidth, const float percentHeight) : ModalDialog(percentWidth, percentHeight)
|
||||
{
|
||||
/*
|
||||
#ifdef IRR_SVN
|
||||
const core::dimension2d<u32>& frame_size = GUIEngine::getDriver()->getCurrentRenderTargetSize();
|
||||
#else
|
||||
const core::dimension2d<s32>& frame_size = GUIEngine::getDriver()->getCurrentRenderTargetSize();
|
||||
#endif
|
||||
const int screen_w = (int)(frame_size.Width*percentWidth);
|
||||
const int screen_h = (int)(frame_size.Height*percentHeight);
|
||||
*/
|
||||
IGUIFont* font = GUIEngine::getFont();
|
||||
const int text_height = font->getDimension(L"X").Height;
|
||||
|
||||
@ -56,9 +47,9 @@ RacePausedDialog::RacePausedDialog(const float percentWidth, const float percent
|
||||
back_btn->m_properties[PROP_ICON] = "gui/back.png";
|
||||
//I18N: In the 'paused' screen
|
||||
back_btn->m_text = L"Back to Race";
|
||||
back_btn->x = m_area.getWidth() / 2 - icon_size / 2;
|
||||
back_btn->x = m_area.getWidth() / 2 - icon_size;
|
||||
back_btn->y = text_height;
|
||||
back_btn->w = icon_size;
|
||||
back_btn->w = icon_size*2; // width larger to leave room for text
|
||||
back_btn->h = icon_size;
|
||||
back_btn->setParent(m_irrlicht_window);
|
||||
m_children.push_back(back_btn);
|
||||
|
Loading…
Reference in New Issue
Block a user