public static Microsoft.Xna.Framework.Input.GamePadState GetState(PlayerIndex playerIndex, Microsoft.Xna.Framework.Input.GamePadDeadZone deadZoneMode) { var controller = GetController(playerIndex); if (!controller.IsConnected) { return(new GamePadState()); // GamePadState.IsConnected = false by default } var gamepad = controller.GetState().Gamepad; Microsoft.Xna.Framework.Input.GamePadThumbSticks thumbSticks = new Microsoft.Xna.Framework.Input.GamePadThumbSticks( leftPosition: ConvertThumbStick(gamepad.LeftThumbX, gamepad.LeftThumbY, SharpDX.XInput.Gamepad.LeftThumbDeadZone, deadZoneMode), rightPosition: ConvertThumbStick(gamepad.RightThumbX, gamepad.RightThumbY, SharpDX.XInput.Gamepad.RightThumbDeadZone, deadZoneMode)); Microsoft.Xna.Framework.Input.GamePadTriggers triggers = new Microsoft.Xna.Framework.Input.GamePadTriggers( leftTrigger: gamepad.LeftTrigger / (float)byte.MaxValue, rightTrigger: gamepad.RightTrigger / (float)byte.MaxValue); Microsoft.Xna.Framework.Input.GamePadState state = new Microsoft.Xna.Framework.Input.GamePadState( thumbSticks: thumbSticks, triggers: triggers, buttons: ConvertToButtons( buttonFlags: gamepad.Buttons, leftThumbX: gamepad.LeftThumbX, leftThumbY: gamepad.LeftThumbY, rightThumbX: gamepad.RightThumbX, rightThumbY: gamepad.RightThumbY, leftTrigger: gamepad.LeftTrigger, rightTrigger: gamepad.RightTrigger), dPad: ConvertToGamePadDPad(gamepad.Buttons)); return(state); }
public static Microsoft.Xna.Framework.Input.GamePadState GetState(PlayerIndex playerIndex, Microsoft.Xna.Framework.Input.GamePadDeadZone deadZoneMode) { var controller = GetController(playerIndex); if (!controller.IsConnected) return new GamePadState(); // GamePadState.IsConnected = false by default var gamepad = controller.GetState().Gamepad; Microsoft.Xna.Framework.Input.GamePadThumbSticks thumbSticks = new Microsoft.Xna.Framework.Input.GamePadThumbSticks( leftPosition: ConvertThumbStick(gamepad.LeftThumbX, gamepad.LeftThumbY, SharpDX.XInput.Gamepad.LeftThumbDeadZone, deadZoneMode), rightPosition: ConvertThumbStick(gamepad.RightThumbX, gamepad.RightThumbY, SharpDX.XInput.Gamepad.RightThumbDeadZone, deadZoneMode)); Microsoft.Xna.Framework.Input.GamePadTriggers triggers = new Microsoft.Xna.Framework.Input.GamePadTriggers( leftTrigger: gamepad.LeftTrigger / (float)byte.MaxValue, rightTrigger: gamepad.RightTrigger / (float)byte.MaxValue); Microsoft.Xna.Framework.Input.GamePadState state = new Microsoft.Xna.Framework.Input.GamePadState( thumbSticks: thumbSticks, triggers: triggers, buttons: ConvertToButtons( buttonFlags: gamepad.Buttons, leftThumbX: gamepad.LeftThumbX, leftThumbY: gamepad.LeftThumbY, rightThumbX: gamepad.RightThumbX, rightThumbY: gamepad.RightThumbY, leftTrigger: gamepad.LeftTrigger, rightTrigger: gamepad.RightTrigger), dPad: ConvertToGamePadDPad(gamepad.Buttons)); return state; }
internal XboxGamepadThumbSticks(Microsoft.Xna.Framework.Input.GamePadThumbSticks xnaThumbSticks) { Left = new Vector2(xnaThumbSticks.Left); Right = new Vector2(xnaThumbSticks.Right); }
public GamePadState(Microsoft.Xna.Framework.Input.GamePadThumbSticks thumbSticks, Microsoft.Xna.Framework.Input.GamePadTriggers triggers, Microsoft.Xna.Framework.Input.GamePadButtons buttons, Microsoft.Xna.Framework.Input.GamePadDPad dPad) { throw new System.NotImplementedException(); }