diff --git a/Dalamud/Game/ClientState/Keys/KeyState.cs b/Dalamud/Game/ClientState/Keys/KeyState.cs index ce36ba96b..65d949ed8 100644 --- a/Dalamud/Game/ClientState/Keys/KeyState.cs +++ b/Dalamud/Game/ClientState/Keys/KeyState.cs @@ -137,7 +137,6 @@ namespace Dalamud.Game.ClientState.Keys /// /// Gets the raw value from the key state array. - /// No bounds checking is done. /// /// Virtual key code. /// A reference to the indexed array. diff --git a/Dalamud/Interface/Internal/Windows/DataWindow.cs b/Dalamud/Interface/Internal/Windows/DataWindow.cs index a831511b1..d4146953f 100644 --- a/Dalamud/Interface/Internal/Windows/DataWindow.cs +++ b/Dalamud/Interface/Internal/Windows/DataWindow.cs @@ -13,6 +13,7 @@ using Dalamud.Game.ClientState.GamePad; using Dalamud.Game.ClientState.JobGauge; using Dalamud.Game.ClientState.JobGauge.Enums; using Dalamud.Game.ClientState.JobGauge.Types; +using Dalamud.Game.ClientState.Keys; using Dalamud.Game.ClientState.Objects; using Dalamud.Game.ClientState.Objects.SubKinds; using Dalamud.Game.ClientState.Objects.Types; @@ -22,6 +23,7 @@ using Dalamud.Game.Gui; using Dalamud.Game.Gui.FlyText; using Dalamud.Game.Gui.Toast; using Dalamud.Game.Text; +using Dalamud.Interface.Colors; using Dalamud.Interface.Internal.Notifications; using Dalamud.Interface.Windowing; using Dalamud.Memory; @@ -131,6 +133,7 @@ namespace Dalamud.Interface.Internal.Windows FlyText, ImGui, Tex, + KeyState, Gamepad, } @@ -288,6 +291,10 @@ namespace Dalamud.Interface.Internal.Windows this.DrawTex(); break; + case DataKind.KeyState: + this.DrawKeyState(); + break; + case DataKind.Gamepad: this.DrawGamepad(); break; @@ -1150,6 +1157,32 @@ namespace Dalamud.Interface.Internal.Windows } } + private void DrawKeyState() + { + var keyState = Service.Get(); + + ImGui.Columns(4); + + var i = 0; + foreach (var vkCode in keyState.GetValidVirtualKeys()) + { + var code = (int)vkCode; + var value = keyState[code]; + + ImGui.PushStyleColor(ImGuiCol.Text, value ? ImGuiColors.HealerGreen : ImGuiColors.DPSRed); + + ImGui.Text($"{vkCode} ({code})"); + + ImGui.PopStyleColor(); + + i++; + if (i % 24 == 0) + ImGui.NextColumn(); + } + + ImGui.Columns(1); + } + private void DrawGamepad() { var gamepadState = Service.Get();