C# Class SGDE.Input.GamePad

A gamepad input device.
Inheritance: InputComponent
Show file Open project: sgdc/sgdc-old

Public Methods

Method Description
GetCurrentState ( ) : GamePadState

Get the current GamePad input state.

GetGamePadCapability ( ) : Microsoft.Xna.Framework.Input.GamePadCapabilities

Get what the GamePad is capable of.

GetPastState ( ) : GamePadState

Get the past GamePad input state.

GetPastThumbstickPosition ( GamePadComponent com ) : Vector2

Get the past position of the thumbstick control as a 2D vector.

GetPastTrigger ( GamePadComponent com ) : float

Get the past trigger position.

GetThumbstickPosition ( GamePadComponent com ) : Vector2

Get the position of the thumbstick control as a 2D vector.

GetThumbstickPositionDifference ( GamePadComponent com ) : Vector2

Get the difference of the thumbstick between the current and previous state.

GetTrigger ( GamePadComponent com ) : float

Get the trigger position.

GetTriggerDifference ( GamePadComponent com ) : float

Get the difference of the trigger between the current and previous state.

IsButtonClicked ( GamePadComponent com ) : bool

Determine if the specified button is clicked. This means that the button is down right now but wasn't always pressed down.

IsButtonPressed ( GamePadComponent com ) : bool

Determine if the specified button is pressed.

SetVibration ( float motor, bool leftMotor ) : bool

Set the game pad's vibration.

SetVibration ( float leftMotor, float rightMotor ) : bool

Set the game pad's vibration.

Private Methods

Method Description
Component2Button ( GamePadComponent com ) : Buttons
GamePad ( InputManager manager ) : System
GetThumbStick ( int index, bool cur ) : GamePadThumbSticks
GetTriggers ( int index, bool cur ) : GamePadTriggers

Method Details

GetCurrentState() public method

Get the current GamePad input state.
public GetCurrentState ( ) : GamePadState
return Microsoft.Xna.Framework.Input.GamePadState

GetGamePadCapability() public method

Get what the GamePad is capable of.
public GetGamePadCapability ( ) : Microsoft.Xna.Framework.Input.GamePadCapabilities
return Microsoft.Xna.Framework.Input.GamePadCapabilities

GetPastState() public method

Get the past GamePad input state.
public GetPastState ( ) : GamePadState
return Microsoft.Xna.Framework.Input.GamePadState

GetPastThumbstickPosition() public method

Get the past position of the thumbstick control as a 2D vector.
public GetPastThumbstickPosition ( GamePadComponent com ) : Vector2
com GamePadComponent Which thumbstick to get, only support LeftStick, and RightStick.
return Vector2

GetPastTrigger() public method

Get the past trigger position.
public GetPastTrigger ( GamePadComponent com ) : float
com GamePadComponent Which trigger to get, only support LeftTrigger, and RightTrigger.
return float

GetThumbstickPosition() public method

Get the position of the thumbstick control as a 2D vector.
public GetThumbstickPosition ( GamePadComponent com ) : Vector2
com GamePadComponent Which thumbstick to get, only support LeftStick, and RightStick.
return Vector2

GetThumbstickPositionDifference() public method

Get the difference of the thumbstick between the current and previous state.
public GetThumbstickPositionDifference ( GamePadComponent com ) : Vector2
com GamePadComponent Which thumbstick to get, only support LeftStick, and RightStick.
return Vector2

GetTrigger() public method

Get the trigger position.
public GetTrigger ( GamePadComponent com ) : float
com GamePadComponent Which trigger to get, only support LeftTrigger, and RightTrigger.
return float

GetTriggerDifference() public method

Get the difference of the trigger between the current and previous state.
public GetTriggerDifference ( GamePadComponent com ) : float
com GamePadComponent Which trigger to get, only support LeftTrigger, and RightTrigger.
return float

IsButtonClicked() public method

Determine if the specified button is clicked. This means that the button is down right now but wasn't always pressed down.
public IsButtonClicked ( GamePadComponent com ) : bool
com GamePadComponent The button to check if pressed. Supports A, B, X, Y, Back, Start, BigButton, LeftShoulder, LeftStick, RightShoulder, RightStick, and the D-Pad.
return bool

IsButtonPressed() public method

Determine if the specified button is pressed.
public IsButtonPressed ( GamePadComponent com ) : bool
com GamePadComponent The button to check if pressed. Supports A, B, X, Y, Back, Start, BigButton, LeftShoulder, LeftStick, RightShoulder, RightStick, and the D-Pad.
return bool

SetVibration() public method

Set the game pad's vibration.
public SetVibration ( float motor, bool leftMotor ) : bool
motor float The speed of the motor, between 0.0 and 1.0.
leftMotor bool true if the vibration should be set on the left, low-frequency, motor. false if the vibration should be set on the right, high-frequency, motor.
return bool

SetVibration() public method

Set the game pad's vibration.
public SetVibration ( float leftMotor, float rightMotor ) : bool
leftMotor float The speed of the left motor, between 0.0 and 1.0. This motor is a low-frequency motor.
rightMotor float The speed of the right motor, between 0.0 and 1.0. This motor is a high-frequency motor.
return bool