now draws a ball, fixed top of states bug
[physics.git] / src / game.cpp
index 32a9e0b..ebf2ba7 100644 (file)
@@ -1,9 +1,9 @@
+#include "game.h"
+#include "debug.h"
+
 #include <vector>
 using std::vector;
 
-#include "game.h"
-
-#include "debug.h"
 #include "entityCreator.h"
 
 #include "GameStates/GameState.h"
@@ -31,9 +31,10 @@ void gameInit()
     creating_Polygon = new CreatingPolygon();
 
     // create starting entities
-
     creator::init();
 
+    active_States.push_back(running);
+
 #ifdef DEBUGGING
     cout << "World Created" << endl;
 #endif
@@ -50,27 +51,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);
@@ -79,12 +79,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);