diff --git a/ChangeLog.md b/ChangeLog.md index b2f71d16d..820f91e93 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -189,6 +189,7 @@ Nazara Engine: - ⚠ TextSprite will now use multiple render layers by itself (the current one and the one right before, ex: [-1, 0] if base layer is 0) if you use text outlines. - ⚠ SimpleTextDrawer no longer supports faux bold rendering - Added PhysWorld2D::[RaycastQuery, RegionQuery] overloads taking a callback +- Added x and y mouse position to MouseWheelEvent Nazara Development Kit: - Added ImageWidget (#139) diff --git a/include/Nazara/Platform/Event.hpp b/include/Nazara/Platform/Event.hpp index 1fe219e8e..02a842889 100644 --- a/include/Nazara/Platform/Event.hpp +++ b/include/Nazara/Platform/Event.hpp @@ -55,6 +55,8 @@ namespace Nz struct MouseWheelEvent { float delta; + int x; + int y; }; // Used by: diff --git a/src/Nazara/Platform/Win32/WindowImpl.cpp b/src/Nazara/Platform/Win32/WindowImpl.cpp index 27b4fa889..6ee3365ac 100644 --- a/src/Nazara/Platform/Win32/WindowImpl.cpp +++ b/src/Nazara/Platform/Win32/WindowImpl.cpp @@ -712,7 +712,10 @@ namespace Nz { WindowEvent event; event.type = WindowEventType_MouseWheelMoved; - event.mouseWheel.delta = static_cast(GET_WHEEL_DELTA_WPARAM(wParam))/WHEEL_DELTA; + event.mouseWheel.delta = static_cast(GET_WHEEL_DELTA_WPARAM(wParam)) / WHEEL_DELTA; + event.mouseWheel.x = GET_X_LPARAM(lParam); + event.mouseWheel.y = GET_Y_LPARAM(lParam); + m_parent->PushEvent(event); } else @@ -722,7 +725,10 @@ namespace Nz { WindowEvent event; event.type = WindowEventType_MouseWheelMoved; - event.mouseWheel.delta = static_cast(m_scrolling/WHEEL_DELTA); + event.mouseWheel.delta = static_cast(m_scrolling / WHEEL_DELTA); + event.mouseWheel.x = GET_X_LPARAM(lParam); + event.mouseWheel.y = GET_Y_LPARAM(lParam); + m_parent->PushEvent(event); m_scrolling %= WHEEL_DELTA; diff --git a/src/Nazara/Platform/X11/WindowImpl.cpp b/src/Nazara/Platform/X11/WindowImpl.cpp index 0e8215e37..abf2db675 100644 --- a/src/Nazara/Platform/X11/WindowImpl.cpp +++ b/src/Nazara/Platform/X11/WindowImpl.cpp @@ -1233,6 +1233,8 @@ namespace Nz { event.type = Nz::WindowEventType_MouseWheelMoved; event.mouseWheel.delta = (buttonReleaseEvent->detail == XCB_BUTTON_INDEX_4) ? 1 : -1; + event.mouseWheel.x = buttonReleaseEvent->event_x; + event.mouseWheel.y = buttonReleaseEvent->event_y; break; } default: