#include "keyboard.h" 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 ){ switch( e.type ){ case SDL_KEYDOWN: return pressed( e.key.keysym.sym, e.key.keysym.mod ); case SDL_KEYUP: return released( e.key.keysym.sym, e.key.keysym.mod ); default: return nop; } } Command* Keyboard::pressed( SDL_Keycode k, Uint16 mod ){ switch(k){ case SDLK_DOWN: return pressedDown; default: return nop; } } Command* Keyboard::released( SDL_Keycode k, Uint16 mod ){ switch(k){ case SDLK_DOWN: return releasedDown; default: return nop; } }