mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-28 15:02:01 +00:00
- Fixed: FOptionMenuItemJoyMap::SetSelection() did not convert from menu selection number to joyaxis number.
SVN r2829 (trunk)
This commit is contained in:
parent
503ae5a9ee
commit
c4c69df6dc
1 changed files with 13 additions and 3 deletions
|
@ -168,7 +168,8 @@ public:
|
||||||
|
|
||||||
int GetSelection()
|
int GetSelection()
|
||||||
{
|
{
|
||||||
float f = (float)(int)SELECTED_JOYSTICK->GetAxisMap(mAxis);
|
double f = SELECTED_JOYSTICK->GetAxisMap(mAxis);
|
||||||
|
// Map from joystick axis to menu selection.
|
||||||
for(unsigned i=0;i<mValues->mValues.Size(); i++)
|
for(unsigned i=0;i<mValues->mValues.Size(); i++)
|
||||||
{
|
{
|
||||||
if (fabs(f - mValues->mValues[i].Value) < FLT_EPSILON)
|
if (fabs(f - mValues->mValues[i].Value) < FLT_EPSILON)
|
||||||
|
@ -179,9 +180,18 @@ public:
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetSelection(int Selection)
|
void SetSelection(int selection)
|
||||||
{
|
{
|
||||||
SELECTED_JOYSTICK->SetAxisMap(mAxis, (EJoyAxis)Selection);
|
// Map from menu selection to joystick axis.
|
||||||
|
if ((unsigned)selection >= mValues->mValues.Size())
|
||||||
|
{
|
||||||
|
selection = JOYAXIS_None;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
selection = (int)mValues->mValues[selection].Value;
|
||||||
|
}
|
||||||
|
SELECTED_JOYSTICK->SetAxisMap(mAxis, (EJoyAxis)selection);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue