Had a bit of time today and worked on supertux:
[supertux.git] / src / object / gameobjs.h
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.h"
25 #include "timer.h"
26 #include "math/physic.h"
27 #include "special/game_object.h"
28 #include "special/moving_object.h"
29 #include "serializable.h"
30
31 /* Bounciness of distros: */
32 #define NO_BOUNCE 0
33 #define BOUNCE 1
34
35 namespace SuperTux {
36 class Sprite;
37 }
38
39 class BouncyCoin : public GameObject
40 {
41 public:
42   BouncyCoin(const Vector& pos);
43   ~BouncyCoin();
44   virtual void action(float elapsed_time);
45   virtual void draw(DrawingContext& context);
46
47 private:
48   Sprite* sprite;
49   Vector position;
50   Timer2 timer;
51 };
52
53 class BrokenBrick : public GameObject
54 {
55 public:
56   BrokenBrick(Sprite* sprite, const Vector& pos, const Vector& movement);
57   ~BrokenBrick();
58
59   virtual void action(float elapsed_time);
60   virtual void draw(DrawingContext& context);
61
62 private:
63   Timer2 timer;
64   Sprite* sprite;
65   Vector position;
66   Vector movement;
67 };
68
69 class FloatingText : public GameObject
70 {
71 public:
72   FloatingText(const Vector& pos, const std::string& text_);
73   FloatingText(const Vector& pos, int s);  // use this for score, for instance
74   
75   virtual void action(float elapsed_time);
76   virtual void draw(DrawingContext& context);
77
78 private:
79   Vector position;
80   std::string text;
81   Timer2 timer;  
82 };
83
84 extern Sprite *img_smoke_cloud;
85
86 class SmokeCloud : public GameObject
87 {
88 public:
89   SmokeCloud(const Vector& pos);
90   
91   virtual void action(float elapsed_time);
92   virtual void draw(DrawingContext& context);
93
94 private:
95   Timer2 timer;
96   Vector position;
97 };
98
99 class Particles : public GameObject
100 {
101 public:
102   Particles(const Vector& epicenter, int min_angle, int max_angle,
103             const Vector& initial_velocity, const Vector& acceleration,
104             int number, Color color, int size, float life_time, int drawing_layer);
105   ~Particles();
106   
107   virtual void action(float elapsed_time);
108   virtual void draw(DrawingContext& context);
109
110 private:
111   Vector accel;
112   Timer2 timer;
113   bool live_forever;
114
115   Color color;
116   float size;
117   int drawing_layer;
118
119   struct Particle {
120     Vector pos, vel;
121 //     float angle;
122     };
123   std::vector <Particle*> particles;
124 };
125
126 void load_object_gfx();
127 void free_object_gfx();
128
129 #endif 
130
131 /* Local Variables: */
132 /* mode:c++ */
133 /* End: */