- Reworked Surface class and drawing stuff:
[supertux.git] / src / object / gameobjs.hpp
1 //  $Id$
2 // 
3 //  SuperTux
4 //  Copyright (C) 2000 Bill Kendrick <bill@newbreedsoftware.com>
5 //  Copyright (C) 2004 Tobias Glaesser <tobi.web@gmx.de>
6 //
7 //  This program is free software; you can redistribute it and/or
8 //  modify it under the terms of the GNU General Public License
9 //  as published by the Free Software Foundation; either version 2
10 //  of the License, or (at your option) any later version.
11 //
12 //  This program is distributed in the hope that it will be useful,
13 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
14 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 //  GNU General Public License for more details.
16 // 
17 //  You should have received a copy of the GNU General Public License
18 //  along with this program; if not, write to the Free Software
19 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
20 //  02111-1307, USA.
21 #ifndef SUPERTUX_GAMEOBJS_H
22 #define SUPERTUX_GAMEOBJS_H
23
24 #include "video/surface.hpp"
25 #include "timer.hpp"
26 #include "physic.hpp"
27 #include "game_object.hpp"
28 #include "moving_object.hpp"
29 #include "serializable.hpp"
30 #include "video/color.hpp"
31
32 /* Bounciness of distros: */
33 #define NO_BOUNCE 0
34 #define BOUNCE 1
35
36 class Sprite;
37
38 class BouncyCoin : public GameObject
39 {
40 public:
41   BouncyCoin(const Vector& pos);
42   ~BouncyCoin();
43   virtual void update(float elapsed_time);
44   virtual void draw(DrawingContext& context);
45
46 private:
47   Sprite* sprite;
48   Vector position;
49   Timer timer;
50 };
51
52 class BrokenBrick : public GameObject
53 {
54 public:
55   BrokenBrick(Sprite* sprite, const Vector& pos, const Vector& movement);
56   ~BrokenBrick();
57
58   virtual void update(float elapsed_time);
59   virtual void draw(DrawingContext& context);
60
61 private:
62   Timer timer;
63   Sprite* sprite;
64   Vector position;
65   Vector movement;
66 };
67
68 class FloatingText : public GameObject
69 {
70 public:
71   FloatingText(const Vector& pos, const std::string& text_);
72   FloatingText(const Vector& pos, int s);  // use this for score, for instance
73   
74   virtual void update(float elapsed_time);
75   virtual void draw(DrawingContext& context);
76
77 private:
78   Vector position;
79   std::string text;
80   Timer timer;  
81 };
82
83 extern Sprite *img_smoke_cloud;
84
85 class SmokeCloud : public GameObject
86 {
87 public:
88   SmokeCloud(const Vector& pos);
89   
90   virtual void update(float elapsed_time);
91   virtual void draw(DrawingContext& context);
92
93 private:
94   Timer timer;
95   Vector position;
96 };
97
98 class Particles : public GameObject
99 {
100 public:
101   Particles(const Vector& epicenter, int min_angle, int max_angle,
102             const Vector& initial_velocity, const Vector& acceleration,
103             int number, Color color, int size, float life_time, int drawing_layer);
104   ~Particles();
105   
106   virtual void update(float elapsed_time);
107   virtual void draw(DrawingContext& context);
108
109 private:
110   Vector accel;
111   Timer timer;
112   bool live_forever;
113
114   Color color;
115   float size;
116   int drawing_layer;
117
118   struct Particle {
119     Vector pos, vel;
120 //     float angle;
121     };
122   std::vector <Particle*> particles;
123 };
124
125 void load_object_gfx();
126 void free_object_gfx();
127
128 #endif 
129
130 /* Local Variables: */
131 /* mode:c++ */
132 /* End: */