SRCS += mathw.cpp
SRCS += ticks.cpp
SRCS += Vector2.cpp
+SRCS += handleSignal.cpp
SRCS += Entities/Ball.cpp
SRCS += Entities/Entity.cpp
--- /dev/null
+#include "handleSignal.h"
+
+#include <iostream>
+#include <signal.h>
+
+/// ***** Private Method Headers *****
+void sighandler( int sig );
+
+
+/// ***** Public Methods *****
+
+void installSignal()
+{
+ // register signal handler
+ struct sigaction sa;
+ sigemptyset( &sa.sa_mask );
+ sa.sa_handler = sighandler;
+ sa.sa_flags = 0;
+
+ if ( sigaction( SIGINT, &sa, NULL ) < 0 )
+ {
+ std::cerr << "could not install SIGINT handler" << std::endl;
+ }
+}
+
+/// ***** Private Methods *****
+
+// signal handler function
+void sighandler( int sig )
+{
+ switch(sig)
+ {
+ case SIGINT:
+ std::cerr << "SIGINT caught" << std::endl;
+ break;
+ default:
+ std::cout << "UNKNOWN caught";
+ }
+
+ // normally an abort is better ... but this is just SIGINT
+ exit(sig);
+}
#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 "input/inputManager.h"
+
/// ***** Private Method Headers *****
void init();
+void sighandler( int sig );
+
void run();
void cleanUp();
/// ***** Private Methods *****
void init()
{
+ installSignal();
+
graphicsInit();
gameInit();