Removed unnecessary IsButtonValid method

This commit is contained in:
Stefanos A 2013-12-23 01:50:13 +01:00 committed by thefiddler
parent 1adc3f7733
commit 0875cbd928
2 changed files with 3 additions and 20 deletions

View file

@ -35,7 +35,6 @@ namespace OpenTK.Input
public class GamePad
{
internal const int MaxAxisCount = 10;
internal const int MaxButtonCount = 16; // if this grows over 32 then GamePadState.buttons must be modified
internal const int MaxDPadCount = 2;
static readonly IGamePadDriver driver =

View file

@ -129,23 +129,13 @@ namespace OpenTK.Input
internal void SetButton(Buttons button, bool pressed)
{
if (IsButtonValid(button))
if (pressed)
{
int index = (int)button;
Buttons mask = (Buttons)(1 << index);
if (pressed)
{
buttons |= mask;
}
else
{
buttons &= ~mask;
}
buttons |= button;
}
else
{
throw new ArgumentOutOfRangeException("button");
buttons &= ~button;
}
}
@ -164,12 +154,6 @@ namespace OpenTK.Input
return index >= 0 && index < GamePad.MaxAxisCount;
}
bool IsButtonValid(Buttons button)
{
int index = (int)button;
return index >= 0 && index < GamePad.MaxButtonCount;
}
bool IsDPadValid(int index)
{
return index >= 0 && index < GamePad.MaxDPadCount;