author | nireco |
Sat, 31 Jan 2009 12:33:08 +0200 | |
changeset 443 | 5d1119729f58 |
parent 423 | 947ab54de4b7 |
permissions | -rw-r--r-- |
197 | 1 |
#ifndef PHYSICS_WORLD_HH |
2 |
#define PHYSICS_WORLD_HH |
|
3 |
||
205 | 4 |
#include "Terrain.hh" |
199 | 5 |
|
197 | 6 |
class PhysicsWorld; |
7 |
||
8 |
#include "PhysicsObject.hh" |
|
9 |
#include "Vector.hh" |
|
205 | 10 |
#include "Timer.hh" |
197 | 11 |
#include "Config.hh" |
12 |
||
423
947ab54de4b7
fix worst compilation errors when using the debian lenny gcc/libc...
Tero Marttila <terom@fixme.fi>
parents:
409
diff
changeset
|
13 |
#include <ClanLib/core.h> |
947ab54de4b7
fix worst compilation errors when using the debian lenny gcc/libc...
Tero Marttila <terom@fixme.fi>
parents:
409
diff
changeset
|
14 |
|
197 | 15 |
/** |
408
e6cfc44266af
reorganize Terrain/PhysicsWorld/GameState/Engine to use NetworkClientConnect, and hence handle the connection process asynchronously, and finally properly implement receiving the terrain data from the server
Tero Marttila <terom@fixme.fi>
parents:
300
diff
changeset
|
16 |
* PhysicsWorld class. PhysicsWorld contains a number of PhysicsObjects that are simulated forward in time using |
e6cfc44266af
reorganize Terrain/PhysicsWorld/GameState/Engine to use NetworkClientConnect, and hence handle the connection process asynchronously, and finally properly implement receiving the terrain data from the server
Tero Marttila <terom@fixme.fi>
parents:
300
diff
changeset
|
17 |
* the physics tick rate |
197 | 18 |
*/ |
408
e6cfc44266af
reorganize Terrain/PhysicsWorld/GameState/Engine to use NetworkClientConnect, and hence handle the connection process asynchronously, and finally properly implement receiving the terrain data from the server
Tero Marttila <terom@fixme.fi>
parents:
300
diff
changeset
|
19 |
class PhysicsWorld { |
197 | 20 |
friend class PhysicsObject; |
21 |
||
408
e6cfc44266af
reorganize Terrain/PhysicsWorld/GameState/Engine to use NetworkClientConnect, and hence handle the connection process asynchronously, and finally properly implement receiving the terrain data from the server
Tero Marttila <terom@fixme.fi>
parents:
300
diff
changeset
|
22 |
// XXX: needs some fixing up, move Terrain methods |
e6cfc44266af
reorganize Terrain/PhysicsWorld/GameState/Engine to use NetworkClientConnect, and hence handle the connection process asynchronously, and finally properly implement receiving the terrain data from the server
Tero Marttila <terom@fixme.fi>
parents:
300
diff
changeset
|
23 |
public: |
e6cfc44266af
reorganize Terrain/PhysicsWorld/GameState/Engine to use NetworkClientConnect, and hence handle the connection process asynchronously, and finally properly implement receiving the terrain data from the server
Tero Marttila <terom@fixme.fi>
parents:
300
diff
changeset
|
24 |
/** The world's terrain */ |
e6cfc44266af
reorganize Terrain/PhysicsWorld/GameState/Engine to use NetworkClientConnect, and hence handle the connection process asynchronously, and finally properly implement receiving the terrain data from the server
Tero Marttila <terom@fixme.fi>
parents:
300
diff
changeset
|
25 |
Terrain &terrain; |
409
1a03ff151abc
add --terrain-seed and --terrain-size arguments, plus bugfixes
Tero Marttila <terom@fixme.fi>
parents:
408
diff
changeset
|
26 |
|
1a03ff151abc
add --terrain-seed and --terrain-size arguments, plus bugfixes
Tero Marttila <terom@fixme.fi>
parents:
408
diff
changeset
|
27 |
/** Size of simulation area */ |
1a03ff151abc
add --terrain-seed and --terrain-size arguments, plus bugfixes
Tero Marttila <terom@fixme.fi>
parents:
408
diff
changeset
|
28 |
Vector dimensions; |
197 | 29 |
|
408
e6cfc44266af
reorganize Terrain/PhysicsWorld/GameState/Engine to use NetworkClientConnect, and hence handle the connection process asynchronously, and finally properly implement receiving the terrain data from the server
Tero Marttila <terom@fixme.fi>
parents:
300
diff
changeset
|
30 |
protected: |
e6cfc44266af
reorganize Terrain/PhysicsWorld/GameState/Engine to use NetworkClientConnect, and hence handle the connection process asynchronously, and finally properly implement receiving the terrain data from the server
Tero Marttila <terom@fixme.fi>
parents:
300
diff
changeset
|
31 |
/** List of simulated objects*/ |
e6cfc44266af
reorganize Terrain/PhysicsWorld/GameState/Engine to use NetworkClientConnect, and hence handle the connection process asynchronously, and finally properly implement receiving the terrain data from the server
Tero Marttila <terom@fixme.fi>
parents:
300
diff
changeset
|
32 |
std::list<PhysicsObject*> objects; |
208 | 33 |
|
408
e6cfc44266af
reorganize Terrain/PhysicsWorld/GameState/Engine to use NetworkClientConnect, and hence handle the connection process asynchronously, and finally properly implement receiving the terrain data from the server
Tero Marttila <terom@fixme.fi>
parents:
300
diff
changeset
|
34 |
/** Gravity vector */ |
e6cfc44266af
reorganize Terrain/PhysicsWorld/GameState/Engine to use NetworkClientConnect, and hence handle the connection process asynchronously, and finally properly implement receiving the terrain data from the server
Tero Marttila <terom@fixme.fi>
parents:
300
diff
changeset
|
35 |
Vector gravity; |
e6cfc44266af
reorganize Terrain/PhysicsWorld/GameState/Engine to use NetworkClientConnect, and hence handle the connection process asynchronously, and finally properly implement receiving the terrain data from the server
Tero Marttila <terom@fixme.fi>
parents:
300
diff
changeset
|
36 |
|
e6cfc44266af
reorganize Terrain/PhysicsWorld/GameState/Engine to use NetworkClientConnect, and hence handle the connection process asynchronously, and finally properly implement receiving the terrain data from the server
Tero Marttila <terom@fixme.fi>
parents:
300
diff
changeset
|
37 |
/** Physics simulation ticks */ |
e6cfc44266af
reorganize Terrain/PhysicsWorld/GameState/Engine to use NetworkClientConnect, and hence handle the connection process asynchronously, and finally properly implement receiving the terrain data from the server
Tero Marttila <terom@fixme.fi>
parents:
300
diff
changeset
|
38 |
Timer tick_timer; |
e6cfc44266af
reorganize Terrain/PhysicsWorld/GameState/Engine to use NetworkClientConnect, and hence handle the connection process asynchronously, and finally properly implement receiving the terrain data from the server
Tero Marttila <terom@fixme.fi>
parents:
300
diff
changeset
|
39 |
|
197 | 40 |
CL_SlotContainer slots; |
41 |
||
42 |
public: |
|
408
e6cfc44266af
reorganize Terrain/PhysicsWorld/GameState/Engine to use NetworkClientConnect, and hence handle the connection process asynchronously, and finally properly implement receiving the terrain data from the server
Tero Marttila <terom@fixme.fi>
parents:
300
diff
changeset
|
43 |
/** |
e6cfc44266af
reorganize Terrain/PhysicsWorld/GameState/Engine to use NetworkClientConnect, and hence handle the connection process asynchronously, and finally properly implement receiving the terrain data from the server
Tero Marttila <terom@fixme.fi>
parents:
300
diff
changeset
|
44 |
* Construct a world with the given configuration. |
e6cfc44266af
reorganize Terrain/PhysicsWorld/GameState/Engine to use NetworkClientConnect, and hence handle the connection process asynchronously, and finally properly implement receiving the terrain data from the server
Tero Marttila <terom@fixme.fi>
parents:
300
diff
changeset
|
45 |
*/ |
e6cfc44266af
reorganize Terrain/PhysicsWorld/GameState/Engine to use NetworkClientConnect, and hence handle the connection process asynchronously, and finally properly implement receiving the terrain data from the server
Tero Marttila <terom@fixme.fi>
parents:
300
diff
changeset
|
46 |
PhysicsWorld (Vector gravity, Vector dimensions, Terrain &terrain); |
199 | 47 |
|
225 | 48 |
/** |
197 | 49 |
* Add object to the PhysicsWorld. |
50 |
* |
|
51 |
* @param object Pointer to the PhysicsObject to add. |
|
52 |
*/ |
|
408
e6cfc44266af
reorganize Terrain/PhysicsWorld/GameState/Engine to use NetworkClientConnect, and hence handle the connection process asynchronously, and finally properly implement receiving the terrain data from the server
Tero Marttila <terom@fixme.fi>
parents:
300
diff
changeset
|
53 |
void addPhysicsObject (PhysicsObject *object); |
197 | 54 |
|
55 |
/** |
|
225 | 56 |
* Remove the object from the PhysicsWorld. |
57 |
*/ |
|
58 |
void removePhysicsObject (PhysicsObject *po); |
|
59 |
||
60 |
/** |
|
197 | 61 |
* Advance one time step in physics simulation. |
62 |
*/ |
|
300 | 63 |
void tick (TimeMS tick_length); |
197 | 64 |
|
65 |
/** |
|
66 |
* Get current tick in physics simulation. |
|
67 |
* |
|
68 |
* @return tick Current simulation tick. |
|
69 |
*/ |
|
300 | 70 |
TickCount getTicks (void); |
197 | 71 |
}; |
72 |
||
73 |
#endif |