* Shift mana to the bottom of the screen to make them easier to count.
This commit is contained in:
jean.chalard
2009-09-22 08:44:42 +00:00
parent 202d461767
commit 7f396b13b4
2 changed files with 14 additions and 12 deletions
+1 -1
View File
@@ -24,7 +24,7 @@ class ManaIcon : public Pos
enum { ALIVE, WITHERING, DROPPING, DEAD } mode; enum { ALIVE, WITHERING, DROPPING, DEAD } mode;
int color; int color;
void Render(); void Render();
void Update(float dt); void Update(float dt, float shift);
void Wither(); void Wither();
void Drop(); void Drop();
ManaIcon(int color, float x, float y); ManaIcon(int color, float x, float y);
+5 -3
View File
@@ -138,7 +138,7 @@ void ManaIcon::Render()
renderer->SetTexBlend(BLEND_SRC_ALPHA, BLEND_ONE_MINUS_SRC_ALPHA); renderer->SetTexBlend(BLEND_SRC_ALPHA, BLEND_ONE_MINUS_SRC_ALPHA);
renderer->RenderQuad(icon, actX, actY, actT, actZ + zoomP1 * sinf(M_PI * zoomP3), actZ + zoomP2 * cosf(M_PI * zoomP4)); renderer->RenderQuad(icon, actX, actY, actT, actZ + zoomP1 * sinf(M_PI * zoomP3), actZ + zoomP2 * cosf(M_PI * zoomP4));
} }
void ManaIcon::Update(float dt) void ManaIcon::Update(float dt, float shift)
{ {
xP1 += xP3 * dt; xP1 += xP3 * dt;
actX = x + xP2 * sinf(M_PI * xP1); actX = x + xP2 * sinf(M_PI * xP1);
@@ -163,7 +163,7 @@ void ManaIcon::Update(float dt)
break; break;
case ALIVE : case ALIVE :
x += 10 * dt * (DESTX - x); x += 10 * dt * (DESTX - x);
y += 10 * dt * (DESTY - y); y += 10 * dt * (DESTY + shift - y);
yP1 += yP3 * dt; yP1 += yP3 * dt;
actY = y + yP2 * sinf(M_PI * yP1); actY = y + yP2 * sinf(M_PI * yP1);
break; break;
@@ -200,6 +200,7 @@ GuiMana::~GuiMana(){
void GuiMana::Render() void GuiMana::Render()
{ {
for (vector<ManaIcon*>::iterator it = manas.begin(); it != manas.end(); ++it) for (vector<ManaIcon*>::iterator it = manas.begin(); it != manas.end(); ++it)
(*it)->Render(); (*it)->Render();
} }
@@ -207,8 +208,9 @@ bool remove_dead(ManaIcon* m) { return ManaIcon::DEAD != m->mode; }
void GuiMana::Update(float dt) void GuiMana::Update(float dt)
{ {
{ {
float shift = 0;
for (vector<ManaIcon*>::iterator it = manas.begin(); it != manas.end(); ++it) for (vector<ManaIcon*>::iterator it = manas.begin(); it != manas.end(); ++it)
(*it)->Update(dt); { (*it)->Update(dt, shift); shift += 15; }
} }
vector<ManaIcon*>::iterator it = partition(manas.begin(), manas.end(), &remove_dead); vector<ManaIcon*>::iterator it = partition(manas.begin(), manas.end(), &remove_dead);
if (it != manas.end()) if (it != manas.end())