#region License
#endregion
#region Using Statements
using
System;
#endregion
namespace
Microsoft.Xna.Framework.Input
{
public
static
class
GamePad
{
#region Internal Static Variables
internal
static
readonly
int
GAMEPAD_COUNT = DetermineNumGamepads();
private
static
int
DetermineNumGamepads()
{
string
numGamepadString = Environment.GetEnvironmentVariable(
"FNA_GAMEPAD_NUM_GAMEPADS"
);
if
(!String.IsNullOrEmpty(numGamepadString))
{
int
numGamepads;
if
(
int
.TryParse(numGamepadString,
out
numGamepads))
{
if
(numGamepads >= 0)
{
return
numGamepads;
}
}
}
return
Enum.GetNames(
typeof
(PlayerIndex)).Length;
}
#endregion
#region Public GamePad API
public
static
GamePadCapabilities GetCapabilities(PlayerIndex playerIndex)
{
return
FNAPlatform.GetGamePadCapabilities((
int
) playerIndex);
}
public
static
GamePadState GetState(PlayerIndex playerIndex)
{
return
FNAPlatform.GetGamePadState(
(
int
) playerIndex,
GamePadDeadZone.IndependentAxes
);
}
public
static
GamePadState GetState(PlayerIndex playerIndex, GamePadDeadZone deadZoneMode)
{
return
FNAPlatform.GetGamePadState(
(
int
) playerIndex,
deadZoneMode
);
}
public
static
bool
SetVibration(PlayerIndex playerIndex,
float
leftMotor,
float
rightMotor)
{
return
FNAPlatform.SetGamePadVibration(
(
int
) playerIndex,
leftMotor,
rightMotor
);
}
#endregion
#region Public GamePad API, FNA Extensions
public
static
string
GetGUIDEXT(PlayerIndex playerIndex)
{
return
FNAPlatform.GetGamePadGUID((
int
) playerIndex);
}
public
static
void
SetLightBarEXT(PlayerIndex playerIndex, Color color)
{
FNAPlatform.SetGamePadLightBar((
int
) playerIndex, color);
}
#endregion
}
}