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:
@@ -18,6 +18,8 @@ using std::string;
|
|||||||
#define SCALE_SELECTED 1.2f
|
#define SCALE_SELECTED 1.2f
|
||||||
#define SCALE_NORMAL 1.0f
|
#define SCALE_NORMAL 1.0f
|
||||||
#define SCALE_SHRINK 0.75f
|
#define SCALE_SHRINK 0.75f
|
||||||
|
#define SCALE_SELECTED_LARGE 1.7F
|
||||||
|
#define SCALE_LARGE_NORMAL 1.5F
|
||||||
|
|
||||||
class SimpleButton: public JGuiObject
|
class SimpleButton: public JGuiObject
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -118,6 +118,7 @@ void DeckMenuItem::RenderWithOffset(float yOffset)
|
|||||||
if (quad) JRenderer::GetInstance()->RenderQuad(quad.get(), x , mY + yOffset + quad->mHeight/2, 0.5);
|
if (quad) JRenderer::GetInstance()->RenderQuad(quad.get(), x , mY + yOffset + quad->mHeight/2, 0.5);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
mFont->SetScale(SCALE_NORMAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeckMenuItem::Render()
|
void DeckMenuItem::Render()
|
||||||
|
|||||||
@@ -117,9 +117,9 @@ void GameStateOptions::Start()
|
|||||||
optionsList->failMsg = "";
|
optionsList->failMsg = "";
|
||||||
optionsTabs->Add(optionsList);
|
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(kBackToMainMenuID, "Back to Main Menu");
|
||||||
optionsMenu->Add(kSaveAndBackToMainMenuID, "Save & Back to Main Menu");
|
optionsMenu->Add(kSaveAndBackToMainMenuID, "Save And Exit");
|
||||||
optionsMenu->Add(kCancelMenuID, "Cancel");
|
optionsMenu->Add(kCancelMenuID, "Cancel");
|
||||||
|
|
||||||
optionsTabs->Entering(JGE_BTN_NONE);
|
optionsTabs->Entering(JGE_BTN_NONE);
|
||||||
|
|||||||
@@ -492,7 +492,7 @@ void GameStateShop::Update(float dt)
|
|||||||
menu->Add(14, "Check task board");
|
menu->Add(14, "Check task board");
|
||||||
if (options[Options::CHEATMODE].number)
|
if (options[Options::CHEATMODE].number)
|
||||||
menu->Add(-2, "Steal 1,000 credits");
|
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");
|
menu->Add(kCancelMenuID, "Cancel");
|
||||||
}
|
}
|
||||||
break;
|
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 = NEW SimpleMenu(JGE::GetInstance(), 11, this, Fonts::MENU_FONT, SCREEN_WIDTH / 2 - 100, 20);
|
||||||
menu->Add(15, "Return to shop");
|
menu->Add(15, "Return to shop");
|
||||||
menu->Add(12, "Save & Back to Main Menu");
|
menu->Add(12, "Save And Exit");
|
||||||
menu->Add(kCancelMenuID, "Cancel");
|
menu->Add(kCancelMenuID, "Cancel");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,10 +50,20 @@ void SimpleButton::RenderWithOffset(float yOffset)
|
|||||||
{
|
{
|
||||||
mYOffset = yOffset;
|
mYOffset = yOffset;
|
||||||
WFont * mFont = WResourceManager::Instance()->GetWFont(mFontId);
|
WFont * mFont = WResourceManager::Instance()->GetWFont(mFontId);
|
||||||
|
if(mText.size() < 20)
|
||||||
|
{
|
||||||
|
if (mHasFocus)
|
||||||
|
mFont->SetScale(SCALE_SELECTED_LARGE);
|
||||||
|
else
|
||||||
|
mFont->SetScale(SCALE_LARGE_NORMAL);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
if (mHasFocus)
|
if (mHasFocus)
|
||||||
mFont->SetScale(SCALE_SELECTED);
|
mFont->SetScale(SCALE_SELECTED);
|
||||||
else
|
else
|
||||||
mFont->SetScale(SCALE_NORMAL);
|
mFont->SetScale(SCALE_NORMAL);
|
||||||
|
}
|
||||||
|
|
||||||
mFont->DrawString(mText.c_str(), mX, mY + yOffset, JGETEXT_CENTER);
|
mFont->DrawString(mText.c_str(), mX, mY + yOffset, JGETEXT_CENTER);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ namespace
|
|||||||
|
|
||||||
|
|
||||||
#ifdef TOUCH_ENABLED
|
#ifdef TOUCH_ENABLED
|
||||||
const float kLineHeight = 25;
|
const float kLineHeight = 30;
|
||||||
#else
|
#else
|
||||||
const float kLineHeight = 20;
|
const float kLineHeight = 20;
|
||||||
#endif
|
#endif
|
||||||
@@ -136,7 +136,7 @@ void SimpleMenu::Render()
|
|||||||
for (int i = 0; i < mCount; ++i)
|
for (int i = 0; i < mCount; ++i)
|
||||||
{
|
{
|
||||||
float width = (static_cast<SimpleMenuItem*> (mObjects[i]))->GetWidth() + 15;
|
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())))
|
if ((!title.empty()) && (mWidth < titleFont->GetStringWidth(title.c_str())))
|
||||||
mWidth = titleFont->GetStringWidth(title.c_str());
|
mWidth = titleFont->GetStringWidth(title.c_str());
|
||||||
@@ -183,7 +183,7 @@ void SimpleMenu::Render()
|
|||||||
|
|
||||||
if (!title.empty())
|
if (!title.empty())
|
||||||
{
|
{
|
||||||
int scaleFactor = titleFont->GetScale();
|
float scaleFactor = titleFont->GetScale();
|
||||||
titleFont->SetScale(SCALE_NORMAL);
|
titleFont->SetScale(SCALE_NORMAL);
|
||||||
titleFont->DrawString(title.c_str(), mX + mWidth / 2, mY - 3, JGETEXT_CENTER);
|
titleFont->DrawString(title.c_str(), mX + mWidth / 2, mY - 3, JGETEXT_CENTER);
|
||||||
titleFont->SetScale(scaleFactor);
|
titleFont->SetScale(scaleFactor);
|
||||||
@@ -207,8 +207,10 @@ void SimpleMenu::Render()
|
|||||||
mFont->SetColor(ARGB(150,255,255,255));
|
mFont->SetColor(ARGB(150,255,255,255));
|
||||||
}
|
}
|
||||||
(static_cast<SimpleMenuItem*> (mObjects[i]))->RenderWithOffset(-kLineHeight * startId);
|
(static_cast<SimpleMenuItem*> (mObjects[i]))->RenderWithOffset(-kLineHeight * startId);
|
||||||
|
mFont->SetScale(SCALE_NORMAL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
mFont->SetScale(SCALE_NORMAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SimpleMenu::Update(float dt)
|
void SimpleMenu::Update(float dt)
|
||||||
|
|||||||
@@ -198,7 +198,7 @@ void WGuiHeader::Render()
|
|||||||
{
|
{
|
||||||
WFont * mFont = WResourceManager::Instance()->GetWFont(Fonts::OPTION_FONT);
|
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
|
// 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->SetScale(SCALE_NORMAL);
|
||||||
mFont->SetColor(getColor(WGuiColor::TEXT));
|
mFont->SetColor(getColor(WGuiColor::TEXT));
|
||||||
mFont->DrawString(_(displayValue).c_str(), x + width / 2, y, JGETEXT_CENTER);
|
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);
|
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
|
// 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->SetScale(SCALE_NORMAL);
|
||||||
mFont->SetColor(getColor(WGuiColor::TEXT_FAIL));
|
mFont->SetColor(getColor(WGuiColor::TEXT_FAIL));
|
||||||
mFont->DrawString(_(failMsg).c_str(), x + width / 2, y, JGETEXT_RIGHT);
|
mFont->DrawString(_(failMsg).c_str(), x + width / 2, y, JGETEXT_RIGHT);
|
||||||
|
|||||||
Reference in New Issue
Block a user