diff --git a/projects/mtg/include/GameStateShop.h b/projects/mtg/include/GameStateShop.h index e64980bee..bcacafd87 100644 --- a/projects/mtg/include/GameStateShop.h +++ b/projects/mtg/include/GameStateShop.h @@ -26,9 +26,6 @@ class GameStateShop: public GameState, public JGuiListener JQuad * mBg; JTexture * mBgTex; - int lightAlpha; - int alphaChange; - SimpleMenu * menu; int mStage; char starterBuffer[128], boosterBuffer[128]; diff --git a/projects/mtg/include/ShopItem.h b/projects/mtg/include/ShopItem.h index 87739ed2f..7fdbb7b5a 100644 --- a/projects/mtg/include/ShopItem.h +++ b/projects/mtg/include/ShopItem.h @@ -69,6 +69,10 @@ class ShopItems:public JGuiController,public JGuiListener{ CardDisplay * display; void safeDeleteDisplay(); DeckDataWrapper * myCollection; + + int lightAlpha; + int alphaChange; + public: bool showCardList; ShopItems(int id, JGuiListener* listener, JLBFont* font, int x, int y, MTGAllCards * _collection, int _setIds[]); diff --git a/projects/mtg/src/GameStateShop.cpp b/projects/mtg/src/GameStateShop.cpp index 3f51152f3..e2eb00d81 100644 --- a/projects/mtg/src/GameStateShop.cpp +++ b/projects/mtg/src/GameStateShop.cpp @@ -53,9 +53,6 @@ void GameStateShop::Start() JRenderer::GetInstance()->EnableVSync(true); - lightAlpha = 0; - alphaChange = 0; - shop = NULL; load(); @@ -169,11 +166,6 @@ void GameStateShop::Update(float dt) shop->Update(dt); } - alphaChange = (500 - (rand() % 1000)) * dt; - lightAlpha+= alphaChange; - if (lightAlpha < 0) lightAlpha = 0; - if (lightAlpha > 50) lightAlpha = 50; - } @@ -185,16 +177,10 @@ void GameStateShop::Render() 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) shop->Render(); - + if (mStage == STAGE_SHOP_MENU && menu){ menu->Render(); } diff --git a/projects/mtg/src/ShopItem.cpp b/projects/mtg/src/ShopItem.cpp index 66ff786b4..d229ff96a 100644 --- a/projects/mtg/src/ShopItem.cpp +++ b/projects/mtg/src/ShopItem.cpp @@ -224,6 +224,9 @@ ShopItems::ShopItems(int id, JGuiListener* listener, JLBFont* font, int x, int y mBgAA = resources.RetrieveQuad("shop_aliasing.png"); mBgAA->SetTextureRect(0,0,250,120); } + + lightAlpha = 0; + alphaChange = 0; } @@ -280,6 +283,10 @@ void ShopItems::Update(float dt){ } + alphaChange = (500 - (rand() % 1000)) * dt; + lightAlpha+= alphaChange; + if (lightAlpha < 0) lightAlpha = 0; + if (lightAlpha > 50) lightAlpha = 50; } @@ -291,6 +298,14 @@ void ShopItems::Render(){ if (mBgAA) r->RenderQuad(mBgAA,0,SCREEN_HEIGHT-128); + 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 (display) display->Render(); if (showPriceDialog==-1){