UGDK  0.4.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
inputmanager.h
Go to the documentation of this file.
1 #ifndef UGDK_INPUT_INPUTMANAGER_H_
2 #define UGDK_INPUT_INPUTMANAGER_H_
3 
4 #include <ugdk/math/vector2D.h>
5 #include <ugdk/input/keys.h>
6 
7 namespace ugdk {
8 namespace input {
9 
10 #define BUFFER_SIZE 32
11 #define INPUT_MANAGER() (ugdk::Engine::reference()->input_manager())
12 
13 class InputManager {
14  public:
15  // Construtores e destrutores
16  InputManager();
17  ~InputManager();
18 
19  // Member functions e
20  void Update(double);
22  void ShowCursor(bool toggle);
23  bool KeyPressed(Key key);
24  bool KeyReleased(Key key);
25  bool KeyDown(Key key);
26  bool KeyUp(Key key);
27 
28  bool MousePressed(MouseButton button);
29  bool MouseReleased(MouseButton button);
30  bool MouseDown(MouseButton button);
31  bool MouseUp(MouseButton button);
32  bool CheckSequence(Key* sequence, int size);
33 
34  void SimulateKeyPress(Key key);
35  void SimulateKeyRelease(Key key);
36 
37  private:
38  int kbsize_;
39  bool *keystate_now_, *keystate_last_;
40  bool mousestate_now_[5], mousestate_last_[5];
41  Key buffer_[BUFFER_SIZE];
42  int buffer_end_;
43  Vector2D mouseposition_;
44 
45  void UpdateDevices();
46 };
47 
48 } // namespace input
49 } // namespace ugdk
50 
51 #endif