Skip to main content

Interface IKeyState

Wrapper around the game keystate buffer, which contains the pressed state for all keyboard keys, indexed by virtual vkCode.

Assembly: Dalamud.dll
View Source
Declaration
public interface IKeyState

Properties

this[int]

Get or set the key-pressed state for a given vkCode.

View Source
Declaration
bool this[int vkCode] { get; set; }

this[VirtualKey]

Get or set the key-pressed state for a given vkCode.

View Source
Declaration
bool this[VirtualKey vkCode] { get; set; }

Methods

GetRawValue(int)

Gets the value in the index array.

View Source
Declaration
int GetRawValue(int vkCode)
Returns

System.Int32: The raw value stored in the index array.

Parameters
TypeNameDescription
System.Int32vkCodeThe 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.

View Source
Declaration
int GetRawValue(VirtualKey vkCode)
Returns

System.Int32: The raw value stored in the index array.

Parameters
TypeNameDescription
Dalamud.Game.ClientState.Keys.VirtualKeyvkCodeThe 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.

View Source
Declaration
void SetRawValue(int vkCode, int value)
Parameters
TypeNameDescription
System.Int32vkCodeThe virtual key to change.
System.Int32valueThe 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.

View Source
Declaration
void SetRawValue(VirtualKey vkCode, int value)
Parameters
TypeNameDescription
Dalamud.Game.ClientState.Keys.VirtualKeyvkCodeThe virtual key to change.
System.Int32valueThe 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.

View Source
Declaration
bool IsVirtualKeyValid(int vkCode)
Returns

System.Boolean: If the code is valid.

Parameters
TypeNameDescription
System.Int32vkCodeVirtual key code.

IsVirtualKeyValid(VirtualKey)

Gets a value indicating whether the given VirtualKey code is regarded as valid input by the game.

View Source
Declaration
bool IsVirtualKeyValid(VirtualKey vkCode)
Returns

System.Boolean: If the code is valid.

Parameters
TypeNameDescription
Dalamud.Game.ClientState.Keys.VirtualKeyvkCodeVirtual key code.

GetValidVirtualKeys()

Gets an array of virtual keys the game considers valid input.

View Source
Declaration
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.

View Source
Declaration
void ClearAll()