From a7f23865ff7ffb57d35505bc0cf67507f1751ff2 Mon Sep 17 00:00:00 2001 From: Ekaitz Zarraga Date: Fri, 24 Dec 2021 20:16:41 +0100 Subject: Rename keyHandler to keyboard --- src/keyboard.cpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/keyboard.cpp (limited to 'src/keyboard.cpp') diff --git a/src/keyboard.cpp b/src/keyboard.cpp new file mode 100644 index 0000000..b3efada --- /dev/null +++ b/src/keyboard.cpp @@ -0,0 +1,29 @@ +#include "keyboard.h" + +Keyboard::Keyboard(){ + nop = new Nop; +} +Keyboard::~Keyboard(){ + delete nop; +} + +Command* Keyboard::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* Keyboard::pressed( SDL_Keycode k, Uint16 mod ){ + // TODO + return nop; +} + +Command* Keyboard::released( SDL_Keycode k, Uint16 mod ){ + // TODO + return nop; +} -- cgit v1.2.3