/* orxonox - the future of 3D-vertical-scrollers Copyright (C) 2004 orx This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. ### File Specific: main-programmer: ... co-programmer: ... */ //#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD_ENTITY #include "physics_engine.h" #include "list.h" using namespace std; /** \brief standard constructor */ PhysicsEngine::PhysicsEngine() { this->setClassName ("PhysicsEngine"); this->connections = new tList; } /** \brief the singleton reference to this class */ PhysicsEngine* PhysicsEngine::singletonRef = NULL; /** \returns a Pointer to this Class */ PhysicsEngine* PhysicsEngine::getInstance(void) { if (!PhysicsEngine::singletonRef) PhysicsEngine::singletonRef = new PhysicsEngine(); return PhysicsEngine::singletonRef; } /** \brief standard deconstructor */ PhysicsEngine::~PhysicsEngine () { PhysicsEngine::singletonRef = NULL; } /** \brief adds A Physical Connection to the List of Connections \param connection the Connection to add Usually this is done through the constructor of PhysicshConnections */ void PhysicsEngine::addConnection(PhysicsConnection* connection) { this->connections->add(connection); } /** \brief removes A Physical Connection from the List of Connections \param connection the Connection to remove Usually this is done through the destructor of PhysicsConnections */ void PhysicsEngine::removeConnection(PhysicsConnection* connection) { this->connections->remove(connection); } /** \brief Steps through all the Connections and Ticks them \param dt The time Passed in Seconds This function brings a flow into the whole animation */ void PhysicsEngine::tick(float dt) { tIterator* iterator = this->connections->getIterator(); PhysicsConnection* enumConn = iterator->nextElement(); while (enumConn) { enumConn->apply(dt); enumConn = iterator->nextElement(); } delete iterator; }