From fc9515222f09da6cd8bae48478273376cd692a4d Mon Sep 17 00:00:00 2001 From: auria Date: Sat, 29 Jun 2013 23:46:51 +0000 Subject: [PATCH] Tweak textboxes skin git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@13033 178a84e3-b1eb-0310-8ba1-8eac791a3b58 --- data/gui/skins/Glass.stkskin | 4 +- data/gui/skins/Ocean.stkskin | 6 ++- data/gui/skins/Peach.stkskin | 6 ++- src/guiengine/skin.cpp | 91 ++++++++++++------------------------ 4 files changed, 42 insertions(+), 65 deletions(-) diff --git a/data/gui/skins/Glass.stkskin b/data/gui/skins/Glass.stkskin index 6b7ef64e4..2691f1e44 100644 --- a/data/gui/skins/Glass.stkskin +++ b/data/gui/skins/Glass.stkskin @@ -209,7 +209,9 @@ when the border that intersect at this corner are enabled. - + + + diff --git a/data/gui/skins/Ocean.stkskin b/data/gui/skins/Ocean.stkskin index f23937e81..079520eaf 100644 --- a/data/gui/skins/Ocean.stkskin +++ b/data/gui/skins/Ocean.stkskin @@ -209,8 +209,10 @@ when the border that intersect at this corner are enabled. - - + + + + diff --git a/data/gui/skins/Peach.stkskin b/data/gui/skins/Peach.stkskin index d1d5b658e..c1018edb8 100644 --- a/data/gui/skins/Peach.stkskin +++ b/data/gui/skins/Peach.stkskin @@ -208,8 +208,10 @@ when the border that intersect at this corner are enabled. - - + + + + diff --git a/src/guiengine/skin.cpp b/src/guiengine/skin.cpp index cb6200771..388db1c8d 100644 --- a/src/guiengine/skin.cpp +++ b/src/guiengine/skin.cpp @@ -2012,70 +2012,41 @@ void Skin::draw3DSunkenPane (IGUIElement *element, video::SColor bgcolor, if (element->getType()==gui::EGUIET_EDIT_BOX) { - SColor& color = SkinConfig::m_colors["text_field::neutral"]; - SColor& colorFocus = SkinConfig::m_colors["text_field::focused"]; + SColor& bg_color = SkinConfig::m_colors["text_field::background"]; + SColor& bg_color_focused = SkinConfig::m_colors["text_field::background_focused"]; + SColor& border_color = SkinConfig::m_colors["text_field::neutral"]; + SColor& border_color_focus = SkinConfig::m_colors["text_field::focused"]; - if (focused) + core::recti borderArea = rect; + borderArea.UpperLeftCorner -= position2d< s32 >( 2, 2 ); + borderArea.LowerRightCorner += position2d< s32 >( 2, 2 ); + + // if within an appearing dialog, grow + if (m_dialog && m_dialog_size < 1.0f && widget->m_parent != NULL && + widget->m_parent->getType() == gui::EGUIET_WINDOW) { - core::recti borderArea = rect; - borderArea.UpperLeftCorner -= position2d< s32 >( 2, 2 ); - borderArea.LowerRightCorner += position2d< s32 >( 2, 2 ); + core::position2d center(irr_driver->getFrameSize()/2); + const float texture_size = sin(m_dialog_size*M_PI*0.5f); - // if within an appearing dialog, grow - if (m_dialog && m_dialog_size < 1.0f && widget->m_parent != NULL && - widget->m_parent->getType() == gui::EGUIET_WINDOW) - { - core::position2d center(irr_driver->getFrameSize()/2); - const float texture_size = sin(m_dialog_size*M_PI*0.5f); - - borderArea.UpperLeftCorner.X = - center.X + (int)(((int)rect.UpperLeftCorner.X - - (int)center.X)*texture_size); - borderArea.UpperLeftCorner.Y = - center.Y + (int)(((int)rect.UpperLeftCorner.Y - - (int)center.Y)*texture_size); - borderArea.LowerRightCorner.X = - center.X + (int)(((int)rect.LowerRightCorner.X - - (int)center.X)*texture_size); - borderArea.LowerRightCorner.Y = - center.Y + (int)(((int)rect.LowerRightCorner.Y - - (int)center.Y)*texture_size); - } - GUIEngine::getDriver()->draw2DRectangle( colorFocus, borderArea ); - - core::recti innerArea = borderArea; - innerArea.UpperLeftCorner += position2d< s32 >( 2, 2 ); - innerArea.LowerRightCorner -= position2d< s32 >( 2, 2 ); - GUIEngine::getDriver()->draw2DRectangle( color, innerArea ); - } - else - { - // if within an appearing dialog, grow - if (m_dialog && m_dialog_size < 1.0f && widget->m_parent != NULL && - widget->m_parent->getType() == gui::EGUIET_WINDOW) - { - core::position2d center(irr_driver->getFrameSize()/2); - const float texture_size = sin(m_dialog_size*M_PI*0.5f); - core::recti sizedRect; - sizedRect.UpperLeftCorner.X = - center.X + (int)(((int)rect.UpperLeftCorner.X - - (int)center.X)*texture_size); - sizedRect.UpperLeftCorner.Y = - center.Y + (int)(((int)rect.UpperLeftCorner.Y - - (int)center.Y)*texture_size); - sizedRect.LowerRightCorner.X = - center.X + (int)(((int)rect.LowerRightCorner.X - - (int)center.X)*texture_size); - sizedRect.LowerRightCorner.Y = - center.Y + (int)(((int)rect.LowerRightCorner.Y - - (int)center.Y)*texture_size); - GUIEngine::getDriver()->draw2DRectangle( color, sizedRect ); - } - else - { - GUIEngine::getDriver()->draw2DRectangle( color, rect ); - } + borderArea.UpperLeftCorner.X = + center.X + (int)(((int)rect.UpperLeftCorner.X + - (int)center.X)*texture_size); + borderArea.UpperLeftCorner.Y = + center.Y + (int)(((int)rect.UpperLeftCorner.Y + - (int)center.Y)*texture_size); + borderArea.LowerRightCorner.X = + center.X + (int)(((int)rect.LowerRightCorner.X + - (int)center.X)*texture_size); + borderArea.LowerRightCorner.Y = + center.Y + (int)(((int)rect.LowerRightCorner.Y + - (int)center.Y)*texture_size); } + GUIEngine::getDriver()->draw2DRectangle(focused ? border_color_focus : border_color, borderArea); + + core::recti innerArea = borderArea; + innerArea.UpperLeftCorner += position2d< s32 >( 2, 2 ); + innerArea.LowerRightCorner -= position2d< s32 >( 2, 2 ); + GUIEngine::getDriver()->draw2DRectangle(focused ? bg_color_focused : bg_color, innerArea); return; } else if (type == WTYPE_LIST)