UGDK  0.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
keyboard.h
Go to the documentation of this file.
1 #ifndef UGDK_INPUT_KEYBOARD_H_
2 #define UGDK_INPUT_KEYBOARD_H_
3 
4 #include <ugdk/system.h>
5 #include <ugdk/input/scancode.h>
6 #include <ugdk/input/keycode.h>
7 #include <set>
8 #include <memory>
9 
10 namespace ugdk {
11 namespace input {
12 
13 class Keyboard {
14  public:
15  bool IsDown(const Scancode& scancode) const;
16  bool IsDown(const Keycode& keycode) const;
17  bool IsUp(const Scancode& scancode) const;
18  bool IsUp(const Keycode& keycode) const;
19 
20  bool IsPressed(const Scancode& scancode) const;
21  bool IsPressed(const Keycode& keycode) const;
22  bool IsReleased(const Scancode& scancode) const;
23  bool IsReleased(const Keycode& keycode) const;
24 
25  private:
26  Keyboard();
27  ~Keyboard();
28 
29  void Update();
30  const system::SDLEventHandler* event_handler();
31 
32  std::unique_ptr<system::SDLEventHandler> event_handler_;
33  std::set<Scancode> keystate_, keystate_previous_;
34 
35  friend class Manager;
37 };
38 
39 } // namespace input
40 } // namespace ugdk
41 
42 #endif // UGDK_INPUT_KEYBOARD_H_
Definition: animation.h:11
Scancode
The SDL keyboard scancode representation.
Definition: scancode.h:45
bool IsUp(const Scancode &scancode) const
Definition: manager.h:18
bool IsReleased(const Scancode &scancode) const
Definition: keyboard.h:13
friend class KeyboardInputSDLEventHandler
Definition: keyboard.h:36
bool IsDown(const Scancode &scancode) const
Keycode
The SDL virtual key representation.
Definition: keycode.h:49
bool IsPressed(const Scancode &scancode) const