From e5f3eb369a18afecee41b6766957b6c27065b02d Mon Sep 17 00:00:00 2001 From: Alexander Weinrauch Date: Sat, 20 Jul 2024 13:30:17 +0200 Subject: [PATCH 1/2] Fix lambda relying on event inheritance --- imgui-SFML.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/imgui-SFML.cpp b/imgui-SFML.cpp index 19a04f3..3c5bd92 100644 --- a/imgui-SFML.cpp +++ b/imgui-SFML.cpp @@ -321,7 +321,7 @@ void ProcessEvent(const sf::Window& window, const sf::Event& event) { io.AddMouseWheelEvent(mouseWheelScrolled->delta, 0); } } - const auto handleKeyChanged = [&io](const sf::Event::KeyChanged& keyChanged, bool down) { + const auto handleKeyChanged = [&io](const auto& keyChanged, bool down) { const ImGuiKey mod = keycodeToImGuiMod(keyChanged.code); // The modifier booleans are not reliable when it's the modifier // itself that's being pressed. Detect these presses directly. From e77d1639b72ae23ee73e137020cbc7ece71415e3 Mon Sep 17 00:00:00 2001 From: Alexander Weinrauch Date: Sun, 21 Jul 2024 19:19:23 +0200 Subject: [PATCH 2/2] Update to new event syntax --- examples/minimal/main.cpp | 4 ++-- examples/multiple_windows/main.cpp | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/minimal/main.cpp b/examples/minimal/main.cpp index 73c53d0..0531ce6 100644 --- a/examples/minimal/main.cpp +++ b/examples/minimal/main.cpp @@ -15,9 +15,9 @@ int main() { sf::Clock deltaClock; while (window.isOpen()) { while (const auto event = window.pollEvent()) { - ImGui::SFML::ProcessEvent(window, event); + ImGui::SFML::ProcessEvent(window, *event); - if (event.is()) { + if (event->is()) { window.close(); } } diff --git a/examples/multiple_windows/main.cpp b/examples/multiple_windows/main.cpp index 590d4ab..1551076 100644 --- a/examples/multiple_windows/main.cpp +++ b/examples/multiple_windows/main.cpp @@ -17,8 +17,8 @@ int main() { while (window.isOpen()) { // Main window event processing while (const auto event = window.pollEvent()) { - ImGui::SFML::ProcessEvent(window, event); - if (event.is()) { + ImGui::SFML::ProcessEvent(window, *event); + if (event->is()) { if (childWindow.isOpen()) { childWindow.close(); } @@ -31,8 +31,8 @@ int main() { // Child window event processing if (childWindow.isOpen()) { while (const auto event = childWindow.pollEvent()) { - ImGui::SFML::ProcessEvent(childWindow, event); - if (event.is()) { + ImGui::SFML::ProcessEvent(childWindow, *event); + if (event->is()) { childWindow.close(); ImGui::SFML::Shutdown(childWindow); }