terom@185: #ifndef INPUT_HH terom@185: #define INPUT_HH terom@185: terom@221: #include terom@230: #include terom@221: #include terom@185: terom@221: // const uint16_t INPUT_INTERVAL_MS = 20; terom@221: terom@233: enum PlayerInputBit { terom@233: INPUT_NONE = 0x0000, terom@233: terom@221: INPUT_AIM_UP = 0x0001, terom@221: INPUT_AIM_DOWN = 0x0002, terom@185: terom@185: INPUT_MOVE_LEFT = 0x0004, terom@185: INPUT_MOVE_RIGHT = 0x0008, terom@185: terom@221: INPUT_JUMP = 0x0010, terom@221: INPUT_DIG = 0x0020, terom@185: INPUT_SHOOT = 0x0040, terom@237: INPUT_CHANGE_NEXT = 0x0080, terom@237: INPUT_CHANGE_PREV = 0x0100, terom@237: INPUT_ROPE = 0x0200, terom@237: INPUT_UNROPE = 0x0400, terom@237: INPUT_ROPE_UP = 0x0800, terom@237: INPUT_ROPE_DOWN = 0x1000, terom@185: }; terom@185: terom@233: enum GuiInputBit { terom@233: GUI_INPUT_QUIT = 0x0001, terom@233: GUI_INPUT_DISPLAY_WEAPON = 0x0002, terom@233: GUI_INPUT_DEBUG_PLAYER = 0x0004, terom@221: }; terom@221: terom@233: typedef uint16_t PlayerInput; terom@233: typedef uint16_t GuiInput; terom@185: terom@235: template struct InputKeymapEntry; terom@235: terom@235: class Input { terom@235: protected: terom@235: CL_InputDevice &keyboard; terom@235: terom@235: public: terom@235: Input (CL_InputDevice &keyboard); terom@235: terom@235: private: terom@235: bool checkKeycode (int keycode); terom@235: template BitMaskType buildMask (InputKeymapEntry *keymap); terom@235: terom@235: public: terom@235: /* terom@235: * Reads the keyboard to determine current state of the Player/Gui input terom@235: */ terom@235: PlayerInput readPlayerInput (void); terom@235: GuiInput readGuiInput (void); terom@235: }; terom@230: terom@185: #endif