From 9a9a0e090190dc7a2dba833d1d4efa8417283edc Mon Sep 17 00:00:00 2001 From: Ekaitz Zarraga Date: Fri, 24 Dec 2021 19:53:16 +0100 Subject: Overall cleaning and restructuring using commands --- src/keyHandler.cpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/keyHandler.cpp (limited to 'src/keyHandler.cpp') diff --git a/src/keyHandler.cpp b/src/keyHandler.cpp new file mode 100644 index 0000000..e188992 --- /dev/null +++ b/src/keyHandler.cpp @@ -0,0 +1,29 @@ +#include "keyHandler.h" + +KeyHandler::KeyHandler(){ + nop = new Nop; +} +KeyHandler::~KeyHandler(){ + delete nop; +} + +Command* KeyHandler::handleEvent( SDL_Event e ){ + switch( e.type ){ + case SDL_KEYDOWN: + return pressed( e.key.keysym.sym, e.key.keysym.mod ); + case SDL_KEYUP: + return released( e.key.keysym.sym, e.key.keysym.mod ); + default: + return nop; + } +} + +Command* KeyHandler::pressed( SDL_Keycode k, Uint16 mod ){ + // TODO + return nop; +} + +Command* KeyHandler::released( SDL_Keycode k, Uint16 mod ){ + // TODO + return nop; +} -- cgit v1.2.3