Best-effort attempt at implementing the new optional joystick activation on MacOSX. I'm not able to compile or test it.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@1718 dfc29bdd-3216-0410-991c-e03cc46cb475
master
Rogerborg 2008-11-11 01:49:57 +00:00
parent dc2b2cebac
commit cefc1978ae
2 changed files with 18 additions and 3 deletions

View File

@ -61,6 +61,9 @@ namespace irr
//! Sets if the window should be resizeable in windowed mode.
virtual void setResizeAble(bool resize);
//! Activate any joysticks, and generate events for them.
virtual bool activateJoysticks(core::array<SJoystickInfo> & joystickInfo);
//! \return Returns a pointer to a list with all video modes
//! supported by the gfx adapter.
virtual video::IVideoModeList* getVideoModeList();
@ -205,7 +208,6 @@ namespace irr
int _screenHeight;
bool _active;
void initialiseJoysticks();
void pollJoysticks();
};

View File

@ -971,10 +971,12 @@ static void joystickRemovalCallback(void * target,
}
#endif // _IRR_COMPILE_WITH_JOYSTICK_EVENTS_
void CIrrDeviceMacOSX::initialiseJoysticks()
bool CIrrDeviceMacOSX::activateJoysticks(core::array<SJoystickInfo> & joystickInfo)
{
#if defined (_IRR_COMPILE_WITH_JOYSTICK_EVENTS_)
ActiveJoysticks.clear();
joystickInfo.clear();
io_object_t hidObject = 0;
io_iterator_t hidIterator = 0;
@ -1066,14 +1068,25 @@ void CIrrDeviceMacOSX::initialiseJoysticks()
info.persistentData.JoystickEvent.Axis[i] = 0;
ActiveJoysticks.push_back(info);
}
SJoystickInfo returnInfo;
returnInfo.Axes = info.axes;
returnInfo.Hats = info.hats;
returnInfo.Buttons = info.Buttons;
returnInfo.Name = info.joystickName;
returnInfo.PovHat = SJoystickInfo::POV_HAT_UNKNOWN;
joystickInfo.push_back(returnInfo);
} else
continue;
}
result = IOObjectRelease (hidIterator);
return true;
#endif // _IRR_COMPILE_WITH_JOYSTICK_EVENTS_
return false;
}
void CIrrDeviceMacOSX::pollJoysticks()