Interface IKeyState
Wrapper around the game keystate buffer, which contains the pressed state for all keyboard keys, indexed by virtual vkCode.
Remarks
The stored key state is actually a combination field, however the below ephemeral states are consumed each frame. Setting the value may be mildly useful, however retrieving the value is largely pointless. In testing, it wasn't possible without setting the statue manually. index & 0 = key pressed. index & 1 = key down (ephemeral). index & 2 = key up (ephemeral). index & 3 = short key press (ephemeral).
Assembly: Dalamud.dll
public interface IKeyState : IDalamudService
Properties
this[int]
Get or set the key-pressed state for a given vkCode.
bool this[int vkCode] { get; set; }
this[VirtualKey]
Get or set the key-pressed state for a given vkCode.
bool this[VirtualKey vkCode] { get; set; }
Methods
GetRawValue(int)
Gets the value in the index array.
int GetRawValue(int vkCode)
Returns
System.Int32: The raw value stored in the index array.
Parameters
| Type | Name | Description |
|---|---|---|
System.Int32 | vkCode | The virtual key to change. |
Exceptions
System.ArgumentException
If the vkCode is not valid. Refer to Dalamud.Plugin.Services.IKeyState.IsVirtualKeyValid(int) or Dalamud.Plugin.Services.IKeyState.GetValidVirtualKeys().
GetRawValue(VirtualKey)
Gets the value in the index array.
int GetRawValue(VirtualKey vkCode)
Returns
System.Int32: The raw value stored in the index array.
Parameters
| Type | Name | Description |
|---|---|---|
| Dalamud.Game.ClientState.Keys.VirtualKey | vkCode | The virtual key to change. |
Exceptions
System.ArgumentException
If the vkCode is not valid. Refer to Dalamud.Plugin.Services.IKeyState.IsVirtualKeyValid(int) or Dalamud.Plugin.Services.IKeyState.GetValidVirtualKeys().
SetRawValue(int, int)
Sets the value in the index array.
void SetRawValue(int vkCode, int value)
Parameters
| Type | Name | Description |
|---|---|---|
System.Int32 | vkCode | The virtual key to change. |
System.Int32 | value | The raw value to set in the index array. |
Exceptions
System.ArgumentException
If the vkCode is not valid. Refer to Dalamud.Plugin.Services.IKeyState.IsVirtualKeyValid(int) or Dalamud.Plugin.Services.IKeyState.GetValidVirtualKeys().
System.ArgumentOutOfRangeException
If the set value is non-zero.
SetRawValue(VirtualKey, int)
Sets the value in the index array.
void SetRawValue(VirtualKey vkCode, int value)
Parameters
| Type | Name | Description |
|---|---|---|
| Dalamud.Game.ClientState.Keys.VirtualKey | vkCode | The virtual key to change. |
System.Int32 | value | The raw value to set in the index array. |
Exceptions
System.ArgumentException
If the vkCode is not valid. Refer to Dalamud.Plugin.Services.IKeyState.IsVirtualKeyValid(int) or Dalamud.Plugin.Services.IKeyState.GetValidVirtualKeys().
System.ArgumentOutOfRangeException
If the set value is non-zero.
IsVirtualKeyValid(int)
Gets a value indicating whether the given VirtualKey code is regarded as valid input by the game.
bool IsVirtualKeyValid(int vkCode)
Returns
System.Boolean: If the code is valid.
Parameters
| Type | Name | Description |
|---|---|---|
System.Int32 | vkCode | Virtual key code. |
IsVirtualKeyValid(VirtualKey)
Gets a value indicating whether the given VirtualKey code is regarded as valid input by the game.
bool IsVirtualKeyValid(VirtualKey vkCode)
Returns
System.Boolean: If the code is valid.
Parameters
| Type | Name | Description |
|---|---|---|
| Dalamud.Game.ClientState.Keys.VirtualKey | vkCode | Virtual key code. |
GetValidVirtualKeys()
Gets an array of virtual keys the game considers valid input.
IEnumerable<VirtualKey> GetValidVirtualKeys()
Returns
System.Collections.Generic.IEnumerable<Dalamud.Game.ClientState.Keys.VirtualKey>: An array of valid virtual keys.
ClearAll()
Clears the pressed state for all keys.
void ClearAll()