Permalink
Browse files

[Input] Fixed SetButton index check

  • Loading branch information...
1 parent 4fceca2 commit 2dee96d91845bf14ce6309d6fffd995342f44489 @thefiddler thefiddler committed Jan 31, 2014
Showing with 3 additions and 3 deletions.
  1. +3 −3 Source/OpenTK/Input/JoystickState.cs
View
6 Source/OpenTK/Input/JoystickState.cs
@@ -224,17 +224,17 @@ internal void SetAxis(JoystickAxis axis, short value)
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);
}
}

0 comments on commit 2dee96d

Please sign in to comment.