src/PhysicsWorld.hh
author convert-repo
Tue, 13 Jan 2009 16:11:37 +0000
changeset 388 ecb243eebc25
parent 300 417183866f35
child 408 e6cfc44266af
permissions -rw-r--r--
update tags
#ifndef PHYSICS_WORLD_HH
#define PHYSICS_WORLD_HH

#include <ClanLib/display.h>
#include <ClanLib/core.h>

#include <algorithm>
#include <functional>
#include <cmath>

#include "Terrain.hh"          

class PhysicsWorld;

#include "PhysicsObject.hh"
#include "Vector.hh"
#include "Timer.hh"
#include "Config.hh"

/**
* PhysicsWorld class. PhysicsWorld contains PhysicsObjects that are
* simulated in the PhysicsWorld.
*/
class PhysicsWorld : public Terrain {
    friend class PhysicsObject;

private:

    
protected:
    std::list<PhysicsObject*> objects;

    // Contains connections between signals and slots
    CL_SlotContainer slots;

    Vector dimensions;
    Vector gravity;

public:
    // Someone is going to kill me for this
    Timer tick_timer;

    PhysicsWorld(Vector gravity, Vector dimensions);

    /**
     * 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