]> git.localhorst.tv Git - l2e.git/blob - src/app/Input.cpp
removed stupid file headers that eclipse put in
[l2e.git] / src / app / Input.cpp
1 #include "Input.h"
2
3 using std::map;
4
5 namespace app {
6
7 Input::Input()
8 : down(0)
9 , pressed(0)
10 , released(0) {
11
12 }
13
14
15 void Input::HandleKeyboardEvent(const SDL_KeyboardEvent &e) {
16         map<SDLKey, Button>::const_iterator key(mapping.find(e.keysym.sym));
17         if (key == mapping.end()) return;
18
19         Button button(key->second);
20         if (e.state == SDL_PRESSED) {
21                 down |= button;
22                 pressed |= button;
23         } else {
24                 down &= ~button;
25                 released |= button;
26         }
27 }
28
29 }