From 7540f9c152c89c83930e9c08997a00aa6b40794d Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Thu, 12 Dec 2024 15:36:38 +0100 Subject: [PATCH] Application: adapt to Magnum changes. --- src/Application/Application.cpp | 16 ++++++++-------- src/Application/Application.h | 8 ++++---- src/Application/Application_Initialisation.cpp | 5 ++++- src/Application/Application_drawMainMenu.cpp | 5 ++++- 4 files changed, 20 insertions(+), 14 deletions(-) diff --git a/src/Application/Application.cpp b/src/Application/Application.cpp index ecade15..3bb9f24 100644 --- a/src/Application/Application.cpp +++ b/src/Application/Application.cpp @@ -191,23 +191,23 @@ Application::keyReleaseEvent(KeyEvent& event) { } void -Application::mousePressEvent(MouseEvent& event) { - if(_imgui.handleMousePressEvent(event)) return; +Application::pointerPressEvent(PointerEvent& event) { + if(_imgui.handlePointerPressEvent(event)) return; } void -Application::mouseReleaseEvent(MouseEvent& event) { - if(_imgui.handleMouseReleaseEvent(event)) return; +Application::pointerReleaseEvent(PointerEvent& event) { + if(_imgui.handlePointerReleaseEvent(event)) return; } void -Application::mouseMoveEvent(MouseMoveEvent& event) { - if(_imgui.handleMouseMoveEvent(event)) return; +Application::pointerMoveEvent(PointerMoveEvent& event) { + if(_imgui.handlePointerMoveEvent(event)) return; } void -Application::mouseScrollEvent(MouseScrollEvent& event) { - if(_imgui.handleMouseScrollEvent(event)) { +Application::scrollEvent(ScrollEvent& event) { + if(_imgui.handleScrollEvent(event)) { event.setAccepted(); return; } diff --git a/src/Application/Application.h b/src/Application/Application.h index ba7c9e4..45f5834 100644 --- a/src/Application/Application.h +++ b/src/Application/Application.h @@ -74,10 +74,10 @@ class Application: public Platform::Sdl2Application, public efsw::FileWatchListe void keyPressEvent(KeyEvent& event) override; void keyReleaseEvent(KeyEvent& event) override; - void mousePressEvent(MouseEvent& event) override; - void mouseReleaseEvent(MouseEvent& event) override; - void mouseMoveEvent(MouseMoveEvent& event) override; - void mouseScrollEvent(MouseScrollEvent& event) override; + void pointerPressEvent(PointerEvent& event) override; + void pointerReleaseEvent(PointerEvent& event) override; + void pointerMoveEvent(PointerMoveEvent& event) override; + void scrollEvent(ScrollEvent& event) override; void textInputEvent(TextInputEvent& event) override; void anyEvent(SDL_Event& event) override; diff --git a/src/Application/Application_Initialisation.cpp b/src/Application/Application_Initialisation.cpp index 90dab3f..d7500e1 100644 --- a/src/Application/Application_Initialisation.cpp +++ b/src/Application/Application_Initialisation.cpp @@ -16,6 +16,8 @@ #include +#include + #include #include @@ -52,7 +54,8 @@ Application::initialiseConfiguration() { LOG_INFO("Reading configuration file."); setSwapInterval(conf().swapInterval()); - setMinimalLoopPeriod(0); + using namespace Math::Literals; + setMinimalLoopPeriod(0_nsec); } void diff --git a/src/Application/Application_drawMainMenu.cpp b/src/Application/Application_drawMainMenu.cpp index bd14870..98e5672 100644 --- a/src/Application/Application_drawMainMenu.cpp +++ b/src/Application/Application_drawMainMenu.cpp @@ -16,6 +16,8 @@ #include +#include + #include "../Configuration/Configuration.h" #include "../FontAwesome/IconsFontAwesome5.h" #include "../FontAwesome/IconsFontAwesome5Brands.h" @@ -98,7 +100,8 @@ Application::drawMainMenu() { conf().setSwapInterval(i); setSwapInterval(i); if(i == 0) { - setMinimalLoopPeriod(0); + using namespace Math::Literals; + setMinimalLoopPeriod(0_nsec); } } }