Skip to content

AsciiKey Struct

Represents the state of a single key.

C#
public struct AsciiKey

List of Keys to consider as shifted when capslock is on.

C#
public static readonly List<Keys> CapsLockedKeys

A dictionary that is keyed off of a Keys and associates that key with a character in a shifted and unshifted state.

C#
public static readonly Dictionary<Keys, AsciiKey.ShiftedCharacterMapping> ShiftKeyMappings

Dictionary that maps Keys usually triggered by the numberpad with a character and non-numpad key.

C#
public static readonly Dictionary<Keys, AsciiKey.CharacterKeyMapping> NumberKeyMappings

Remaps any incoming key to a combination of character and key.

C#
public static readonly Dictionary<Keys, Keys> KeyRemapping

The key from MonoGame or XNA.

C#
public Keys Key

The keyboard character of the key.

C#
public char Character

Total time the key has been held.

C#
public TimeSpan TimeHeld

Tracks if the key was previously held when calculating the InitialRepeatDelay.

C#
public bool PostInitialDelay

Fills out the fields based on the key.

C#
public void Fill(Keys key, bool shiftPressed, IKeyboardState state)

key Keys
The key.

shiftPressed bool
Helps identify which Character to use while the key is pressed.

state IKeyboardState
Keyboard state to read from.

Shortcut to get the AsciiKey for a specific MonoGame/XNA Keys type. Shift is considered not pressed.

C#
public static AsciiKey Get(Keys key, IKeyboardState state)

key Keys
The key.

state IKeyboardState
Keyboar state to read from.

AsciiKey
The AsciiKey of the Keys.

Shortcut to get the AsciiKey for a specific MonoGame/XNA Keys type.

C#
public static AsciiKey Get(Keys key, bool shiftPressed, IKeyboardState state)

key Keys
The key.

shiftPressed bool
If shift should be considered pressed or not.

state IKeyboardState
Keyboar state to read from.

AsciiKey
The AsciiKey of the Keys.

Gets a hashcode based on the key and character.

C#
public override int GetHashCode()

int

Compares references.

C#
public override bool Equals(object? obj)

obj object

bool