#ifndef PHYSICS_WORLD_HH
#define PHYSICS_WORLD_HH
#include "Terrain.hh"
class PhysicsWorld;
#include "PhysicsObject.hh"
#include "Vector.hh"
#include "Timer.hh"
#include "Config.hh"
#include <ClanLib/core.h>
/**
* PhysicsWorld class. PhysicsWorld contains a number of PhysicsObjects that are simulated forward in time using
* the physics tick rate
*/
class PhysicsWorld {
friend class PhysicsObject;
// XXX: needs some fixing up, move Terrain methods
public:
/** The world's terrain */
Terrain &terrain;
/** Size of simulation area */
Vector dimensions;
protected:
/** List of simulated objects*/
std::list<PhysicsObject*> objects;
/** Gravity vector */
Vector gravity;
/** Physics simulation ticks */
Timer tick_timer;
CL_SlotContainer slots;
public:
/**
* Construct a world with the given configuration.
*/
PhysicsWorld (Vector gravity, Vector dimensions, Terrain &terrain);
/**
* Add object to the PhysicsWorld.
*
* @param object Pointer to the PhysicsObject to add.
*/
void addPhysicsObject (PhysicsObject *object);
/**
* Remove the object from the PhysicsWorld.
*/
void removePhysicsObject (PhysicsObject *po);
/**
* Advance one time step in physics simulation.
*/
void tick (TimeMS tick_length);
/**
* Get current tick in physics simulation.
*
* @return tick Current simulation tick.
*/
TickCount getTicks (void);
};
#endif