Merge pull request #765 from kevlahnota/master

Fix Deck Menu layer, Change Main Menu Layout, Fix Crash cdaactive on tokens
This commit is contained in:
Anthony Calosa
2016-07-18 11:04:51 +08:00
committed by GitHub
8 changed files with 66 additions and 27 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

View File

@@ -2633,6 +2633,11 @@ public:
{
if(!nonstatic)
return;
if(source->isToken && !source->isInPlay(game) && cda)
{
this->forceDestroy = 1;
return;
}
if(!cda || (cda && (((MTGCardInstance *) target)->isSettingBase < 1)))
{
if(((MTGCardInstance *) target)->isSwitchedPT)

View File

@@ -259,6 +259,7 @@ void DeckMenu::Render()
if (avatarholder.get() && menupanel.get() && inDeckMenu)//bg panel
renderer->RenderQuad(menupanel.get(), 225.f, 0, 0 ,SCREEN_WIDTH_F / avatarholder.get()->mWidth, SCREEN_HEIGHT_F / avatarholder.get()->mHeight);
RenderBackground();//background deck menu
mScroller->Render();
if (menuholder.get() && inDeckMenu)//menuholder
renderer->RenderQuad(menuholder.get(), 0, 0, 0 ,SCREEN_WIDTH_F / menuholder.get()->mWidth, SCREEN_HEIGHT_F / menuholder.get()->mHeight);
@@ -345,7 +346,6 @@ void DeckMenu::Render()
}
}
mScroller->Render();
RenderDeckManaColors();
if (!title.empty())

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 + 65, 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

@@ -95,7 +95,7 @@ bool GuiPhaseBar::Leaving(JButton)
void GuiPhaseBar::Render()
{
JQuadPtr quad = WResourceManager::Instance()->GetQuad("phasebar");
JQuadPtr phaseinfo = WResourceManager::Instance()->RetrieveTempQuad("phaseinfo.png"); //new phaseinfo graphics
JQuadPtr phaseinfo = WResourceManager::Instance()->RetrieveTempQuad("fakebar.png"); //new fakebar graphics
//uncomment to draw a hideous line across hires screens.
// JRenderer::GetInstance()->DrawLine(0, CENTER, SCREEN_WIDTH, CENTER, ARGB(255, 255, 255, 255));
@@ -151,10 +151,10 @@ void GuiPhaseBar::Render()
sprintf(buf, _("(%s%s) %s").c_str(), currentP.c_str(), interrupt.c_str(),phaseNameToTranslate.c_str());
if(phaseinfo.get())
{
phaseinfo->SetHotSpot(phaseinfo->mWidth - 1.f,0);
phaseinfo->mWidth = font->GetStringWidth(buf)+12.f;
phaseinfo->mHeight = font->GetHeight()+5.f;
JRenderer::GetInstance()->RenderQuad(phaseinfo.get(),SCREEN_WIDTH_F,0,0);
phaseinfo->SetHotSpot(phaseinfo->mWidth-2.f,0);
//phaseinfo->mWidth = font->GetStringWidth(buf)+12.f;
//phaseinfo->mHeight = font->GetHeight()+5.f;
JRenderer::GetInstance()->RenderQuad(phaseinfo.get(),SCREEN_WIDTH_F,0,0,SCREEN_WIDTH_F / phaseinfo->mWidth, SCREEN_HEIGHT_F / phaseinfo->mHeight);
}
font->DrawString(buf, SCREEN_WIDTH - 5, 2, JGETEXT_RIGHT);
}

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), 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), 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), 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

@@ -66,19 +66,25 @@ void TextScroller::Update(float dt)
void TextScroller::Render()
{
JQuadPtr fakebar;
JTexture * tex = WResourceManager::Instance()->RetrieveTexture("phaseinfo.png");
if (tex)
{
fakebar = WResourceManager::Instance()->RetrieveQuad("phaseinfo.png", 0.0f, 0.0f, tex->mWidth - 3.5f, tex->mHeight - 2.0f); //avoids weird rectangle around the texture because of bilinear filtering
}
WFont * mFont = WResourceManager::Instance()->GetWFont(fontId);
//tooltip
JQuadPtr tooltips;
tooltips = WResourceManager::Instance()->RetrieveTempQuad("tooltips.png");//new graphics tooltips
if (tooltips.get())
mFont->SetColor(ARGB(128,255,255,255));
if(fakebar.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);
if(mText.length() > 1)
{
float xscale = (SCREEN_WIDTH_F/2.6f) / fakebar->mWidth;
float yscale = (mFont->GetHeight()+(mFont->GetHeight()/3.5f)) / fakebar->mHeight;
fakebar->SetHotSpot(fakebar->mWidth-8.f,0);
JRenderer::GetInstance()->RenderQuad(fakebar.get(),SCREEN_WIDTH_F, 4,0,xscale,yscale);
}
}
else
JRenderer::GetInstance()->FillRoundRect(mX,mY,mWidth,mFont->GetHeight(), 1, ARGB(225,5,5,5));
//end tooltip
mFont->DrawString(mText.c_str(), mX, mY, JGETEXT_LEFT, start, mWidth);
}