multiple fixes to wxJoystick under Unix and new index-based API for accessing joystick buttons and axes (patch 1678497)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44843 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -86,6 +86,26 @@ wxPoint wxJoystick::GetPosition() const
|
||||
return wxPoint(0,0);
|
||||
}
|
||||
|
||||
int wxJoystick::GetPosition(unsigned axis) const
|
||||
{
|
||||
switch (axis) {
|
||||
case 0:
|
||||
return GetPosition().x;
|
||||
case 1:
|
||||
return GetPosition().y;
|
||||
case 2:
|
||||
return GetZPosition();
|
||||
case 3:
|
||||
return GetRudderPosition();
|
||||
case 4:
|
||||
return GetUPosition();
|
||||
case 5:
|
||||
return GetVPosition();
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int wxJoystick::GetZPosition() const
|
||||
{
|
||||
JOYINFO joyInfo;
|
||||
@@ -127,6 +147,14 @@ int wxJoystick::GetButtonState() const
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool wxJoystick::GetButtonState(unsigned id) const
|
||||
{
|
||||
if (id > sizeof(int) * 8)
|
||||
return false;
|
||||
|
||||
return (GetButtonState() & (1 << id)) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
JLI 2002-08-20:
|
||||
Returns -1 to signify error.
|
||||
|
Reference in New Issue
Block a user