summaryrefslogtreecommitdiff
path: root/src/keyboard.cpp
diff options
context:
space:
mode:
authorEkaitz Zarraga <ekaitz@elenq.tech>2022-05-21 21:36:37 +0200
committerEkaitz Zarraga <ekaitz@elenq.tech>2022-05-21 21:36:37 +0200
commit41d2578d3401e38fa8600a533ad5998dc39e7be5 (patch)
tree8199af62e448b1010bab8ec4caca98d7ada860ff /src/keyboard.cpp
parent3ce5ae75abd2de874b6c33214ea44063f11a0d4d (diff)
add move sideways capability
Diffstat (limited to 'src/keyboard.cpp')
-rw-r--r--src/keyboard.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/keyboard.cpp b/src/keyboard.cpp
index 1eff1d1..8f5d81c 100644
--- a/src/keyboard.cpp
+++ b/src/keyboard.cpp
@@ -2,13 +2,18 @@
Keyboard::Keyboard(){
nop = new Nop;
- pressedDown = new KeyboardDownPressed;
- releasedDown = new KeyboardDownReleased;
+
+ pressedDown = new KeyboardDownPressed;
+ releasedDown = new KeyboardDownReleased;
+ pressedLeft = new KeyboardLeftPressed;
+ pressedRight = new KeyboardRightPressed;
}
Keyboard::~Keyboard(){
delete nop;
delete pressedDown;
delete releasedDown;
+ delete pressedLeft;
+ delete pressedRight;
}
Command* Keyboard::handleEvent( SDL_Event e ){
@@ -26,6 +31,10 @@ Command* Keyboard::pressed( SDL_Keycode k, Uint16 mod ){
switch(k){
case SDLK_DOWN:
return pressedDown;
+ case SDLK_LEFT:
+ return pressedLeft;
+ case SDLK_RIGHT:
+ return pressedRight;
default:
return nop;
}