nsnake
Classic snake game for the terminal
AnimationFire.hpp
1 #ifndef ANIMATIONFIRE_H_DEFINED
2 #define ANIMATIONFIRE_H_DEFINED
3 
4 #include <Engine/Graphics/Animation.hpp>
5 #include <Engine/Helpers/Array2D.hpp>
6 #include <Engine/Helpers/Timer.hpp>
7 
8 #include <vector>
9 
10 #define PARTICLES_AMOUNT 100
11 
12 #define INTENSITY_MIN 0
13 #define INTENSITY_MAX 100
14 
16 #define INTENSITY_PERCENT(x) \
17  (x * (100/(INTENSITY_MAX - INTENSITY_MIN)))
18 
21 {
22  int intensity;
23 
24  ParticleFire(int intensity=0):
25  intensity(intensity)
26  { };
27 };
28 
30 class AnimationFire: public Animation
31 {
32 public:
33  AnimationFire(Window* window);
34  virtual ~AnimationFire();
35 
36  void load();
37  void update();
38  void draw();
39 
40 private:
42  Array2D<ParticleFire>* particle;
43  Array2D<int>* coolingMap;
44  Timer timer;
45 };
46 
47 #endif //ANIMATIONFIRE_H_DEFINED
48 
A single particle inside the whole fire.
Rules and behavior of the Fire animation.