Erwan
- "Fix" issue 152. Please review. There is an extra cost when loading the shop...could probably be improved...the image is huge, and it's a png (so no 5551 improvement here...should we switch to a jpeg ?)
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 86 KiB |
@@ -25,6 +25,10 @@ class GameStateShop: public GameState, public JGuiListener
|
|||||||
JQuad * mBack;
|
JQuad * mBack;
|
||||||
JQuad * mBg;
|
JQuad * mBg;
|
||||||
JTexture * mBgTex;
|
JTexture * mBgTex;
|
||||||
|
|
||||||
|
int lightAlpha;
|
||||||
|
int alphaChange;
|
||||||
|
|
||||||
SimpleMenu * menu;
|
SimpleMenu * menu;
|
||||||
int mStage;
|
int mStage;
|
||||||
char starterBuffer[128], boosterBuffer[128];
|
char starterBuffer[128], boosterBuffer[128];
|
||||||
|
|||||||
@@ -53,6 +53,8 @@ void GameStateShop::Start()
|
|||||||
|
|
||||||
JRenderer::GetInstance()->EnableVSync(true);
|
JRenderer::GetInstance()->EnableVSync(true);
|
||||||
|
|
||||||
|
lightAlpha = 0;
|
||||||
|
alphaChange = 0;
|
||||||
|
|
||||||
shop = NULL;
|
shop = NULL;
|
||||||
load();
|
load();
|
||||||
@@ -166,6 +168,12 @@ void GameStateShop::Update(float dt)
|
|||||||
if (shop)
|
if (shop)
|
||||||
shop->Update(dt);
|
shop->Update(dt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
alphaChange = (500 - (rand() % 1000)) * dt;
|
||||||
|
lightAlpha+= alphaChange;
|
||||||
|
if (lightAlpha < 0) lightAlpha = 0;
|
||||||
|
if (lightAlpha > 50) lightAlpha = 50;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -177,6 +185,13 @@ void GameStateShop::Render()
|
|||||||
|
|
||||||
if (mBg) r->RenderQuad(mBg,0,0);
|
if (mBg) r->RenderQuad(mBg,0,0);
|
||||||
|
|
||||||
|
JQuad * quad = resources.RetrieveTempQuad("shop_light.png");
|
||||||
|
if (quad){
|
||||||
|
r->SetTexBlend(BLEND_SRC_ALPHA, BLEND_ONE);
|
||||||
|
quad->SetColor(ARGB(lightAlpha,255,255,255));
|
||||||
|
r->RenderQuad(quad,0,0);
|
||||||
|
r->SetTexBlend(BLEND_SRC_ALPHA, BLEND_ONE_MINUS_SRC_ALPHA);
|
||||||
|
}
|
||||||
if (shop)
|
if (shop)
|
||||||
shop->Render();
|
shop->Render();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user