mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-01-11 01:15:26 +00:00
Removed unnecessary IsButtonValid method
This commit is contained in:
parent
1adc3f7733
commit
0875cbd928
|
@ -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 =
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue