Quit on Ctrl-Q

This commit is contained in:
Anna Rose 2011-06-24 09:48:59 -04:00
parent 837b3466a5
commit 718941eacd
2 changed files with 9 additions and 0 deletions

View File

@ -1,5 +1,6 @@
#include "gamecore.h" #include "gamecore.h"
#include "mathutils.h" #include "mathutils.h"
#include "debug.h"
#include <SDL/SDL.h> #include <SDL/SDL.h>
int GameCore::MAX_MOVE_DISTANCE = 100; int GameCore::MAX_MOVE_DISTANCE = 100;
@ -70,3 +71,9 @@ void GameCore::on_rbutton_down(int mX, int mY)
{ {
data.clear_current_vertex(); data.clear_current_vertex();
} }
void GameCore::on_key_down(SDLKey sym, SDLMod mod, Uint16 unicode)
{
if (sym == SDLK_q && mod & KMOD_CTRL) is_running = false;
}

View File

@ -24,6 +24,8 @@ class GameCore : public MainEvent
void on_exit(); void on_exit();
void on_lbutton_down(int x, int y); void on_lbutton_down(int x, int y);
void on_rbutton_down(int mX, int mY); void on_rbutton_down(int mX, int mY);
void on_key_down(SDLKey sym, SDLMod mod, Uint16 unicode);
private: private:
bool init(); bool init();