Skip to main content
Version: 1.0.0-preview.47

Velaptor.Input.KeyboardState

Velaptor​

Velaptor.Input​

KeyboardState Struct​

Represents a single keyboard state at a particular time.

public record struct KeyboardState : System.IEquatable<Velaptor.Input.KeyboardState>

Implements System.IEquatable<KeyboardState>

Constructors​

KeyboardState() Constructor​

Initializes a new instance of the KeyboardState struct.

public KeyboardState();

Methods​

AnyAltKeysDown()​

Returns a value indicating whether any of the alt keys are in the down position.

public bool AnyAltKeysDown();

Returns​

System.Boolean
true if any of the control keys are down.

AnyCtrlKeysDown()​

Returns a value indicating whether any of the control keys are in the down position.

public bool AnyCtrlKeysDown();

Returns​

System.Boolean
true if any of the control keys are down.

AnyNumpadNumberKeysDown()​

Returns a value indicating whether any of the numpad number keys are in the down position.

public bool AnyNumpadNumberKeysDown();

Returns​

System.Boolean
true if any of the numpad number keys are in the down position.

AnyShiftKeysDown()​

Returns a value indicating whether any of the shift keys are in the down position.

public bool AnyShiftKeysDown();

Returns​

System.Boolean
true if any of the shift keys are down.

AnyStandardNumberKeysDown()​

Returns a value indicating whether any of the standard number keys, above the letter keys, are in the down position.

public bool AnyStandardNumberKeysDown();

Returns​

System.Boolean
true if any of the standard number keys are in the down position.

GetDownKeys()​

Returns all the keys that are in the down position.

public System.Span<Velaptor.Input.KeyCode> GetDownKeys();

Returns​

System.Span<KeyCode>
A list of the keys that are currently in the down position.

IsKeyDown(KeyCode)​

Returns a value indicating whether the given key is in the down position.

public bool IsKeyDown(Velaptor.Input.KeyCode key);

Parameters​

key KeyCode

The key to check.

Returns​

System.Boolean
true if the given key is in the down position.

IsKeyUp(KeyCode)​

Returns a value indicating whether the given key is in the up position.

public bool IsKeyUp(Velaptor.Input.KeyCode key);

Parameters​

key KeyCode

The key to check.

Returns​

System.Boolean
true if the given key is in the up position.

IsLeftAltKeyDown()​

Gets a value indicating whether the left alt key is in the down position.

public bool IsLeftAltKeyDown();

Returns​

System.Boolean
true if the left alt key is down.

IsLeftCtrlKeyDown()​

Gets a value indicating whether the left control key is in the down position.

public bool IsLeftCtrlKeyDown();

Returns​

System.Boolean
true if the left control key is down.

IsLeftShiftKeyDown()​

Gets a value indicating whether the left shift key is in the down position.

public bool IsLeftShiftKeyDown();

Returns​

System.Boolean
true if the left shift key is down.

IsRightAltKeyDown()​

Gets a value indicating whether the right alt key is in the down position.

public bool IsRightAltKeyDown();

Returns​

System.Boolean
true if the right alt key is down.

IsRightCtrlKeyDown()​

Gets a value indicating whether the right control key is in the down position.

public bool IsRightCtrlKeyDown();

Returns​

System.Boolean
true if the right control key is down.

IsRightShiftKeyDown()​

Gets a value indicating whether the right shift key is in the down position.

public bool IsRightShiftKeyDown();

Returns​

System.Boolean
true if the right shift key is down.

KeyToChar(KeyCode)​

Returns the character equivalent of the given key if it is a letter, number or symbol key. The value of 0 will be returned if the key is not a letter, number or symbol.

public char KeyToChar(Velaptor.Input.KeyCode key);

Parameters​

key KeyCode

The key to check.

Returns​

System.Char
The character that matches the given key.

SetKeyState(KeyCode, bool)​

Sets the state of the given key to the given state value.

public void SetKeyState(Velaptor.Input.KeyCode key, bool state);

Parameters​

key KeyCode

The key to set the state to.

state System.Boolean

The state of the key.