Sdílet prostřednictvím


Keyboard.GetState Method ()

Returns the current keyboard state.

Namespace: Microsoft.Xna.Framework.Input
Assembly: Microsoft.Xna.Framework (in microsoft.xna.framework.dll)

Syntax

public static KeyboardState GetState ()

Return Value

Current keyboard state.

Exceptions

Exception type Condition
InvalidOperationException An invalid operation occurred when querying the keyboard state.

Remarks

This method queries an attached USB keyboard. To query a Chatpad instead, use Keyboard.GetState (PlayerIndex).

See Also

Tasks

Detecting a Key Press (Windows, Windows Phone, Xbox 360)

Concepts

Overview of User Input and Input Devices

Reference

Keyboard Class
Keyboard Members
Microsoft.Xna.Framework.Input Namespace
Keyboard.GetState Method

Platforms

Xbox 360, Windows 7, Windows Vista, Windows XP, Windows Phone