#include <explosion_smoke.h>
Inheritance diagram for ExplosionSmoke:
Public Member Functions | |
ExplosionSmoke (const uint size_init) | |
void | Refresh () |
virtual void | Draw () |
Protected Attributes | |
uint | m_initial_size |
uint | dx |
Private Attributes | |
float | mvt_freq |
Definition at line 26 of file explosion_smoke.h.
ExplosionSmoke::ExplosionSmoke | ( | const uint | size_init | ) |
Definition at line 28 of file explosion_smoke.cpp.
00028 : 00029 Particle("explosion_smoke_particle") 00030 { 00031 m_initial_size = size_init; 00032 m_initial_time_to_live = 30; 00033 m_left_time_to_live = m_initial_time_to_live; 00034 m_time_between_scale = 25; 00035 dx = 0; 00036 00037 image = ParticleEngine::GetSprite(EXPLOSION_SMOKE_spr); 00038 mvt_freq = randomObj.GetDouble(-2.0, 2.0); 00039 SetGravityFactor(randomObj.GetDouble(-1.0,-2.0)); 00040 00041 image->ScaleSize(m_initial_size, m_initial_size); 00042 SetSize( Point2i(1, 1) ); 00043 StartMoving(); 00044 }
Here is the call graph for this function:
void ExplosionSmoke::Draw | ( | ) | [virtual] |
Reimplemented from Particle.
Reimplemented in IllBubble.
Definition at line 70 of file explosion_smoke.cpp.
00071 { 00072 if (m_left_time_to_live > 0) 00073 image->Draw(GetPosition()+Point2i(dx,0)); 00074 }
Here is the call graph for this function:
void ExplosionSmoke::Refresh | ( | ) | [virtual] |
Reimplemented from Particle.
Definition at line 46 of file explosion_smoke.cpp.
00047 { 00048 uint time = Time::GetInstance()->Read() - m_last_refresh; 00049 00050 UpdatePosition(); 00051 00052 image->Update(); 00053 00054 if (time >= m_time_between_scale) { 00055 //assert(m_left_time_to_live > 0); 00056 if (m_left_time_to_live <= 0) return ; 00057 00058 m_left_time_to_live--; 00059 00060 float lived_time = m_initial_time_to_live - m_left_time_to_live; 00061 00062 float coeff = cos((M_PI/2.0)*((float)lived_time/((float)m_initial_time_to_live))); 00063 image->ScaleSize(int(coeff * m_initial_size),int(coeff * m_initial_size)); 00064 00065 dx = int((int)m_initial_size * sin(5.0 * ((float)lived_time/((float)m_initial_time_to_live)) * M_PI * mvt_freq / 2.0) / 2); 00066 m_last_refresh = Time::GetInstance()->Read() ; 00067 } 00068 }
Here is the call graph for this function:
uint ExplosionSmoke::dx [protected] |
Definition at line 30 of file explosion_smoke.h.
uint ExplosionSmoke::m_initial_size [protected] |
Definition at line 30 of file explosion_smoke.h.
float ExplosionSmoke::mvt_freq [private] |
Definition at line 28 of file explosion_smoke.h.