class KeyboardStateExtensions : System.Object

Extensions for the XNA T:Microsoft.Xna.Framework.Input.KeyboardState class.

This provides state-aware functions for detecting changes in the keyboard state, without having to track the previous state in each object that wants to know about key presses.

public System.Nullable<KeyState> IsKeyChanged(KeyboardState state, System.Object obj, Keys key)

Detects whether the specified key has changed state.

  • state (Microsoft.Xna.Framework.Input.KeyboardState) – The keyboard state to check.
  • obj (System.Object) – The object for the unique check to be done against.
  • key (Microsoft.Xna.Framework.Input.Keys) – The key to check.

The state change of the key, or null if there’s no change.

public bool IsKeyPressed(KeyboardState state, System.Object obj, Keys key)
  • state (Microsoft.Xna.Framework.Input.KeyboardState) –
  • obj (System.Object) –
  • key (Microsoft.Xna.Framework.Input.Keys) –
public bool TryConvertKeyboardInput(KeyboardState keyboard, KeyboardState oldKeyboard, ref char key, ref Keys special)
  • keyboard (Microsoft.Xna.Framework.Input.KeyboardState) –
  • oldKeyboard (Microsoft.Xna.Framework.Input.KeyboardState) –
  • (ref) key (char) –
  • (ref) special (Microsoft.Xna.Framework.Input.Keys) –