added an interupt handler has SIGINT was being ignored... ?
[physics.git] / src / main.cpp
index df9f490..7313306 100644 (file)
@@ -2,22 +2,22 @@
 #include <GL/glu.h>
 #include <SDL/SDL.h>
 
-#include <iostream>
-using std::cerr;
-using std::cout;
-using std::endl;
-
-#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();
 
@@ -67,18 +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
+}
+
+void cleanUp()
+{
+#ifdef DEBUGGING
+    cout << "Cleaning up" << endl;
+#endif
 
-    // create starting entities
+    gameClean();
 
-    cout << "World Created" << endl;
+    graphicsCleanUp();
 }
 
 void run()
@@ -95,11 +103,6 @@ void run()
     }
 }
 
-void cleanUp()
-{
-    gameClean();
-}
-
 void blockUpdate()
 {
     long int start = tickCountMicro();
@@ -140,17 +143,20 @@ void updateFPSCounters()
         draw_Count = 0;
 
         last_Second = tickCountMicro();
+
+        //cout << "ups:\t" << ups << endl;
+        //cout << "fps:\t" << fps << endl;
     }
 }
 
 void input()
 {
+    inputUpdate();
+
     gameInput();
 
-    /*
-    if(key[KEY_ESC])
+    if(wasReleased(SDLK_ESCAPE))
         is_Running = false;
-    */
 }
 
 void update(float time_step)