smoothed out the corners and adjusted coloring of the button generated text buttons for touch devices

This commit is contained in:
techdragon.nguyen@gmail.com
2012-01-27 21:53:34 +00:00
parent b9a52ab447
commit 3079faeedd

View File

@@ -66,7 +66,7 @@ void InteractiveButton::Render()
WFont *mainFont = WResourceManager::Instance()->GetWFont(Fonts::MAIN_FONT); WFont *mainFont = WResourceManager::Instance()->GetWFont(Fonts::MAIN_FONT);
const string detailedInfoString = _(getText()); const string detailedInfoString = _(getText());
float stringWidth = mainFont->GetStringWidth(detailedInfoString.c_str()); float stringWidth = mainFont->GetStringWidth(detailedInfoString.c_str());
DWORD currentColor = mainFont->GetColor();
#ifndef TOUCH_ENABLED #ifndef TOUCH_ENABLED
mXOffset = -5; mXOffset = -5;
mYOffset = 10; mYOffset = 10;
@@ -81,16 +81,16 @@ void InteractiveButton::Render()
{ {
mYOffset = -3; mYOffset = -3;
mXOffset = 0; mXOffset = 0;
renderer->FillRoundRect( boxStartX, getY() - 5, stringWidth + 6, mainFont->GetHeight(), .5, ARGB(255, 192, 172, 119)); renderer->FillRoundRect( boxStartX, getY() - 5, stringWidth , mainFont->GetHeight(), .5, ARGB(255, 192, 172, 119));
renderer->DrawRoundRect( boxStartX, getY() - 5, stringWidth + 6, mainFont->GetHeight(), .75, ARGB(255,255,255,255)); renderer->DrawRoundRect( boxStartX, getY() - 5, stringWidth + 6, mainFont->GetHeight(), .75, ARGB(255,255,255,255));
} }
#else #else
mXOffset = 0; mXOffset = 0;
mYOffset = 0; mYOffset = 0;
renderer->FillRoundRect(getX() - 5, getY(), stringWidth + 6, mainFont->GetHeight(), .5, ARGB(255, 192, 172, 119)); renderer->FillRoundRect(getX() - 5, getY(), stringWidth - 3, mainFont->GetHeight() - 9, 5, ARGB(255, 192, 172, 119));
renderer->DrawRoundRect(getX() - 5, getY(), stringWidth + 6, mainFont->GetHeight(), .75, ARGB(255,255,255,255)); renderer->DrawRoundRect(getX() - 5, getY(), stringWidth - 3, mainFont->GetHeight() - 9, 5, ARGB(255,255,255,255));
#endif #endif
mainFont->SetColor(currentColor); mainFont->SetColor( ARGB(255, 200, 200, 200) );
mainFont->DrawString(detailedInfoString, getX() - mXOffset, getY() + mYOffset); mainFont->DrawString(detailedInfoString, getX() - mXOffset, getY() + mYOffset);
} }