2012-08-09 09:45:04 +00:00
|
|
|
#region Using Statements
|
2011-10-31 05:36:24 +00:00
|
|
|
using System;
|
|
|
|
using System.IO;
|
|
|
|
using ANX.Framework.NonXNA;
|
|
|
|
|
|
|
|
#endregion // Using Statements
|
|
|
|
|
2012-08-09 09:45:04 +00:00
|
|
|
// This file is part of the ANX.Framework created by the
|
|
|
|
// "ANX.Framework developer group" and released under the Ms-PL license.
|
|
|
|
// For details see: http://anxframework.codeplex.com/license
|
2011-10-31 05:36:24 +00:00
|
|
|
|
|
|
|
namespace ANX.Framework.Input
|
|
|
|
{
|
|
|
|
public static class GamePad
|
|
|
|
{
|
|
|
|
private static IGamePad gamePad;
|
|
|
|
|
|
|
|
static GamePad()
|
|
|
|
{
|
2011-11-11 15:21:41 +00:00
|
|
|
gamePad = AddInSystemFactory.Instance.GetDefaultCreator<IInputSystemCreator>().GamePad;
|
2011-10-31 05:36:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public static GamePadCapabilities GetCapabilities(PlayerIndex playerIndex)
|
|
|
|
{
|
|
|
|
return gamePad.GetCapabilities(playerIndex);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static GamePadState GetState(PlayerIndex playerIndex)
|
|
|
|
{
|
2011-11-20 11:37:51 +00:00
|
|
|
bool isConnected;
|
|
|
|
int packetNumber;
|
|
|
|
GamePadState ret = gamePad.GetState(playerIndex,out isConnected, out packetNumber);
|
|
|
|
ret.IsConnected = isConnected;
|
|
|
|
ret.PacketNumber = packetNumber;
|
|
|
|
return ret;
|
2011-10-31 05:36:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public static GamePadState GetState (PlayerIndex playerIndex,GamePadDeadZone deadZoneMode)
|
|
|
|
{
|
2011-11-20 11:37:51 +00:00
|
|
|
bool isConnected;
|
|
|
|
int packetNumber;
|
|
|
|
GamePadState ret = gamePad.GetState(playerIndex,deadZoneMode, out isConnected, out packetNumber);
|
|
|
|
ret.IsConnected = isConnected;
|
|
|
|
ret.PacketNumber = packetNumber;
|
|
|
|
return ret;
|
2011-10-31 05:36:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public static bool SetVibration(PlayerIndex playerIndex, float leftMotor, float rightMotor)
|
|
|
|
{
|
|
|
|
return gamePad.SetVibration(playerIndex, leftMotor, rightMotor);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|