-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathExplosion.cpp
38 lines (37 loc) · 1.01 KB
/
Explosion.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include "Explosion.h"
#include "Sprite.h"
//================================================================================================//
/********************
** explosion class **
*********************/
//================================================================================================//
Explosion::Explosion(SpriteSheet spr, Vec2 p, float s, float d, float r, bool glow)
{
IsActive = true;
pSpr = spr;
Pos = p;
Size = s/2;
fDuration = d;//(float)((float)pSpr.numFrames/d);
frame = 0;
rotation = r;
bGlow = glow;
}
void Explosion::Update()
{
if(frame<pSpr.numFrames-1)
frame += fDuration;
else
IsActive = false;
}
void Explosion::Render(const float interp)
{
if(!IsActive)
return;
glColor4f(1,1,1,1);
if(bGlow)
UTIL_GL::SetBlend(GL_ONE, GL_ONE);
else
UTIL_GL::SetBlend(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
// RenderSprite(pSpr, (int)frame, Pos.x-(Size/2), Pos.y-(Size/2), Size, Size);
RenderRotatedSprite(pSpr, (int)frame, Pos.x, Pos.y, Size, Size, rotation);
}