mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-01-01 05:13:40 +01:00
* wip * hacky fix for overlapping event text in profiler * move IsResumeGameAfterPluginLoad logic to PluginManager * fix some warnings * handle exceptions properly * remove ability to cancel, rename button to "hide" instead * undo Dalamud.Service refactor for now * warnings * add explainer, show which plugins are still loading * add some text if loading takes more than 3 minutes * undo wrong CS merge
54 lines
1.2 KiB
C#
54 lines
1.2 KiB
C#
using Dalamud.Game.ClientState.Keys;
|
|
using Dalamud.Interface.Colors;
|
|
|
|
using ImGuiNET;
|
|
|
|
namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
|
|
|
|
/// <summary>
|
|
/// Widget for displaying keyboard state.
|
|
/// </summary>
|
|
internal class KeyStateWidget : IDataWindowWidget
|
|
{
|
|
/// <inheritdoc/>
|
|
public string[]? CommandShortcuts { get; init; } = { "keystate" };
|
|
|
|
/// <inheritdoc/>
|
|
public string DisplayName { get; init; } = "KeyState";
|
|
|
|
/// <inheritdoc/>
|
|
public bool Ready { get; set; }
|
|
|
|
/// <inheritdoc/>
|
|
public void Load()
|
|
{
|
|
this.Ready = true;
|
|
}
|
|
|
|
/// <inheritdoc/>
|
|
public void Draw()
|
|
{
|
|
var keyState = Service<KeyState>.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);
|
|
}
|
|
}
|