CloudParticleSystem Class Reference

#include <cloud_particle_system.hpp>

Inherits ParticleSystem.

List of all members.

Public Member Functions

 CloudParticleSystem ()
virtual ~CloudParticleSystem ()
void parse (const Reader &lisp)
virtual void update (float elapsed_time)
 This function is called once per frame and allows the object to update it's state.
std::string type () const

Private Member Functions

 CloudParticleSystem (const CloudParticleSystem &)
CloudParticleSystemoperator= (const CloudParticleSystem &)

Private Attributes

SurfacePtr cloudimage

Classes

class  CloudParticle


Detailed Description

Definition at line 25 of file cloud_particle_system.hpp.


Constructor & Destructor Documentation

CloudParticleSystem::CloudParticleSystem (  ) 

Definition at line 25 of file cloud_particle_system.cpp.

References cloudimage, Surface::create(), graphicsRandom, ParticleSystem::particles, RandomGenerator::rand(), RandomGenerator::randf(), ParticleSystem::virtual_height, and ParticleSystem::virtual_width.

00025                                          :
00026   ParticleSystem(128),
00027   cloudimage()
00028 {
00029   cloudimage = Surface::create("images/objects/particles/cloud.png");
00030 
00031   virtual_width = 2000.0;
00032 
00033   // create some random clouds
00034   for(size_t i=0; i<15; ++i) {
00035     CloudParticle* particle = new CloudParticle;
00036     particle->pos.x = graphicsRandom.rand(static_cast<int>(virtual_width));
00037     particle->pos.y = graphicsRandom.rand(static_cast<int>(virtual_height));
00038     particle->texture = cloudimage;
00039     particle->speed = -graphicsRandom.randf(25.0, 54.0);
00040 
00041     particles.push_back(particle);
00042   }
00043 }

CloudParticleSystem::~CloudParticleSystem (  )  [virtual]

Definition at line 51 of file cloud_particle_system.cpp.

00052 {
00053 }

CloudParticleSystem::CloudParticleSystem ( const CloudParticleSystem  )  [private]


Member Function Documentation

void CloudParticleSystem::parse ( const Reader lisp  ) 

Definition at line 46 of file cloud_particle_system.cpp.

References LAYER_BACKGROUND1, reader_get_layer(), and ParticleSystem::z_pos.

Referenced by Sector::parse_object().

00047 {
00048   z_pos = reader_get_layer (reader, /* default = */ LAYER_BACKGROUND1);
00049 }

void CloudParticleSystem::update ( float  elapsed_time  )  [virtual]

This function is called once per frame and allows the object to update it's state.

The elapsed_time is the time since the last frame in seconds and should be the base for all timed calculations (don't use SDL_GetTicks directly as this will fail in pause mode)

Implements GameObject.

Definition at line 55 of file cloud_particle_system.cpp.

References ParticleSystem::particles.

00056 {
00057   std::vector<Particle*>::iterator i;
00058   for(i = particles.begin(); i != particles.end(); ++i) {
00059     CloudParticle* particle = (CloudParticle*) *i;
00060     particle->pos.x += particle->speed * elapsed_time;
00061   }
00062 }

std::string CloudParticleSystem::type (  )  const [inline]

Definition at line 35 of file cloud_particle_system.hpp.

00036   { return "CloudParticleSystem"; }

CloudParticleSystem& CloudParticleSystem::operator= ( const CloudParticleSystem  )  [private]


Member Data Documentation

SurfacePtr CloudParticleSystem::cloudimage [private]

Definition at line 49 of file cloud_particle_system.hpp.

Referenced by CloudParticleSystem().


The documentation for this class was generated from the following files:
Generated on Mon Apr 14 03:38:33 2014 for SuperTux by  doxygen 1.5.1