summaryrefslogtreecommitdiff
path: root/src/keyboard.cpp
diff options
context:
space:
mode:
authorEkaitz Zarraga <ekaitz@elenq.tech>2021-12-28 12:39:47 +0100
committerEkaitz Zarraga <ekaitz@elenq.tech>2021-12-28 12:40:09 +0100
commit1d6a7bb467d28898da5eb1270a6e8dabf958fa42 (patch)
treef4ff1dfebf6fe6e747181b5fcdebede2b9bd9302 /src/keyboard.cpp
parenta7f23865ff7ffb57d35505bc0cf67507f1751ff2 (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.cpp20
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;
+ }
}