Share via


Keyboard.GetState Method (PlayerIndex)

Returns the current Chatpad state for the specified player.

Syntax

'Declaration
Public Shared Function GetState ( _
         playerIndex As PlayerIndex _
) As KeyboardState 
public static KeyboardState GetState (
         PlayerIndex playerIndex
)
public:
static KeyboardState GetState(
         PlayerIndex playerIndex
)

Parameters

  • playerIndex
    Type: PlayerIndex
    Player index of the Chatpad to query.

Return Value

Type: KeyboardState
Current Chatpad state.

Exceptions

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

Remarks

Each player can have his or her own Chatpad, which is queried as a keyboard. To query an attached USB keyboard instead, use the GetState method that does not require a player index.

This method works on Xbox 360 platforms only. Windows does not include driver support for the ChatPad.

This method is included in the assemblies for Windows, but it is effectively a null function on that platform. Calls to Keyboard.GetState(playerIndex) from a Windows application are accepted, but will never return a ChatPad state change (key press or release).

Requirements

Namespace: Microsoft.Xna.Framework.Input

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

See Also

Tasks

Detecting a Key Press

Concepts

Overview of User Input and Input Devices

Reference

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

Platforms

Xbox 360, Windows Phone