Fixed primitives, improved background images management for game settings, deck selection, deck editor background, post-match credits, deck editor selection and trophies room (now it's possibile to randomly use up to 3 background images and if the chosen image is not available, it will be rendered the default one).
This commit is contained in:
@@ -142,6 +142,8 @@ void CreditBonus::Render(float x, float y, WFont * font)
|
||||
font->DrawString(buffer, x, y);
|
||||
}
|
||||
|
||||
static std::string kBgFile = "";
|
||||
|
||||
Credits::Credits()
|
||||
{
|
||||
unlocked = -1;
|
||||
@@ -163,6 +165,7 @@ Credits::~Credits()
|
||||
if (bonus[i])
|
||||
delete bonus[i];
|
||||
bonus.clear();
|
||||
kBgFile = ""; //Reset the chosen backgorund.
|
||||
}
|
||||
|
||||
void Credits::compute(GameObserver* g, GameApp * _app)
|
||||
@@ -514,10 +517,29 @@ void Credits::Render()
|
||||
return;
|
||||
JRenderer * r = JRenderer::GetInstance();
|
||||
#if !defined (PSP)
|
||||
JTexture * wpTex = WResourceManager::Instance()->RetrieveTexture("bgdeckeditor.jpg");
|
||||
//Now it's possibile to randomly use up to 3 background images for post-match credits (if random index is 0, it will be rendered the default "bgdeckeditor.jpg" image).
|
||||
JTexture * wpTex = NULL;
|
||||
if(kBgFile == ""){
|
||||
char temp[4096];
|
||||
sprintf(temp, "bgdeckeditor%i.jpg", std::rand() % 3);
|
||||
kBgFile.assign(temp);
|
||||
wpTex = WResourceManager::Instance()->RetrieveTexture(kBgFile);
|
||||
if (wpTex) {
|
||||
JQuadPtr wpQuad = WResourceManager::Instance()->RetrieveTempQuad(kBgFile);
|
||||
if (wpQuad.get())
|
||||
r->RenderQuad(wpQuad.get(), 0, 0, 0, SCREEN_WIDTH_F / wpQuad->mWidth, SCREEN_HEIGHT_F / wpQuad->mHeight);
|
||||
else {
|
||||
kBgFile = "bgdeckeditor.jpg"; //Fallback to default background image for post-match credits.
|
||||
wpTex = NULL;
|
||||
}
|
||||
} else
|
||||
kBgFile = "bgdeckeditor.jpg"; //Fallback to default background image for post-match credits.
|
||||
}
|
||||
if(!wpTex)
|
||||
wpTex = WResourceManager::Instance()->RetrieveTexture(kBgFile);
|
||||
if (wpTex)
|
||||
{
|
||||
JQuadPtr wpQuad = WResourceManager::Instance()->RetrieveTempQuad("bgdeckeditor.jpg");
|
||||
JQuadPtr wpQuad = WResourceManager::Instance()->RetrieveTempQuad(kBgFile);
|
||||
r->RenderQuad(wpQuad.get(), 0, 0, 0, SCREEN_WIDTH_F / wpQuad->mWidth, SCREEN_HEIGHT_F / wpQuad->mHeight);
|
||||
}
|
||||
#else
|
||||
|
||||
Reference in New Issue
Block a user