You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.0 KiB
C++
50 lines
1.0 KiB
C++
#ifndef __JOYSTICKLISTENER_H__
|
|
#define __JOYSTICKLISTENER_H__
|
|
|
|
#include "OIS.h"
|
|
#include "windows.h"
|
|
|
|
#include <math.h>
|
|
#include <cstdlib>
|
|
#include <iostream>
|
|
#include <iomanip>
|
|
#include <ios>
|
|
#include <sstream>
|
|
#include <vector>
|
|
|
|
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<bool> &buttons);
|
|
|
|
protected:
|
|
private:
|
|
OIS::InputManager* m_pInputMgr;
|
|
OIS::JoyStick* m_pJoystickMgr;
|
|
OIS::JoyStickState m_pJoyStickState;
|
|
};
|
|
}
|
|
|
|
#endif |