#ifndef __JOYSTICKLISTENER_H__ #define __JOYSTICKLISTENER_H__ #include "OIS.h" #include "windows.h" #include #include #include #include #include #include #include namespace JSParser { class JoyStickListener : public OIS::JoyStickListener { public: JoyStickListener(); ~JoyStickListener(); void init(HWND hWnd); bool buttonPressed( const OIS::JoyStickEvent &arg, int button ); bool buttonReleased( const OIS::JoyStickEvent &arg, int button ); //摇杆主轴 bool axisMoved( const OIS::JoyStickEvent &arg, int axis ); //摇杆上的多向按钮(帽) bool povMoved( const OIS::JoyStickEvent &arg, int pov ); bool isInit() { return (m_pJoystickMgr == NULL) ? false : true; }; // 更新摇杆主轴状态 void UpdateStick(float &a,float &e); // 更新摇杆按钮状态 void UpdateButtons(std::vector &buttons); protected: private: OIS::InputManager* m_pInputMgr; OIS::JoyStick* m_pJoystickMgr; OIS::JoyStickState m_pJoyStickState; }; } #endif