Sdílet prostřednictvím


Keyboard.GetState Method (PlayerIndex)

Returns the current Chatpad state for the specified player.

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

Syntax

public static KeyboardState GetState (
         PlayerIndex playerIndex
)

Parameters

  • playerIndex
    Player index of the Chatpad to query.

Return Value

Current Chatpad state.

Exceptions

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

Remarks

Each player can have their 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).

See Also

Tasks

How To: Detect Whether a Key Is Pressed

Concepts

Input Overview

Reference

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

Platforms

Xbox 360, Windows XP SP2, Windows Vista, Zune