imgui
imgui copied to clipboard
ImGuiNodeEditor fix
Hi,
I have patched that old ImGuiNodeEditor (nice) project, but there is one line of code that causes issue, maybe you can help me out
I try to replace missing KeysDown
for (int n = 0; n < IM_ARRAYSIZE(io.KeysDown); n++)
io.KeysDown[n] = false;
But AddKeyEvent gives me crap as it triggers an assertion fail here
void ImGuiIO::AddKeyAnalogEvent(ImGuiKey key, bool down, float analog_value)
{
//if (e->Down) { IMGUI_DEBUG_LOG_IO("AddKeyEvent() Key='%s' %d, NativeKeycode = %d, NativeScancode = %d\n", ImGui::GetKeyName(e->Key), e->Down, e->NativeKeycode, e->NativeScancode); }
IM_ASSERT(Ctx != NULL);
if (key == ImGuiKey_None || !AppAcceptingEvents)
return;
ImGuiContext& g = *Ctx;
IM_ASSERT(ImGui::IsNamedKeyOrMod(key)); <<<<<<<<<<<<< here
This is the code I try to update
for people interested in the code : ImGuiNodeEditor\examples\application\source\imgui_impl_win32.cpp line 353
case WM_KILLFOCUS:
/*for (int n = 0; n < IM_ARRAYSIZE(io.KeysDown); n++)
io.KeysDown[n] = false;*/
ImGuiIO& io = ImGui::GetIO();
// Reset all keys to not pressed
for (int key = 0; key < ImGuiKey_COUNT; ++key)
io.AddKeyEvent((ImGuiKey)key, false); <<<<<<<<<<<<<<< culprit
// Reset all mouse buttons to not pressed
for (int btn = 0; btn < IM_ARRAYSIZE(io.MouseDown); ++btn)
io.AddMouseButtonEvent(btn, false);
break;
Thanks for helping me out on this one