00001 #ifndef __INPUTMANAGER__H__
00002 #define __INPUTMANAGER__H__
00003
00004 #include "../Util/Singleton.h"
00005
00006 #define KEY_F1 (GLUT_KEY_F1+256)
00007 #define KEY_F2 (GLUT_KEY_F2+256)
00008 #define KEY_F3 (GLUT_KEY_F3+256)
00009 #define KEY_F4 (GLUT_KEY_F4+256)
00010 #define KEY_F5 (GLUT_KEY_F5+256)
00011 #define KEY_F6 (GLUT_KEY_F6+256)
00012 #define KEY_F7 (GLUT_KEY_F7+256)
00013 #define KEY_F8 (GLUT_KEY_F8+256)
00014 #define KEY_F9 (GLUT_KEY_F9+256)
00015 #define KEY_F10 (GLUT_KEY_F10+256)
00016 #define KEY_F11 (GLUT_KEY_F11+256)
00017 #define KEY_F12 (GLUT_KEY_F12+256)
00018
00019 #define KEY_LEFT (GLUT_KEY_LEFT+256)
00020 #define KEY_UP (GLUT_KEY_UP+256)
00021 #define KEY_RIGHT (GLUT_KEY_RIGHT+256)
00022 #define KEY_DOWN (GLUT_KEY_DOWN+256)
00023 #define KEY_PAGE_UP (GLUT_KEY_PAGE_UP+256)
00024 #define KEY_PAGE_DOWN (GLUT_KEY_PAGE_DOWN+256)
00025 #define KEY_HOME (GLUT_KEY_HOME+256)
00026 #define KEY_END (GLUT_KEY_END+256)
00027 #define KEY_INSERT (GLUT_KEY_INSERT+256)
00028
00029 #define KEY_CONSOLE '`'
00030 #define KEY_TAB 9
00031 #define KEY_BACKSPACE 8
00032 #define KEY_DELETE 127
00033 #define KEY_SPACE ' '
00034 #define KEY_ENTER 13
00035 #define KEY_ESCAPE 27
00036
00037 #define MOUSE_LEFT GLUT_LEFT_BUTTON
00038 #define MOUSE_MIDDLE GLUT_MIDDLE_BUTTON
00039 #define MOUSE_RIGHT GLUT_RIGHT_BUTTON
00040
00041 class InputManager : public Singleton<InputManager>
00042 {
00043 friend class Singleton<InputManager>;
00044
00045 public:
00046 InputManager(void);
00047 ~InputManager(void);
00048
00049
00050 void Init(void);
00051
00052
00053 void Exit(void);
00054
00055
00056 const bool IsKeyPressed(const int& key) const;
00057
00058
00059 const bool IsKeyPressedAndReset(const int& key);
00060
00061
00062 const bool IsMouseKeyPressed(const int& key) const;
00063
00064
00065 const POINT GetMousePosition(void);
00066 const POINT GetRelMousePosition(void);
00067
00068
00069 void KeyUpFunction(const unsigned char& key, const int& x, const int& y);
00070 void KeyDownFunction(const unsigned char& key, const int& x, const int& y);
00071 void SpecialKeyUpFunction(const int& key, const int& x, const int& y);
00072 void SpecialKeyDownFunction(const int& key, const int& x, const int& y);
00073 void MouseFunction(const int& button, const int& state, const int& x, const int& y);
00074
00075 private:
00076
00077 bool keyStates[512];
00078
00079
00080 bool mouseStates[3];
00081
00082
00083 int lastX;
00084
00085
00086 int lastY;
00087 };
00088
00089 #endif