From 718941eacdfd4dca757e355ea141d684ab140ce3 Mon Sep 17 00:00:00 2001 From: Anna Wiggins Date: Fri, 24 Jun 2011 09:48:59 -0400 Subject: [PATCH] Quit on Ctrl-Q --- gamecore.cpp | 7 +++++++ gamecore.h | 2 ++ 2 files changed, 9 insertions(+) diff --git a/gamecore.cpp b/gamecore.cpp index dcfc663..35881ac 100644 --- a/gamecore.cpp +++ b/gamecore.cpp @@ -1,5 +1,6 @@ #include "gamecore.h" #include "mathutils.h" +#include "debug.h" #include int GameCore::MAX_MOVE_DISTANCE = 100; @@ -70,3 +71,9 @@ void GameCore::on_rbutton_down(int mX, int mY) { 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; +} diff --git a/gamecore.h b/gamecore.h index a69e500..07216e3 100644 --- a/gamecore.h +++ b/gamecore.h @@ -24,6 +24,8 @@ class GameCore : public MainEvent void on_exit(); void on_lbutton_down(int x, int y); void on_rbutton_down(int mX, int mY); + void on_key_down(SDLKey sym, SDLMod mod, Uint16 unicode); + private: bool init();