mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-01-11 00:05:37 +00:00
[OpenTK] Protect against invalid axis/button ids
This commit is contained in:
parent
e6a9adf494
commit
44e2576c86
|
@ -129,14 +129,19 @@ namespace OpenTK.Input
|
|||
}
|
||||
|
||||
internal void SetAxis(JoystickAxis axis, float @value)
|
||||
{
|
||||
if ((int)axis < axis_collection.Count)
|
||||
{
|
||||
move_args.Axis = axis;
|
||||
move_args.Delta = move_args.Value - @value;
|
||||
axis_collection[axis] = move_args.Value = @value;
|
||||
Move(this, move_args);
|
||||
}
|
||||
}
|
||||
|
||||
internal void SetButton(JoystickButton button, bool @value)
|
||||
{
|
||||
if ((int)button < button_collection.Count)
|
||||
{
|
||||
if (button_collection[button] != @value)
|
||||
{
|
||||
|
@ -148,6 +153,7 @@ namespace OpenTK.Input
|
|||
ButtonUp(this, button_args);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue