From ffa8408a5f29f44074b4963dcd79162856dfae30 Mon Sep 17 00:00:00 2001 From: "wagic.jeck" Date: Tue, 3 Nov 2009 20:55:04 +0000 Subject: [PATCH] Jeck - The shop anti-aliasing stuff is rendered inside of shop->Render(), so that it renders on top of the cards, but under other UI elements handled by ShopItems (the price dialog, etc). Moved the light flicker inside of ShopItems instead (for now, as this is pretty damn inelegant). As far as the 5551 issue goes, I don't see how using a jpeg would do much harm, but leave the decision up to others :) --- projects/mtg/include/GameStateShop.h | 3 --- projects/mtg/include/ShopItem.h | 4 ++++ projects/mtg/src/GameStateShop.cpp | 18 ++---------------- projects/mtg/src/ShopItem.cpp | 15 +++++++++++++++ 4 files changed, 21 insertions(+), 19 deletions(-) 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){