readjusted some of the values for simplemenu, deckmenu still requires "princess fingertips", but the others have their spacing back and font size back.

This commit is contained in:
omegablast2002@yahoo.com
2012-03-20 16:27:14 +00:00
parent 3c0620422e
commit 18c0868d88
7 changed files with 27 additions and 12 deletions

View File

@@ -18,6 +18,8 @@ using std::string;
#define SCALE_SELECTED 1.2f
#define SCALE_NORMAL 1.0f
#define SCALE_SHRINK 0.75f
#define SCALE_SELECTED_LARGE 1.7F
#define SCALE_LARGE_NORMAL 1.5F
class SimpleButton: public JGuiObject
{

View File

@@ -118,6 +118,7 @@ void DeckMenuItem::RenderWithOffset(float yOffset)
if (quad) JRenderer::GetInstance()->RenderQuad(quad.get(), x , mY + yOffset + quad->mHeight/2, 0.5);
}
}
mFont->SetScale(SCALE_NORMAL);
}
void DeckMenuItem::Render()

View File

@@ -117,9 +117,9 @@ void GameStateOptions::Start()
optionsList->failMsg = "";
optionsTabs->Add(optionsList);
optionsMenu = NEW SimpleMenu(JGE::GetInstance(), -102, this, Fonts::MENU_FONT, 50, 170);
optionsMenu = NEW SimpleMenu(JGE::GetInstance(), -102, this, Fonts::MAIN_FONT, 50, 170);
optionsMenu->Add(kBackToMainMenuID, "Back to Main Menu");
optionsMenu->Add(kSaveAndBackToMainMenuID, "Save & Back to Main Menu");
optionsMenu->Add(kSaveAndBackToMainMenuID, "Save And Exit");
optionsMenu->Add(kCancelMenuID, "Cancel");
optionsTabs->Entering(JGE_BTN_NONE);

View File

@@ -492,7 +492,7 @@ void GameStateShop::Update(float dt)
menu->Add(14, "Check task board");
if (options[Options::CHEATMODE].number)
menu->Add(-2, "Steal 1,000 credits");
menu->Add(12, "Save & Back to Main Menu");
menu->Add(12, "Save And Exit");
menu->Add(kCancelMenuID, "Cancel");
}
break;
@@ -519,7 +519,7 @@ void GameStateShop::Update(float dt)
{
menu = NEW SimpleMenu(JGE::GetInstance(), 11, this, Fonts::MENU_FONT, SCREEN_WIDTH / 2 - 100, 20);
menu->Add(15, "Return to shop");
menu->Add(12, "Save & Back to Main Menu");
menu->Add(12, "Save And Exit");
menu->Add(kCancelMenuID, "Cancel");
}
}

View File

@@ -50,10 +50,20 @@ void SimpleButton::RenderWithOffset(float yOffset)
{
mYOffset = yOffset;
WFont * mFont = WResourceManager::Instance()->GetWFont(mFontId);
if (mHasFocus)
mFont->SetScale(SCALE_SELECTED);
if(mText.size() < 20)
{
if (mHasFocus)
mFont->SetScale(SCALE_SELECTED_LARGE);
else
mFont->SetScale(SCALE_LARGE_NORMAL);
}
else
mFont->SetScale(SCALE_NORMAL);
{
if (mHasFocus)
mFont->SetScale(SCALE_SELECTED);
else
mFont->SetScale(SCALE_NORMAL);
}
mFont->DrawString(mText.c_str(), mX, mY + yOffset, JGETEXT_CENTER);
}

View File

@@ -14,7 +14,7 @@ namespace
#ifdef TOUCH_ENABLED
const float kLineHeight = 25;
const float kLineHeight = 30;
#else
const float kLineHeight = 20;
#endif
@@ -136,7 +136,7 @@ void SimpleMenu::Render()
for (int i = 0; i < mCount; ++i)
{
float width = (static_cast<SimpleMenuItem*> (mObjects[i]))->GetWidth() + 15;
if (mWidth < width) mWidth = width;
if (mWidth < width) mWidth = width * float(1.5);
}
if ((!title.empty()) && (mWidth < titleFont->GetStringWidth(title.c_str())))
mWidth = titleFont->GetStringWidth(title.c_str());
@@ -183,7 +183,7 @@ void SimpleMenu::Render()
if (!title.empty())
{
int scaleFactor = titleFont->GetScale();
float scaleFactor = titleFont->GetScale();
titleFont->SetScale(SCALE_NORMAL);
titleFont->DrawString(title.c_str(), mX + mWidth / 2, mY - 3, JGETEXT_CENTER);
titleFont->SetScale(scaleFactor);
@@ -207,8 +207,10 @@ void SimpleMenu::Render()
mFont->SetColor(ARGB(150,255,255,255));
}
(static_cast<SimpleMenuItem*> (mObjects[i]))->RenderWithOffset(-kLineHeight * startId);
mFont->SetScale(SCALE_NORMAL);
}
}
mFont->SetScale(SCALE_NORMAL);
}
void SimpleMenu::Update(float dt)

View File

@@ -198,7 +198,7 @@ void WGuiHeader::Render()
{
WFont * mFont = WResourceManager::Instance()->GetWFont(Fonts::OPTION_FONT);
// save the current scaling factor. We don't want the lists to change font size these lists should stay the same no matter what
int currentScale = mFont->GetScale();
float currentScale = mFont->GetScale();
mFont->SetScale(SCALE_NORMAL);
mFont->SetColor(getColor(WGuiColor::TEXT));
mFont->DrawString(_(displayValue).c_str(), x + width / 2, y, JGETEXT_CENTER);
@@ -310,7 +310,7 @@ void WGuiList::Render()
{
WFont * mFont = WResourceManager::Instance()->GetWFont(Fonts::OPTION_FONT);
// save the current scaling factor. We don't want the lists to change font size these lists should stay the same no matter what
int fontScaleFactor = mFont->GetScale();
float fontScaleFactor = mFont->GetScale();
mFont->SetScale(SCALE_NORMAL);
mFont->SetColor(getColor(WGuiColor::TEXT_FAIL));
mFont->DrawString(_(failMsg).c_str(), x + width / 2, y, JGETEXT_RIGHT);