summaryrefslogtreecommitdiff
path: root/src/keyboard.cpp
diff options
context:
space:
mode:
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;
+ }
}