C# Класс 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".
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
CurrentKeyboardState Microsoft.Xna.Framework.Input.KeyboardState
CurrentMouseState Microsoft.Xna.Framework.Input.MouseState
LastKeyboardState KeyboardState
LastMouseState MouseState

Открытые методы

Метод Описание
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.

Описание методов

InputState() публичный Метод

Constructs a new input state.
public InputState ( ) : System.Collections.Generic
Результат System.Collections.Generic

IsMenuCancel() публичный Метод

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
Результат bool

IsMenuDown() публичный Метод

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
Результат bool

IsMenuLeft() публичный Метод

public IsMenuLeft ( ) : bool
Результат bool

IsMenuRight() публичный Метод

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
Результат bool

IsMenuSelect() публичный Метод

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
Результат bool

IsMenuUp() публичный Метод

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
Результат bool

IsNewKeyPress() публичный Метод

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
Результат bool

IsPauseGame() публичный Метод

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
Результат bool

Update() публичный Метод

Reads the latest state of the keyboard and gamepad.
public Update ( ) : void
Результат void

Описание свойств

CurrentKeyboardState публичное свойство

public KeyboardState,Microsoft.Xna.Framework.Input CurrentKeyboardState
Результат Microsoft.Xna.Framework.Input.KeyboardState

CurrentMouseState публичное свойство

public MouseState,Microsoft.Xna.Framework.Input CurrentMouseState
Результат Microsoft.Xna.Framework.Input.MouseState

LastKeyboardState публичное свойство

public KeyboardState LastKeyboardState
Результат KeyboardState

LastMouseState публичное свойство

public MouseState LastMouseState
Результат MouseState