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