[Input] Fixed SetButton index check

This commit is contained in:
Stefanos A. 2014-01-31 16:40:57 +01:00
parent 4fceca2f80
commit 2dee96d918

View file

@ -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);
} }
} }