KeyboardState

struct KeyboardState : System.ValueType

Holds the state of keystrokes by a keyboard.

readonly bool CapsLock

Gets the current state of the Caps Lock key.

readonly bool NumLock

Gets the current state of the Num Lock key.

readonly KeyState Item
void InternalSetKey(Keys key)
Parameters:
  • key (Microsoft.Xna.Framework.Input.Keys) –
void InternalClearKey(Keys key)
Parameters:
  • key (Microsoft.Xna.Framework.Input.Keys) –
void InternalClearAllKeys()
bool IsKeyDown(Keys key)

Gets whether given key is currently being pressed.

Parameters:
  • key (Microsoft.Xna.Framework.Input.Keys) – The key to query.
Returns:

true if the key is pressed; false otherwise.

bool IsKeyUp(Keys key)

Gets whether given key is currently being not pressed.

Parameters:
  • key (Microsoft.Xna.Framework.Input.Keys) – The key to query.
Returns:

true if the key is not pressed; false otherwise.

Microsoft.Xna.Framework.Input.Keys[] GetPressedKeys()

Returns an array of values holding keys that are currently being pressed.

Returns:The keys that are currently being pressed.
int GetHashCode()

Gets the hash code for T:Microsoft.Xna.Framework.Input.KeyboardState instance.

Returns:Hash code of the object.
bool op_Equality(KeyboardState a, KeyboardState b)

Compares whether two T:Microsoft.Xna.Framework.Input.KeyboardState instances are equal.

Parameters:
  • a (Microsoft.Xna.Framework.Input.KeyboardState) – T:Microsoft.Xna.Framework.Input.KeyboardState instance to the left of the equality operator.
  • b (Microsoft.Xna.Framework.Input.KeyboardState) – T:Microsoft.Xna.Framework.Input.KeyboardState instance to the right of the equality operator.
Returns:

true if the instances are equal; false otherwise.

bool op_Inequality(KeyboardState a, KeyboardState b)

Compares whether two T:Microsoft.Xna.Framework.Input.KeyboardState instances are not equal.

Parameters:
  • a (Microsoft.Xna.Framework.Input.KeyboardState) – T:Microsoft.Xna.Framework.Input.KeyboardState instance to the left of the inequality operator.
  • b (Microsoft.Xna.Framework.Input.KeyboardState) – T:Microsoft.Xna.Framework.Input.KeyboardState instance to the right of the inequality operator.
Returns:

true if the instances are different; false otherwise.

bool Equals(System.Object obj)

Compares whether current instance is equal to specified object.

Parameters:
  • obj (System.Object) – The T:Microsoft.Xna.Framework.Input.KeyboardState to compare.
Returns:

true if the provided T:Microsoft.Xna.Framework.Input.KeyboardState instance is same with current; false otherwise.