Code: Select all
// main.cpp
// class MyEventReceiver : public IEventReceiver
virtual bool OnEvent(const SEvent& event)
{
if(event.EventType == irr::EET_JOYSTICK_INPUT_EVENT)
{
event.JoystickEvent.POV; //this value
}
}
i view sourcecode of SDL and modify by:
Code: Select all
//CIrrDeviceWin32.cpp
void CIrrDeviceWin32::pollJoysticks()
{
#if defined _IRR_COMPILE_WITH_JOYSTICK_EVENTS_
if(0 == ActiveJoysticks.size())
return;
u32 joystick;
JOYINFOEX info;
////////// edit
//info.dwSize = sizeof(info);
//info.dwFlags = JOY_RETURNALL|JOY_RETURNPOVCTS;
//////////
for(joystick = 0; joystick < ActiveJoysticks.size(); ++joystick)
{
////////// edit
info.dwSize = sizeof(info);
info.dwFlags = JOY_RETURNALL|JOY_RETURNPOVCTS;
if( !(ActiveJoysticks[joystick].Caps.wCaps & JOYCAPS_HASPOV) )
info.dwFlags &= ~(JOY_RETURNPOV|JOY_RETURNPOVCTS);
//////////
if(JOYERR_NOERROR == joyGetPosEx(ActiveJoysticks[joystick].Index, &info))
{
SEvent event;
const JOYCAPS & caps = ActiveJoysticks[joystick].Caps;
////////// edit
event.EventType = irr::EET_JOYSTICK_INPUT_EVENT;
event.JoystickEvent.Joystick = (u8)joystick;
if(info.dwFlags & JOY_RETURNPOV)
{
event.JoystickEvent.POV = (u16)info.dwPOV;
if(event.JoystickEvent.POV > 35900)
event.JoystickEvent.POV = 65535;
}
else
{
event.JoystickEvent.POV = 65535;
}
//////////
for(int axis = 0; axis < SEvent::SJoystickEvent::NUMBER_OF_AXES; ++axis)
event.JoystickEvent.Axis[axis] = 0;
......
......
......
}
}
#endif // _IRR_COMPILE_WITH_JOYSTICK_EVENTS_
}