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.
|
|
|
|
#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 );
|
|
|
|
|
|
|
|
|
|
//ҡ<><D2A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
bool axisMoved( const OIS::JoyStickEvent &arg, int axis );
|
|
|
|
|
|
|
|
|
|
//ҡ<><D2A1><EFBFBD>ϵĶ<CFB5><C4B6><EFBFBD><EFBFBD><EFBFBD>ť<EFBFBD><C5A5>ñ<EFBFBD><C3B1>
|
|
|
|
|
bool povMoved( const OIS::JoyStickEvent &arg, int pov );
|
|
|
|
|
|
|
|
|
|
bool isInit() { return (m_pJoystickMgr == NULL) ? false : true; };
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD>ҡ<EFBFBD><D2A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬
|
|
|
|
|
void UpdateStick(float &a,float &e);
|
|
|
|
|
// <20><><EFBFBD><EFBFBD>ҡ<EFBFBD>˰<EFBFBD>ť״̬
|
|
|
|
|
void UpdateButtons(std::vector<bool> &buttons);
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
private:
|
|
|
|
|
OIS::InputManager* m_pInputMgr;
|
|
|
|
|
OIS::JoyStick* m_pJoystickMgr;
|
|
|
|
|
OIS::JoyStickState m_pJoyStickState;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif
|