Hi,
I'm trying to port from 1.86 to 1.87.3 and got stuck with the following change:
IsKeyPressed(ImGuiKey key)
In our software we have defined a windows compatible enum that is obviously incompatible with the enum defined in ImGuiKey.cs. So casting to an int like I did before is no longer an option:
if (ImGui.IsKeyPressed((int)Key.Esc))) {
// some something
}
Our key handler is currently implemented like this:
var form = new ImGuiDx11RenderForm(windowTitle)
{
ClientSize = new Size(640, 480),
Icon = new Icon(@"Resources\t3\t3.ico", 48, 48)
};
form.KeyDown += HandleKeyDown;
form.KeyUp += HandleKeyUp;
private static void HandleKeyDown(object sender, KeyEventArgs e)
{
var keyIndex = (int)e.KeyCode;
if (keyIndex >= Core.IO.KeyHandler.PressedKeys.Length)
{
Log.Warning($"Ignoring out of range key code {e.KeyCode} with index {keyIndex}");
}
else
{
Core.IO.KeyHandler.PressedKeys[keyIndex] = true;
}
}
private static void HandleKeyUp(object sender, KeyEventArgs e)
{
var keyIndex = (int)e.KeyCode;
if (keyIndex < Core.IO.KeyHandler.PressedKeys.Length)
{
Core.IO.KeyHandler.PressedKeys[keyIndex] = false;
}
}
I would be very grateful for any pointers or advice what would be a good approach to adjust our implementation.
Hi,
I'm trying to port from 1.86 to 1.87.3 and got stuck with the following change:
In our software we have defined a windows compatible enum that is obviously incompatible with the enum defined in
ImGuiKey.cs. So casting to an int like I did before is no longer an option:Our key handler is currently implemented like this:
I would be very grateful for any pointers or advice what would be a good approach to adjust our implementation.