UGDK
|
00001 #ifndef UGDK_INPUT_INPUTMANAGER_H_ 00002 #define UGDK_INPUT_INPUTMANAGER_H_ 00003 00004 #include <ugdk/math/vector2D.h> 00005 #include <ugdk/input/keys.h> 00006 00007 namespace ugdk { 00008 namespace input { 00009 00010 #define BUFFER_SIZE 32 00011 #define INPUT_MANAGER() (ugdk::Engine::reference()->input_manager()) 00012 00013 class InputManager { 00014 public: 00015 // Construtores e destrutores 00016 InputManager(); 00017 ~InputManager(); 00018 00019 // Member functions e 00020 void Update(double); 00021 Vector2D GetMousePosition(void); 00022 void ShowCursor(bool toggle); 00023 bool KeyPressed(Key key); 00024 bool KeyReleased(Key key); 00025 bool KeyDown(Key key); 00026 bool KeyUp(Key key); 00027 00028 bool MousePressed(MouseButton button); 00029 bool MouseReleased(MouseButton button); 00030 bool MouseDown(MouseButton button); 00031 bool MouseUp(MouseButton button); 00032 bool CheckSequence(Key* sequence, int size); 00033 00034 void SimulateKeyPress(Key key); 00035 void SimulateKeyRelease(Key key); 00036 00037 private: 00038 int kbsize_; 00039 bool *keystate_now_, *keystate_last_; 00040 bool mousestate_now_[5], mousestate_last_[5]; 00041 Key buffer_[BUFFER_SIZE]; 00042 int buffer_end_; 00043 Vector2D mouseposition_; 00044 00045 void UpdateDevices(); 00046 }; 00047 00048 } // namespace input 00049 } // namespace ugdk 00050 00051 #endif