[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)
{
int index = 1 << (int)button;
int index = (int)button;
if (index < 0 || index >= MaxButtons)
throw new ArgumentOutOfRangeException("button");
if (value)
{
buttons |= index;
buttons |= 1 << index;
}
else
{
buttons &= ~index;
buttons &= ~(1 << index);
}
}