summaryrefslogtreecommitdiff
path: root/src/command.cpp
blob: 24b50cdcc2a9ffdadb595dd202b05f73f8e4f42b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include "command.h"
#include "game.h"

Command::~Command(){}

Nop::~Nop(){}
void Nop::execute( GameState &game ){
}

// Window commands
WindowClose::~WindowClose(){}
void WindowClose::execute( GameState &game ){
    game.close();
}

WindowFocus::~WindowFocus(){}
void WindowFocus::execute( GameState &game ){
    game.resume();
}

WindowUnFocus::~WindowUnFocus(){}
void WindowUnFocus::execute( GameState &game ){
    game.pause();
}

// Keyboard commands
KeyboardDownReleased::~KeyboardDownReleased(){}
void KeyboardDownReleased::execute( GameState &game ){
    game.releaseDown();
}
KeyboardDownPressed::~KeyboardDownPressed(){}
void KeyboardDownPressed::execute( GameState &game ){
    game.pressDown();
}
KeyboardLeftPressed::~KeyboardLeftPressed(){}
void KeyboardLeftPressed::execute( GameState &game ){
    game.pressLeft();
}
KeyboardRightPressed::~KeyboardRightPressed(){}
void KeyboardRightPressed::execute( GameState &game ){
    game.pressRight();
}
KeyboardSpacePressed::~KeyboardSpacePressed(){}
void KeyboardSpacePressed::execute( GameState &game ){
    game.pressRotate();
}