diff options
Diffstat (limited to 'src/keyboard.cpp')
-rw-r--r-- | src/keyboard.cpp | 13 |
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; } |