mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-01-25 16:51:01 +00:00
[Input] Fixed SetButton index check
This commit is contained in:
parent
4fceca2f80
commit
2dee96d918
|
@ -224,17 +224,17 @@ namespace OpenTK.Input
|
||||||
|
|
||||||
internal void SetButton(JoystickButton button, bool value)
|
internal void SetButton(JoystickButton button, bool value)
|
||||||
{
|
{
|
||||||
int index = 1 << (int)button;
|
int index = (int)button;
|
||||||
if (index < 0 || index >= MaxButtons)
|
if (index < 0 || index >= MaxButtons)
|
||||||
throw new ArgumentOutOfRangeException("button");
|
throw new ArgumentOutOfRangeException("button");
|
||||||
|
|
||||||
if (value)
|
if (value)
|
||||||
{
|
{
|
||||||
buttons |= index;
|
buttons |= 1 << index;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
buttons &= ~index;
|
buttons &= ~(1 << index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue