Commit cefc1978 authored by Rogerborg's avatar Rogerborg

Best-effort attempt at implementing the new optional joystick activation on...

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
parent dc2b2ceb
...@@ -61,6 +61,9 @@ namespace irr ...@@ -61,6 +61,9 @@ namespace irr
//! Sets if the window should be resizeable in windowed mode. //! Sets if the window should be resizeable in windowed mode.
virtual void setResizeAble(bool resize); 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 //! \return Returns a pointer to a list with all video modes
//! supported by the gfx adapter. //! supported by the gfx adapter.
virtual video::IVideoModeList* getVideoModeList(); virtual video::IVideoModeList* getVideoModeList();
...@@ -205,7 +208,6 @@ namespace irr ...@@ -205,7 +208,6 @@ namespace irr
int _screenHeight; int _screenHeight;
bool _active; bool _active;
void initialiseJoysticks();
void pollJoysticks(); void pollJoysticks();
}; };
......
...@@ -971,10 +971,12 @@ static void joystickRemovalCallback(void * target, ...@@ -971,10 +971,12 @@ static void joystickRemovalCallback(void * target,
} }
#endif // _IRR_COMPILE_WITH_JOYSTICK_EVENTS_ #endif // _IRR_COMPILE_WITH_JOYSTICK_EVENTS_
void CIrrDeviceMacOSX::initialiseJoysticks()
bool CIrrDeviceMacOSX::activateJoysticks(core::array<SJoystickInfo> & joystickInfo)
{ {
#if defined (_IRR_COMPILE_WITH_JOYSTICK_EVENTS_) #if defined (_IRR_COMPILE_WITH_JOYSTICK_EVENTS_)
ActiveJoysticks.clear(); ActiveJoysticks.clear();
joystickInfo.clear();
io_object_t hidObject = 0; io_object_t hidObject = 0;
io_iterator_t hidIterator = 0; io_iterator_t hidIterator = 0;
...@@ -1066,14 +1068,25 @@ void CIrrDeviceMacOSX::initialiseJoysticks() ...@@ -1066,14 +1068,25 @@ void CIrrDeviceMacOSX::initialiseJoysticks()
info.persistentData.JoystickEvent.Axis[i] = 0; info.persistentData.JoystickEvent.Axis[i] = 0;
ActiveJoysticks.push_back(info); 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 } else
continue; continue;
} }
result = IOObjectRelease (hidIterator); result = IOObjectRelease (hidIterator);
return true;
#endif // _IRR_COMPILE_WITH_JOYSTICK_EVENTS_ #endif // _IRR_COMPILE_WITH_JOYSTICK_EVENTS_
return false;
} }
void CIrrDeviceMacOSX::pollJoysticks() void CIrrDeviceMacOSX::pollJoysticks()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment