update GameStateMenu

as Zeth suggested
This commit is contained in:
Anthony Calosa
2016-07-18 09:24:28 +08:00
parent d860954c32
commit 8314d4c9ae
4 changed files with 40 additions and 23 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View File

@@ -117,7 +117,7 @@ void GameStateMenu::Create()
{
currentState = MENU_STATE_MAJOR_LANG | MENU_STATE_MINOR_NONE;
}
scroller = NEW TextScroller(Fonts::MAIN_FONT, SCREEN_WIDTH / 2 - 90, SCREEN_HEIGHT - 17, 180);
scroller = NEW TextScroller(Fonts::MAIN_FONT, SCREEN_WIDTH / 2 + 50, 5, 180);
scrollerSet = 0;
splashTex = NULL;
@@ -445,9 +445,11 @@ void GameStateMenu::ensureMGuiController()
(i == 0)));
}
JQuadPtr jq = WResourceManager::Instance()->RetrieveTempQuad("button_shoulder.png");
JQuadPtr jq = WResourceManager::Instance()->RetrieveTempQuad("button_shoulder.png");//I set this transparent, don't remove button_shoulder.png
if (!jq.get()) return;
jq->SetHFlip(false);
jq->mWidth = 64.f;
jq->mHeight = 32.f;
jq->SetColor(ARGB(abs(255),255,255,255));
mFont = WResourceManager::Instance()->GetWFont(Fonts::OPTION_FONT);
vector<ModRulesOtherMenuItem *>otherItems = gModRules.menu.other;
@@ -455,7 +457,7 @@ void GameStateMenu::ensureMGuiController()
mGuiController->Add(NEW OtherMenuItem(
otherItems[0]->mActionId,
mFont, otherItems[0]->mDisplayName,
SCREEN_WIDTH - 64, 2,
SCREEN_WIDTH - 64, SCREEN_HEIGHT_F-26.f,
jq.get(), jq.get(), otherItems[0]->mKey, false
));
}
@@ -733,8 +735,21 @@ void GameStateMenu::RenderTopMenu()
WFont * mFont = WResourceManager::Instance()->GetWFont(Fonts::MAIN_FONT);
mFont->SetScale(DEFAULT_MAIN_FONT_SCALE);
mFont->SetColor(ARGB(128,255,255,255));
mFont->DrawString(GAME_VERSION, rightTextPos, 5, JGETEXT_RIGHT);
//mFont->SetColor(ARGB(128,255,255,255));
mFont->SetColor(ARGB(220,255,255,255));
/*//tooltip
JQuadPtr tooltips;
tooltips = WResourceManager::Instance()->RetrieveTempQuad("tooltips.png");//new graphics tooltips
if (tooltips.get())
{
float xscale = (mFont->GetStringWidth(GAME_VERSION)+(mFont->GetStringWidth(GAME_VERSION)/18)) / tooltips->mWidth;
float yscale = mFont->GetHeight() / tooltips->mHeight;
tooltips->SetHotSpot(tooltips->mWidth / 2,0);
JRenderer::GetInstance()->RenderQuad(tooltips.get(), SCREEN_WIDTH_F/2, SCREEN_HEIGHT_F-17,0,xscale,yscale);
}
//end tooltip*/
mFont->DrawString(GAME_VERSION, (SCREEN_WIDTH_F/2) - (mFont->GetStringWidth(GAME_VERSION))/2, SCREEN_HEIGHT_F-17, JGETEXT_LEFT);
mFont->SetColor(ARGB(128,255,255,255));//reset color
mFont->DrawString(GameApp::mynbcardsStr, leftTextPos, 5);
renderer->FillRect(leftTextPos, 26, 104, 8, ARGB(255, 100, 90, 60));
renderer->FillRect(leftTextPos + 2, 28, (float)(gamePercentComplete()), 4, ARGB(255,220,200, 125));

View File

@@ -138,8 +138,9 @@ void OtherMenuItem::Render()
float olds = mFont->GetScale();
float xPos = SCREEN_WIDTH - 64;
float xTextPos = xPos + 54;
float yPos = SCREEN_HEIGHT_F-26.f;
int textAlign = JGETEXT_RIGHT;
onQuad->SetHFlip(false);
//onQuad->SetHFlip(false);
switch(mKey)
{
@@ -147,18 +148,30 @@ void OtherMenuItem::Render()
xPos = 5;
xTextPos = xPos + 10;
textAlign = JGETEXT_LEFT;
onQuad->SetHFlip(true);
//onQuad->SetHFlip(true);
break;
default:
break;
}
onQuad->SetColor(ARGB(abs(alpha),255,255,255));
mFont->SetColor(ARGB(abs(alpha),0,0,0));
//onQuad->SetColor(ARGB(abs(alpha),255,255,255));
mFont->SetScale(1.0f);
mFont->SetScale(50.0f / mFont->GetStringWidth(mText.c_str()));
JRenderer::GetInstance()->RenderQuad(onQuad, xPos, 2, 0, mScale, mScale);
mFont->DrawString(mText, xTextPos, 9, textAlign);
//JRenderer::GetInstance()->RenderQuad(onQuad, xPos, yPos+2, 0, mScale, mScale);
//JRenderer::GetInstance()->FillRoundRect(xPos,yPos+2,mFont->GetStringWidth(mText.c_str()),mFont->GetHeight(),2,ARGB(abs(alpha),255,255,255));
JRenderer::GetInstance()->FillRoundRect(xPos+1, yPos+6, mFont->GetStringWidth(mText.c_str()) - 3, mFont->GetHeight() - 10, 5, ARGB(abs(alpha-20), 5, 5, 5));
if(!mHasFocus)
{
mFont->SetColor(ARGB(abs(alpha),255,255,255));
JRenderer::GetInstance()->FillRoundRect(xPos, yPos+5, mFont->GetStringWidth(mText.c_str()) - 3, mFont->GetHeight() - 10, 5, ARGB(abs(alpha-20), 140, 23, 23));
}
else
{
mFont->SetColor(ARGB(abs(alpha),5,5,5));
JRenderer::GetInstance()->FillRoundRect(xPos, yPos+5, mFont->GetStringWidth(mText.c_str()) - 3, mFont->GetHeight() - 10, 5, ARGB(abs(alpha-20), 140, 140, 140));
}
JRenderer::GetInstance()->DrawRoundRect(xPos, yPos+5, mFont->GetStringWidth(mText.c_str()) - 3, mFont->GetHeight() - 10, 5, ARGB(abs(alpha-20), 5, 5, 5));
mFont->DrawString(mText, xTextPos, yPos+9, textAlign);
mFont->SetScale(olds);
}

View File

@@ -67,18 +67,7 @@ void TextScroller::Update(float dt)
void TextScroller::Render()
{
WFont * mFont = WResourceManager::Instance()->GetWFont(fontId);
//tooltip
JQuadPtr tooltips;
tooltips = WResourceManager::Instance()->RetrieveTempQuad("tooltips.png");//new graphics tooltips
if (tooltips.get())
{
float xscale = (mWidth+(mWidth/18)) / tooltips->mWidth;
float yscale = mFont->GetHeight() / tooltips->mHeight;
JRenderer::GetInstance()->RenderQuad(tooltips.get(), mX-4.5f, mY+0.5f,0,xscale,yscale);
}
else
JRenderer::GetInstance()->FillRoundRect(mX,mY,mWidth,mFont->GetHeight(), 1, ARGB(225,5,5,5));
//end tooltip
mFont->SetColor(ARGB(128,255,255,255));
mFont->DrawString(mText.c_str(), mX, mY, JGETEXT_LEFT, start, mWidth);
}