#include <particle.h>
Inheritance diagram for Particle:
Public Member Functions | |
Particle (const std::string &name) | |
~Particle () | |
virtual void | Draw () |
virtual void | Refresh () |
void | SetOnTop (bool b) |
bool | IsOnTop () |
bool | StillUseful () |
const bool | CheckOnEndTurn () |
Protected Attributes | |
bool | on_top |
uint | m_initial_time_to_live |
uint | m_left_time_to_live |
bool | m_check_move_on_end_turn |
uint | m_time_between_scale |
uint | m_last_refresh |
Sprite * | image |
Definition at line 60 of file particle.h.
Particle::Particle | ( | const std::string & | name | ) |
Definition at line 50 of file particle.cpp.
00050 : 00051 PhysicalObj(name) 00052 { 00053 SetCollisionModel(true, false, false); 00054 m_initial_time_to_live = 20; 00055 m_check_move_on_end_turn = false; 00056 m_left_time_to_live = 0; 00057 m_last_refresh = Time::GetInstance()->Read(); 00058 }
Here is the call graph for this function:
Particle::~Particle | ( | ) |
const bool Particle::CheckOnEndTurn | ( | ) | [inline] |
void Particle::Draw | ( | ) | [virtual] |
Implements PhysicalObj.
Reimplemented in ExplosionSmoke, FireParticle, and IllBubble.
Definition at line 65 of file particle.cpp.
00066 { 00067 if (m_left_time_to_live > 0) 00068 image->Draw(GetPosition()); 00069 }
Here is the call graph for this function:
bool Particle::IsOnTop | ( | ) | [inline] |
void Particle::Refresh | ( | ) | [virtual] |
Implements PhysicalObj.
Reimplemented in BodyMemberParticle, BulletParticle, ExplosionSmoke, FireParticle, GroundParticle, MagicStarParticle, and TeleportMemberParticle.
Definition at line 71 of file particle.cpp.
00072 { 00073 uint time = Time::GetInstance()->Read() - m_last_refresh; 00074 00075 UpdatePosition(); 00076 00077 image->Update(); 00078 00079 if (time >= m_time_between_scale) { 00080 00081 //assert(m_left_time_to_live > 0); 00082 if (m_left_time_to_live <= 0) return ; 00083 00084 m_left_time_to_live--; 00085 00086 float lived_time = m_initial_time_to_live - m_left_time_to_live; 00087 00088 //during the 1st quarter of the time increase size of particle 00089 //after the 1st quarter, decrease the alpha value 00090 if((float)lived_time<m_initial_time_to_live/2.0) 00091 { 00092 float coeff = sin((M_PI/2.0)*((float)lived_time/((float)m_initial_time_to_live/2.0))); 00093 image->Scale(coeff,coeff); 00094 SetSize(image->GetSize()); 00095 image->SetAlpha(1.0); 00096 } 00097 else 00098 { 00099 float alpha = 1.0 - sin((M_PI/2.0)*((float)lived_time-((float)m_initial_time_to_live/2.0))/((float)m_initial_time_to_live/2.0)); 00100 image->Scale(1.0,1.0); 00101 image->SetAlpha(alpha); 00102 } 00103 m_last_refresh = Time::GetInstance()->Read() ; 00104 } 00105 }
Here is the call graph for this function:
Here is the caller graph for this function:
void Particle::SetOnTop | ( | bool | b | ) | [inline] |
bool Particle::StillUseful | ( | ) |
Sprite* Particle::image [protected] |
Definition at line 70 of file particle.h.
bool Particle::m_check_move_on_end_turn [protected] |
Definition at line 66 of file particle.h.
uint Particle::m_initial_time_to_live [protected] |
Definition at line 64 of file particle.h.
uint Particle::m_last_refresh [protected] |
Definition at line 68 of file particle.h.
uint Particle::m_left_time_to_live [protected] |
Definition at line 65 of file particle.h.
uint Particle::m_time_between_scale [protected] |
Definition at line 67 of file particle.h.
bool Particle::on_top [protected] |
Definition at line 63 of file particle.h.