C# Class GameStateManagement.InputState

Helper for reading input from keyboard, gamepad, and touch input. This class tracks both the current and previous state of the input devices, and implements query methods for high level input actions such as "move up through the menu" or "pause the game".
Afficher le fichier Open project: GarethIW/LDEngine Class Usage Examples

Méthodes publiques

Свойство Type Description
CurrentKeyboardState Microsoft.Xna.Framework.Input.KeyboardState
CurrentMouseState Microsoft.Xna.Framework.Input.MouseState
LastKeyboardState KeyboardState
LastMouseState MouseState

Méthodes publiques

Méthode Description
InputState ( ) : System.Collections.Generic

Constructs a new input state.

IsMenuCancel ( ) : bool

Checks for a "menu cancel" input action. The controllingPlayer parameter specifies which player to read input for. If this is null, it will accept input from any player. When the action is detected, the output playerIndex reports which player pressed it.

IsMenuDown ( ) : bool

Checks for a "menu down" input action. The controllingPlayer parameter specifies which player to read input for. If this is null, it will accept input from any player.

IsMenuLeft ( ) : bool
IsMenuRight ( ) : bool

Checks for a "menu down" input action. The controllingPlayer parameter specifies which player to read input for. If this is null, it will accept input from any player.

IsMenuSelect ( ) : bool

Checks for a "menu select" input action. The controllingPlayer parameter specifies which player to read input for. If this is null, it will accept input from any player. When the action is detected, the output playerIndex reports which player pressed it.

IsMenuUp ( ) : bool

Checks for a "menu up" input action. The controllingPlayer parameter specifies which player to read input for. If this is null, it will accept input from any player.

IsNewKeyPress ( Keys key ) : bool

Helper for checking if a key was newly pressed during this update. The controllingPlayer parameter specifies which player to read input for. If this is null, it will accept input from any player. When a keypress is detected, the output playerIndex reports which player pressed it.

IsPauseGame ( ) : bool

Checks for a "pause the game" input action. The controllingPlayer parameter specifies which player to read input for. If this is null, it will accept input from any player.

Update ( ) : void

Reads the latest state of the keyboard and gamepad.

Method Details

InputState() public méthode

Constructs a new input state.
public InputState ( ) : System.Collections.Generic
Résultat System.Collections.Generic

IsMenuCancel() public méthode

Checks for a "menu cancel" input action. The controllingPlayer parameter specifies which player to read input for. If this is null, it will accept input from any player. When the action is detected, the output playerIndex reports which player pressed it.
public IsMenuCancel ( ) : bool
Résultat bool

IsMenuDown() public méthode

Checks for a "menu down" input action. The controllingPlayer parameter specifies which player to read input for. If this is null, it will accept input from any player.
public IsMenuDown ( ) : bool
Résultat bool

IsMenuLeft() public méthode

public IsMenuLeft ( ) : bool
Résultat bool

IsMenuRight() public méthode

Checks for a "menu down" input action. The controllingPlayer parameter specifies which player to read input for. If this is null, it will accept input from any player.
public IsMenuRight ( ) : bool
Résultat bool

IsMenuSelect() public méthode

Checks for a "menu select" input action. The controllingPlayer parameter specifies which player to read input for. If this is null, it will accept input from any player. When the action is detected, the output playerIndex reports which player pressed it.
public IsMenuSelect ( ) : bool
Résultat bool

IsMenuUp() public méthode

Checks for a "menu up" input action. The controllingPlayer parameter specifies which player to read input for. If this is null, it will accept input from any player.
public IsMenuUp ( ) : bool
Résultat bool

IsNewKeyPress() public méthode

Helper for checking if a key was newly pressed during this update. The controllingPlayer parameter specifies which player to read input for. If this is null, it will accept input from any player. When a keypress is detected, the output playerIndex reports which player pressed it.
public IsNewKeyPress ( Keys key ) : bool
key Keys
Résultat bool

IsPauseGame() public méthode

Checks for a "pause the game" input action. The controllingPlayer parameter specifies which player to read input for. If this is null, it will accept input from any player.
public IsPauseGame ( ) : bool
Résultat bool

Update() public méthode

Reads the latest state of the keyboard and gamepad.
public Update ( ) : void
Résultat void

Property Details

CurrentKeyboardState public_oe property

public KeyboardState,Microsoft.Xna.Framework.Input CurrentKeyboardState
Résultat Microsoft.Xna.Framework.Input.KeyboardState

CurrentMouseState public_oe property

public MouseState,Microsoft.Xna.Framework.Input CurrentMouseState
Résultat Microsoft.Xna.Framework.Input.MouseState

LastKeyboardState public_oe property

public KeyboardState LastKeyboardState
Résultat KeyboardState

LastMouseState public_oe property

public MouseState LastMouseState
Résultat MouseState