Wind Class Reference

#include <wind.h>

List of all members.

Public Types

typedef std::list< WindParticle
>::iterator 
iterator

Public Member Functions

 Wind ()
double GetStrength () const
void ChooseRandomVal ()
void SetVal (long val)
void Refresh ()
void Reset ()
void DrawParticles ()
void RandomizeParticlesPos ()

Public Attributes

std::list< WindParticleparticles

Private Attributes

long m_val
long m_nv_val
uint m_last_move
uint m_last_part_mvt


Detailed Description

Definition at line 53 of file wind.h.


Member Typedef Documentation

typedef std::list<WindParticle>::iterator Wind::iterator

Definition at line 61 of file wind.h.


Constructor & Destructor Documentation

Wind::Wind (  ) 

Definition at line 134 of file wind.cpp.

00134           {
00135   m_val = m_nv_val = 0;
00136 }


Member Function Documentation

void Wind::ChooseRandomVal (  ) 

Definition at line 167 of file wind.cpp.

00167                           {
00168   int val = randomObj.GetLong(-100, 100);
00169   ActionHandler::GetInstance()->NewAction (new Action(Action::ACTION_WIND, val));
00170 }

Here is the call graph for this function:

Here is the caller graph for this function:

void Wind::DrawParticles (  ) 

Definition at line 176 of file wind.cpp.

00176                         {
00177   iterator it=particles.begin(), end=particles.end();
00178   for (; it != end; ++it) it -> Draw();
00179 }

Here is the caller graph for this function:

double Wind::GetStrength (  )  const

Definition at line 163 of file wind.cpp.

00163                               {
00164   return m_nv_val * force / 100.0;
00165 }

Here is the caller graph for this function:

void Wind::RandomizeParticlesPos (  ) 

Definition at line 196 of file wind.cpp.

00197 {
00198   iterator it=particles.begin(), end=particles.end();
00199   for (; it != end; ++it)
00200   {
00201     if(!camera.IsVisible(*it))
00202       it -> SetXY( Point2i( randomObj.GetLong(camera.GetPositionX(), camera.GetPositionX()+camera.GetSizeX()),
00203                             randomObj.GetLong(camera.GetPositionY(), camera.GetPositionY()+camera.GetSizeY())));
00204   }
00205 }

Here is the call graph for this function:

Here is the caller graph for this function:

void Wind::Refresh (  ) 

Definition at line 181 of file wind.cpp.

00181                   {
00182   if(m_last_move + bar_speed < Time::GetInstance()->Read()){
00183     if(m_val>m_nv_val)
00184       --m_val;
00185     else
00186     if(m_val<m_nv_val)
00187       ++m_val;
00188     m_last_move = Time::GetInstance()->Read();
00189     Interface::GetInstance()->UpdateWindIndicator(m_val);
00190   }
00191 
00192   iterator it=particles.begin(), end=particles.end();
00193   for (; it != end; ++it) it -> Refresh();
00194 }

Here is the call graph for this function:

Here is the caller graph for this function:

void Wind::Reset (  ) 

Definition at line 138 of file wind.cpp.

00138                 {
00139   m_last_move = 0;
00140   m_last_part_mvt = 0;
00141   m_val = m_nv_val = 0;
00142   Interface::GetInstance()->UpdateWindIndicator(m_val);
00143 
00144   particles.clear();
00145 
00146   if (!Config::GetInstance()->GetDisplayWindParticles())
00147     return ;
00148 
00149   uint nb = ActiveMap().wind.nb_sprite;
00150 
00151   if(!nb) return;
00152 
00153   std::string config_file = ActiveMap().m_directory + PATH_SEPARATOR + "config.xml";
00154 
00155   for (uint i=0; i<nb; ++i){
00156     WindParticle tmp = WindParticle(config_file);
00157     tmp.Resize( (double)i / nb );
00158     particles.push_back( tmp );
00159   }
00160   RandomizeParticlesPos();
00161 }

Here is the call graph for this function:

Here is the caller graph for this function:

void Wind::SetVal ( long  val  ) 

Definition at line 172 of file wind.cpp.

00172                          {
00173   m_nv_val = val;
00174 }

Here is the caller graph for this function:


Member Data Documentation

uint Wind::m_last_move [private]

Definition at line 56 of file wind.h.

uint Wind::m_last_part_mvt [private]

Definition at line 57 of file wind.h.

long Wind::m_nv_val [private]

Definition at line 55 of file wind.h.

long Wind::m_val [private]

Definition at line 55 of file wind.h.

std::list<WindParticle> Wind::particles

Definition at line 60 of file wind.h.


The documentation for this class was generated from the following files:
Generated on Mon Jan 1 14:33:50 2007 for Wormux by  doxygen 1.4.7