From c2bf436db3e87c32b31d393e07ba119d61ed0c83 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Thu, 23 Jan 2014 00:17:04 +0000 Subject: [PATCH] Add missing joystick methods git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_3_0_BRANCH@75674 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/osx/core/hidjoystick.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/osx/core/hidjoystick.cpp b/src/osx/core/hidjoystick.cpp index 4a8273838e..fdb244393e 100644 --- a/src/osx/core/hidjoystick.cpp +++ b/src/osx/core/hidjoystick.cpp @@ -187,6 +187,14 @@ wxPoint wxJoystick::GetPosition() const if (m_thread) pos = m_thread->m_lastposition; return pos; } +int wxJoystick::GetPosition(unsigned int axis) const +{ + wxCHECK_MSG(axis >=0 && axis < GetNumberAxes(), 0, "Invalid joystick axis"); + if (m_thread) + return m_thread->m_axe[axis]; + return 0; + +} int wxJoystick::GetZPosition() const { if (m_thread) @@ -225,6 +233,14 @@ int wxJoystick::GetButtonState() const return 0; } +bool wxJoystick::GetButtonState(unsigned int id) const +{ + if (id > sizeof(int) * 8) + return false; + + return (GetButtonState() & (1 << id)) != 0; +} + //--------------------------------------------------------------------------- // wxJoystick::IsOk //