diff options
author | Ekaitz Zarraga <ekaitz@elenq.tech> | 2021-12-28 12:39:47 +0100 |
---|---|---|
committer | Ekaitz Zarraga <ekaitz@elenq.tech> | 2021-12-28 12:40:09 +0100 |
commit | 1d6a7bb467d28898da5eb1270a6e8dabf958fa42 (patch) | |
tree | f4ff1dfebf6fe6e747181b5fcdebede2b9bd9302 /src/keyboard.cpp | |
parent | a7f23865ff7ffb57d35505bc0cf67507f1751ff2 (diff) |
Huge rewrite, this is not how I'm supposed to use git but whatever
Diffstat (limited to 'src/keyboard.cpp')
-rw-r--r-- | src/keyboard.cpp | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/keyboard.cpp b/src/keyboard.cpp index b3efada..1eff1d1 100644 --- a/src/keyboard.cpp +++ b/src/keyboard.cpp @@ -2,9 +2,13 @@ Keyboard::Keyboard(){ nop = new Nop; + pressedDown = new KeyboardDownPressed; + releasedDown = new KeyboardDownReleased; } Keyboard::~Keyboard(){ delete nop; + delete pressedDown; + delete releasedDown; } Command* Keyboard::handleEvent( SDL_Event e ){ @@ -19,11 +23,19 @@ Command* Keyboard::handleEvent( SDL_Event e ){ } Command* Keyboard::pressed( SDL_Keycode k, Uint16 mod ){ - // TODO - return nop; + switch(k){ + case SDLK_DOWN: + return pressedDown; + default: + return nop; + } } Command* Keyboard::released( SDL_Keycode k, Uint16 mod ){ - // TODO - return nop; + switch(k){ + case SDLK_DOWN: + return releasedDown; + default: + return nop; + } } |