public static GamePadState GetState(GamePadIndex gamepad_index) { return(Platform.GetGamePadState( (int)gamepad_index, GamePadDeadZone.IndependentAxes )); }
public static GamePadState GetState(GamePadIndex gamepad_index, GamePadDeadZone deadZoneMode) { return(Platform.GetGamePadState( (int)gamepad_index, deadZoneMode )); }
public static bool SetVibration(GamePadIndex gamepad_index, float leftMotor, float rightMotor) { return(Platform.SetGamePadVibration( (int)gamepad_index, leftMotor, rightMotor )); }
/// <summary> /// Constructor. /// </summary> /// <param name="gamePadIndex"></param> /// <param name="deadZone"></param> public GamePad(GamePadIndex gamePadIndex, GamePadDeadZone deadZone) { this.Index = gamePadIndex; this.deadZone = deadZone; this.controller = new XInput.Controller(ConvertGamePadIndexToUserIndex(this.Index)); this.state = new XInput.Gamepad(); }
public static bool GamePadStateChanged(GamePadIndex index, Buttons button) { if (index == GamePadIndex.Any) { return(gamePads != oldGamePads); } return(gamePads[(int)index] != oldGamePads[(int)index]); }
public static bool IsButtonUp(GamePadIndex index, Buttons button) { if (index == GamePadIndex.Any) { for (int i = 0; i < 4; i++) { if (oldGamePads[i].IsButtonUp(button)) { return(true); } } return(false); } return(oldGamePads[(int)index].IsButtonUp(button)); }
public static bool IsButtonHeld(GamePadIndex index, Buttons button) { if (index == GamePadIndex.Any) { for (int i = 0; i < 4; i++) { if (gamePads[i].IsButtonDown(button) && gamePads[i].IsButtonDown(button)) { return(true); } } return(false); } return(gamePads[(int)index].IsButtonDown(button) && gamePads[(int)index].IsButtonDown(button)); }
public static void SetLightBar(GamePadIndex gamepad_index, Color color) { Platform.SetGamePadLightBar((int)gamepad_index, color); }
public static string GetGuid(GamePadIndex gamepad_index) { return(Platform.GetGamePadGUID((int)gamepad_index)); }
public static GamePadCapabilities GetCapabilities(GamePadIndex gamepad_index) { return(Platform.GetGamePadCapabilities((int)gamepad_index)); }
/// <summary> /// Converts a PlayerIndex to a XInput.UserIndex. /// </summary> /// <param name="playerIndex"></param> /// <returns></returns> private static XInput.UserIndex ConvertGamePadIndexToUserIndex(GamePadIndex playerIndex) { switch (playerIndex) { case GamePadIndex.One: return XInput.UserIndex.One; case GamePadIndex.Two: return XInput.UserIndex.Two; case GamePadIndex.Three: return XInput.UserIndex.Three; case GamePadIndex.Four: return XInput.UserIndex.Four; } throw new ArgumentOutOfRangeException("PlayerIndex must be between 1 and 4."); }
/// <summary> /// Constructor. /// </summary> /// <param name="gamePadIndex"></param> public GamePad(GamePadIndex gamePadIndex) : this(gamePadIndex, GamePadDeadZone.Default) { }
public static bool GamePadReleased(GamePadButtons button, GamePadIndex player_index = 0) { return(!gp_current_state[(int)player_index][button] && gp_prev_state[(int)player_index][button]); }
public static bool GamePadDown(GamePadButtons button, GamePadIndex player_index = 0) { return(gp_current_state[(int)player_index][button]); }
public static GamePadState GetGamePadState(GamePadIndex player_index = 0) { return(gp_current_state[(int)player_index]); }
/// <summary> /// Constructor. /// </summary> /// <param name="gamePadIndex"></param> public GamePad(GamePadIndex gamePadIndex) : this(gamePadIndex, GamePadDeadZone.Standard) { }