src/object/snow_particle_system.hpp

Go to the documentation of this file.
00001 //  SuperTux
00002 //  Copyright (C) 2006 Matthias Braun <matze@braunis.de>
00003 //
00004 //  This program is free software: you can redistribute it and/or modify
00005 //  it under the terms of the GNU General Public License as published by
00006 //  the Free Software Foundation, either version 3 of the License, or
00007 //  (at your option) any later version.
00008 //
00009 //  This program is distributed in the hope that it will be useful,
00010 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 //  GNU General Public License for more details.
00013 //
00014 //  You should have received a copy of the GNU General Public License
00015 //  along with this program.  If not, see <http://www.gnu.org/licenses/>.
00016 
00017 #ifndef HEADER_SUPERTUX_OBJECT_SNOW_PARTICLE_SYSTEM_HPP
00018 #define HEADER_SUPERTUX_OBJECT_SNOW_PARTICLE_SYSTEM_HPP
00019 
00020 #include "object/particlesystem.hpp"
00021 #include "supertux/timer.hpp"
00022 
00023 class SnowParticleSystem : public ParticleSystem
00024 {
00025 public:
00026   SnowParticleSystem();
00027   virtual ~SnowParticleSystem();
00028 
00029   void parse(const Reader& lisp);
00030 
00031   virtual void update(float elapsed_time);
00032 
00033   std::string type() const
00034   { return "SnowParticleSystem"; }
00035 
00036 private:
00037   class SnowParticle : public Particle
00038   {
00039   public:
00040     float speed;
00041     float wobble;
00042     float anchorx;
00043     float drift_speed;
00044 
00045     // Turning speed
00046     float spin_speed;
00047 
00048     // for inertia
00049     unsigned int flake_size;
00050 
00051     SnowParticle() :
00052       speed(),
00053       wobble(),
00054       anchorx(),
00055       drift_speed(),
00056       spin_speed(),
00057       flake_size()
00058     {}
00059   };
00060 
00061   // Wind is simulated in discrete "gusts"
00062 
00063   // Gust state
00064   enum State {
00065     ATTACKING,
00066     DECAYING,
00067     SUSTAINING,
00068     RELEASING,
00069     RESTING,
00070     MAX_STATE
00071   };
00072   State state;
00073 
00074 
00075   // Gust state delay timer
00076   Timer timer;
00077 
00078   // Peak magnitude of gust is gust_onset * randf(5)
00079   float gust_onset,
00080   // Current blowing velocity of gust
00081         gust_current_velocity;
00082 
00083   SurfacePtr snowimages[3];
00084 
00085 private:
00086   SnowParticleSystem(const SnowParticleSystem&);
00087   SnowParticleSystem& operator=(const SnowParticleSystem&);
00088 };
00089 
00090 #endif
00091 
00092 /* EOF */

Generated on Mon Jun 9 03:38:20 2014 for SuperTux by  doxygen 1.5.1