X-Git-Url: http://gitweb.pgornicz.com/gitweb.cgi?a=blobdiff_plain;f=src%2Fgame.cpp;h=1aabda25e415c76308f2c34691dc4888bc3464ca;hb=7adc59fef43ae9741d455448770b585e28e87c98;hp=8800e06ab1d71d78e484eae1caa14c53415e54b3;hpb=ad9f1fb6bdfc51df61a7fb52d607ca0c0bceca4c;p=physics.git diff --git a/src/game.cpp b/src/game.cpp index 8800e06..1aabda2 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -1,14 +1,17 @@ #include "game.h" +#include "debug.h" + +#include +using std::vector; + +#include "entityCreator.h" +#include "effectManager.h" #include "GameStates/GameState.h" #include "GameStates/Running.h" #include "GameStates/Paused.h" #include "GameStates/CreatingPolygon.h" -#include -using std::vector; - - /// ***** Private Variables ***** // The stack of active game states @@ -27,10 +30,25 @@ void gameInit() running = new Running(); paused = new Paused(); creating_Polygon = new CreatingPolygon(); + + // create starting entities + creator::init(); + + active_States.push_back(running); + + effect::init(); + +#ifdef DEBUGGING + cout << "World Created" << endl; +#endif } void gameClean() { + effect::clean(); + + creator::clean(); + delete creating_Polygon; delete paused; delete running; @@ -38,27 +56,26 @@ void gameClean() void gameInput() { - int size = active_States.size(); + int last = active_States.size() -1; for( int i = 0; - i < size; + i <= last; i++ ) { - if( i-1 == size ) + if( i == last ) active_States[i]->handleInput(true); else active_States[i]->handleInput(false); } - } void gameUpdate(float time_step) { - int size = active_States.size(); + int last = active_States.size() -1; for( int i = 0; - i < size; + i <= last; i++ ) { - if( i-1 == size ) + if( i == last ) active_States[i]->update(time_step, true); else active_States[i]->update(time_step, false); @@ -67,12 +84,12 @@ void gameUpdate(float time_step) void gameDraw() { - int size = active_States.size(); + int last = active_States.size() -1; for( int i = 0; - i < size; + i <= last; i++ ) { - if( i-1 == size ) + if( i == last ) active_States[i]->draw(true); else active_States[i]->draw(false);