added an interupt handler has SIGINT was being ignored... ?
[physics.git] / src / main.cpp
index fd14612..7313306 100644 (file)
@@ -2,20 +2,22 @@
 #include <GL/glu.h>
 #include <SDL/SDL.h>
 
-#include <vector>
-using std::vector;
-
 #include "debug.h"
+#include "handleSignal.h"
 
 #include "game.h"
 #include "ticks.h"
-#include "graphics.h"
+
+#include "graphics/graphics.h"
 #include "input/inputManager.h"
 
 
+
 /// ***** Private Method Headers *****
 void init();
 
+void sighandler( int sig );
+
 void run();
 void cleanUp();
 
@@ -65,22 +67,26 @@ long int last_Second;
 /// ***** Private Methods *****
 void init()
 {
+    installSignal();
+
     graphicsInit();
 
     gameInit();
 
-    // TODO
-    // add a game state
-
 #ifdef DEBUGGING
     cout << "Initialization Complete" << endl;
 #endif
+}
 
-    // create starting entities
-
+void cleanUp()
+{
 #ifdef DEBUGGING
-    cout << "World Created" << endl;
+    cout << "Cleaning up" << endl;
 #endif
+
+    gameClean();
+
+    graphicsCleanUp();
 }
 
 void run()
@@ -97,11 +103,6 @@ void run()
     }
 }
 
-void cleanUp()
-{
-    gameClean();
-}
-
 void blockUpdate()
 {
     long int start = tickCountMicro();
@@ -142,6 +143,9 @@ void updateFPSCounters()
         draw_Count = 0;
 
         last_Second = tickCountMicro();
+
+        //cout << "ups:\t" << ups << endl;
+        //cout << "fps:\t" << fps << endl;
     }
 }
 
@@ -151,7 +155,7 @@ void input()
 
     gameInput();
 
-    if(isPressed(SDLK_ESCAPE))
+    if(wasReleased(SDLK_ESCAPE))
         is_Running = false;
 }