Jeck - Replaced ok_quad with ok_tex, which won't expire until the duel is over.

This commit is contained in:
wagic.jeck
2009-09-14 21:09:58 +00:00
parent a84ed94954
commit 1b468bde14
3 changed files with 11 additions and 9 deletions
+1 -1
View File
@@ -13,7 +13,7 @@ class GuiCombat : public GuiLayer
GameObserver* go; GameObserver* go;
DamagerDamaged* active; DamagerDamaged* active;
AttackerDamaged* activeAtk; AttackerDamaged* activeAtk;
static JQuad* ok_quad; static JTexture* ok_tex;
Pos ok, enemy_avatar; Pos ok, enemy_avatar;
vector<AttackerDamaged*> attackers; vector<AttackerDamaged*> attackers;
DamagerDamaged* current; DamagerDamaged* current;
+2
View File
@@ -73,6 +73,7 @@ void GameStateDuel::Start()
testSuite = NEW TestSuite(RESPATH"/test/_tests.txt",mParent->collection); testSuite = NEW TestSuite(RESPATH"/test/_tests.txt",mParent->collection);
#endif #endif
resources.RetrieveTexture("OK.png",RETRIEVE_LOCK);
mGamePhase = DUEL_STATE_CHOOSE_DECK1; mGamePhase = DUEL_STATE_CHOOSE_DECK1;
credits = NEW Credits(); credits = NEW Credits();
@@ -218,6 +219,7 @@ void GameStateDuel::End()
#if defined (WIN32) || defined (LINUX) #if defined (WIN32) || defined (LINUX)
OutputDebugString("Ending GamestateDuel\n"); OutputDebugString("Ending GamestateDuel\n");
#endif #endif
resources.Release(resources.RetrieveTexture("OK.png"));
resources.SmallCache(); resources.SmallCache();
SAFE_DELETE(deckmenu); SAFE_DELETE(deckmenu);
JRenderer::GetInstance()->EnableVSync(false); JRenderer::GetInstance()->EnableVSync(false);
+8 -8
View File
@@ -12,25 +12,21 @@ struct Left : public Exp { static inline bool test(DamagerDamaged* ref, DamagerD
struct Right : public Exp { static inline bool test(DamagerDamaged* ref, DamagerDamaged* test) struct Right : public Exp { static inline bool test(DamagerDamaged* ref, DamagerDamaged* test)
{ return ref->y == test->y && ref->x < test->x && test->show; } }; { return ref->y == test->y && ref->x < test->x && test->show; } };
JQuad* GuiCombat::ok_quad = NULL; JTexture* GuiCombat::ok_tex = NULL;
GuiCombat::GuiCombat(GameObserver* go) : GuiLayer(), go(go), active(false), activeAtk(NULL), GuiCombat::GuiCombat(GameObserver* go) : GuiLayer(), go(go), active(false), activeAtk(NULL),
ok(SCREEN_WIDTH - MARGIN, 210, 1, 0, 255), ok(SCREEN_WIDTH - MARGIN, 210, 1, 0, 255),
enemy_avatar(SCREEN_WIDTH - MARGIN, TOP_LINE, 2, 0, 255), enemy_avatar(SCREEN_WIDTH - MARGIN, TOP_LINE, 2, 0, 255),
cursor_pos(NONE), step(DAMAGE) cursor_pos(NONE), step(DAMAGE)
{ {
if(NULL == ok_quad) if(NULL == ok_tex)
{ {
ok_quad = resources.RetrieveQuad("OK.png"); ok_tex = resources.RetrieveTexture("OK.png");
if (ok_quad) ok_quad->SetHotSpot(28, 22);
} }
} }
GuiCombat::~GuiCombat() GuiCombat::~GuiCombat()
{ {
if(ok_quad)
resources.Release(ok_quad);
for (inner_iterator it = attackers.begin(); it != attackers.end(); ++it) for (inner_iterator it = attackers.begin(); it != attackers.end(); ++it)
{ {
for (vector<DefenserDamaged*>::iterator q = (*it)->blockers.begin(); q != (*it)->blockers.end(); ++q) for (vector<DefenserDamaged*>::iterator q = (*it)->blockers.begin(); q != (*it)->blockers.end(); ++q)
@@ -277,7 +273,11 @@ void GuiCombat::Render()
} }
} }
} }
if (ok_quad) ok.Render(ok_quad); if (ok_tex) {
JQuad *ok_quad = resources.RetrieveTempQuad("ok.png");
ok_quad->SetHotSpot(28, 22);
ok.Render(ok_quad);
}
renderer->DrawLine(0, SCREEN_HEIGHT / 2 + 10, SCREEN_WIDTH, SCREEN_HEIGHT / 2 + 10, ARGB(255, 255, 64, 0)); renderer->DrawLine(0, SCREEN_HEIGHT / 2 + 10, SCREEN_WIDTH, SCREEN_HEIGHT / 2 + 10, ARGB(255, 255, 64, 0));
if (FIRST_STRIKE == step) if (FIRST_STRIKE == step)
{ {