cleanup
This commit is contained in:
@@ -1,48 +0,0 @@
|
||||
#include <cstddef>
|
||||
|
||||
#include "InputHandler.h"
|
||||
|
||||
InputHandler::InputHandler() {
|
||||
Command* com = new TestCommand();
|
||||
buttonW = com;
|
||||
buttonA = com;
|
||||
buttonS = com;
|
||||
buttonD = com;
|
||||
}
|
||||
|
||||
Command* InputHandler::handleInput() {
|
||||
if(cur == commandStream.size()) {
|
||||
return NULL;
|
||||
}
|
||||
return commandStream[cur++];
|
||||
}
|
||||
|
||||
void InputHandler::inputEvent(SDL_Event *e) {
|
||||
switch(e->key.keysym.sym) {
|
||||
case SDLK_w:
|
||||
commandStream.push_back(buttonW);
|
||||
break;
|
||||
|
||||
case SDLK_a:
|
||||
commandStream.push_back(buttonA);
|
||||
break;
|
||||
|
||||
case SDLK_s:
|
||||
commandStream.push_back(buttonS);
|
||||
break;
|
||||
|
||||
case SDLK_d:
|
||||
commandStream.push_back(buttonD);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
InputHandler::~InputHandler() {
|
||||
delete buttonW;
|
||||
/*delete buttonA;
|
||||
delete buttonS;
|
||||
delete buttonD;*/
|
||||
}
|
||||
Reference in New Issue
Block a user