16 #include "Vector.hh" |
16 #include "Vector.hh" |
17 #include "Timer.hh" |
17 #include "Timer.hh" |
18 #include "Config.hh" |
18 #include "Config.hh" |
19 |
19 |
20 /** |
20 /** |
21 * PhysicsWorld class. PhysicsWorld contains PhysicsObjects that are |
21 * PhysicsWorld class. PhysicsWorld contains a number of PhysicsObjects that are simulated forward in time using |
22 * simulated in the PhysicsWorld. |
22 * the physics tick rate |
23 */ |
23 */ |
24 class PhysicsWorld : public Terrain { |
24 class PhysicsWorld { |
25 friend class PhysicsObject; |
25 friend class PhysicsObject; |
26 |
26 |
27 private: |
27 // XXX: needs some fixing up, move Terrain methods |
|
28 public: |
|
29 /** The world's terrain */ |
|
30 Terrain &terrain; |
28 |
31 |
|
32 protected: |
|
33 /** List of simulated objects*/ |
|
34 std::list<PhysicsObject*> objects; |
29 |
35 |
30 protected: |
36 /** Size of simulation area */ |
31 std::list<PhysicsObject*> objects; |
37 Vector dimensions; |
32 |
38 |
33 // Contains connections between signals and slots |
39 /** Gravity vector */ |
|
40 Vector gravity; |
|
41 |
|
42 /** Physics simulation ticks */ |
|
43 Timer tick_timer; |
|
44 |
34 CL_SlotContainer slots; |
45 CL_SlotContainer slots; |
35 |
46 |
36 Vector dimensions; |
|
37 Vector gravity; |
|
38 |
|
39 public: |
47 public: |
40 // Someone is going to kill me for this |
48 /** |
41 Timer tick_timer; |
49 * Construct a world with the given configuration. |
42 |
50 */ |
43 PhysicsWorld(Vector gravity, Vector dimensions); |
51 PhysicsWorld (Vector gravity, Vector dimensions, Terrain &terrain); |
44 |
52 |
45 /** |
53 /** |
46 * Add object to the PhysicsWorld. |
54 * Add object to the PhysicsWorld. |
47 * |
55 * |
48 * @param object Pointer to the PhysicsObject to add. |
56 * @param object Pointer to the PhysicsObject to add. |
49 */ |
57 */ |
50 void addPhysicsObject(PhysicsObject *object); |
58 void addPhysicsObject (PhysicsObject *object); |
51 |
59 |
52 /** |
60 /** |
53 * Remove the object from the PhysicsWorld. |
61 * Remove the object from the PhysicsWorld. |
54 */ |
62 */ |
55 void removePhysicsObject (PhysicsObject *po); |
63 void removePhysicsObject (PhysicsObject *po); |