Struct AsciiKey
Represents the state of a single key.
Inherited Members
Namespace: SadConsole.Input
Assembly: SadConsole.dll
Syntax
public struct AsciiKey
Fields
CapsLockedKeys
List of Keys to consider as shifted when capslock is on.
Declaration
public static readonly List<Keys> CapsLockedKeys
Field Value
Type | Description |
---|---|
List<Keys> |
Character
The keyboard character of the key.
Declaration
public char Character
Field Value
Type | Description |
---|---|
char |
Key
The key from MonoGame or XNA.
Declaration
public Keys Key
Field Value
Type | Description |
---|---|
Keys |
KeyRemapping
Remaps any incoming key to a combination of character and key.
Declaration
public static readonly Dictionary<Keys, Keys> KeyRemapping
Field Value
Type | Description |
---|---|
Dictionary<Keys, Keys> |
NumberKeyMappings
Dictionary that maps Keys usually triggered by the numberpad with a character and non-numpad key.
Declaration
public static readonly Dictionary<Keys, AsciiKey.CharacterKeyMapping> NumberKeyMappings
Field Value
Type | Description |
---|---|
Dictionary<Keys, AsciiKey.CharacterKeyMapping> |
PostInitialDelay
Tracks if the key was previously held when calculating the InitialRepeatDelay.
Declaration
public bool PostInitialDelay
Field Value
Type | Description |
---|---|
bool |
ShiftKeyMappings
A dictionary that is keyed off of a Keys and associates that key with a character in a shifted and unshifted state.
Declaration
public static readonly Dictionary<Keys, AsciiKey.ShiftedCharacterMapping> ShiftKeyMappings
Field Value
Type | Description |
---|---|
Dictionary<Keys, AsciiKey.ShiftedCharacterMapping> |
TimeHeld
Total time the key has been held.
Declaration
public float TimeHeld
Field Value
Type | Description |
---|---|
float |
Methods
Equals(object?)
Compares references.
Declaration
public override bool Equals(object? obj)
Parameters
Type | Name | Description |
---|---|---|
object | obj |
Returns
Type | Description |
---|---|
bool |
Overrides
Fill(Keys, bool, IKeyboardState)
Fills out the fields based on the key.
Declaration
public void Fill(Keys key, bool shiftPressed, IKeyboardState state)
Parameters
Type | Name | Description |
---|---|---|
Keys | key | The key. |
bool | shiftPressed | Helps identify which Character to use while the key is pressed. |
IKeyboardState | state | Keyboard state to read from. |
Get(Keys, IKeyboardState)
Shortcut to get the AsciiKey for a specific MonoGame/XNA Keys type. Shift is considered not pressed.
Declaration
public static AsciiKey Get(Keys key, IKeyboardState state)
Parameters
Type | Name | Description |
---|---|---|
Keys | key | The key. |
IKeyboardState | state | Keyboar state to read from. |
Returns
Type | Description |
---|---|
AsciiKey |
Get(Keys, bool, IKeyboardState)
Declaration
public static AsciiKey Get(Keys key, bool shiftPressed, IKeyboardState state)
Parameters
Type | Name | Description |
---|---|---|
Keys | key | The key. |
bool | shiftPressed | If shift should be considered pressed or not. |
IKeyboardState | state | Keyboar state to read from. |
Returns
Type | Description |
---|---|
AsciiKey |
GetHashCode()
Gets a hashcode based on the key and character.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
int |
Overrides
Operators
operator ==(AsciiKey, AsciiKey)
Checks if the two AsciiKey types use the same Key if the Character is 0. If the Character is not 0, the Character is compared.
Declaration
public static bool operator ==(AsciiKey left, AsciiKey right)
Parameters
Type | Name | Description |
---|---|---|
AsciiKey | left | First item to compare. |
AsciiKey | right | Second item to compare. |
Returns
Type | Description |
---|---|
bool |
operator ==(AsciiKey, Keys)
Declaration
public static bool operator ==(AsciiKey left, Keys right)
Parameters
Type | Name | Description |
---|---|---|
AsciiKey | left | The AsciiKey to compare. |
Keys | right | The Key to compare. |
Returns
Type | Description |
---|---|
bool | True when Key matches. |
operator ==(Keys, AsciiKey)
Declaration
public static bool operator ==(Keys left, AsciiKey right)
Parameters
Type | Name | Description |
---|---|---|
Keys | left | The Key to compare. |
AsciiKey | right | The AsciiKey to compare. |
Returns
Type | Description |
---|---|
bool | True when Key matches. |
operator !=(AsciiKey, AsciiKey)
Declaration
public static bool operator !=(AsciiKey left, AsciiKey right)
Parameters
Type | Name | Description |
---|---|---|
AsciiKey | left | First item to compare. |
AsciiKey | right | Second item to compare. |
Returns
Type | Description |
---|---|
bool |
operator !=(AsciiKey, Keys)
Declaration
public static bool operator !=(AsciiKey left, Keys right)
Parameters
Type | Name | Description |
---|---|---|
AsciiKey | left | The AsciiKey to compare. |
Keys | right | The Key to compare. |
Returns
Type | Description |
---|---|
bool | True when Key does not match. |
operator !=(Keys, AsciiKey)
Declaration
public static bool operator !=(Keys left, AsciiKey right)
Parameters
Type | Name | Description |
---|---|---|
Keys | left | The Key to compare. |
AsciiKey | right | The AsciiKey to compare. |
Returns
Type | Description |
---|---|
bool | True when Key does not match. |