Add VirtualKey -> ImGuiKey helper method to ImGuiHelpers (#917)

Co-authored-by: goat <goatsdev@protonmail.com>
This commit is contained in:
liam 2022-07-15 13:59:16 -04:00 committed by GitHub
parent 1c581d4be3
commit e5fc5dac3e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 1 deletions

View file

@ -4,7 +4,9 @@ using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Numerics;
using Dalamud.Game.ClientState.Keys;
using ImGuiNET;
using ImGuiScene;
namespace Dalamud.Interface
{
@ -215,6 +217,26 @@ namespace Dalamud.Interface
target.Value!.BuildLookupTable();
}
/// <summary>
/// Map a VirtualKey keycode to an ImGuiKey enum value.
/// </summary>
/// <param name="key">The VirtualKey value to retrieve the ImGuiKey counterpart for.</param>
/// <returns>The ImGuiKey that corresponds to this VirtualKey, or <c>ImGuiKey.None</c> otherwise.</returns>
public static ImGuiKey VirtualKeyToImGuiKey(VirtualKey key)
{
return ImGui_Input_Impl_Direct.VirtualKeyToImGuiKey((int)key);
}
/// <summary>
/// Map an ImGuiKey enum value to a VirtualKey code.
/// </summary>
/// <param name="key">The ImGuiKey value to retrieve the VirtualKey counterpart for.</param>
/// <returns>The VirtualKey that corresponds to this ImGuiKey, or <c>VirtualKey.NO_KEY</c> otherwise.</returns>
public static VirtualKey ImGuiKeyToVirtualKey(ImGuiKey key)
{
return (VirtualKey)ImGui_Input_Impl_Direct.ImGuiKeyToVirtualKey(key);
}
/// <summary>
/// Get data needed for each new frame.
/// </summary>