diff --git a/CSFML/include/SFML/Window/Event.h b/CSFML/include/SFML/Window/Event.h index 3471ccaf..c1484697 100644 --- a/CSFML/include/SFML/Window/Event.h +++ b/CSFML/include/SFML/Window/Event.h @@ -242,6 +242,8 @@ struct sfMouseWheelEvent { sfEventType Type; int Delta; + int X; + int Y; }; //////////////////////////////////////////////////////////// diff --git a/CSFML/src/SFML/ConvertEvent.h b/CSFML/src/SFML/ConvertEvent.h index acfb6812..06a222d8 100644 --- a/CSFML/src/SFML/ConvertEvent.h +++ b/CSFML/src/SFML/ConvertEvent.h @@ -62,6 +62,8 @@ inline void ConvertEvent(const sf::Event& SFMLEvent, sfEvent* event) case sfEvtMouseWheelMoved : event->MouseWheel.Delta = SFMLEvent.MouseWheel.Delta; + event->MouseWheel.X = SFMLEvent.MouseWheel.X; + event->MouseWheel.Y = SFMLEvent.MouseWheel.Y; break; case sfEvtMouseButtonPressed : diff --git a/dotnet/extlibs/csfml-audio.dll b/dotnet/extlibs/csfml-audio.dll index 502ce538..64dadbf2 100644 Binary files a/dotnet/extlibs/csfml-audio.dll and b/dotnet/extlibs/csfml-audio.dll differ diff --git a/dotnet/extlibs/csfml-graphics.dll b/dotnet/extlibs/csfml-graphics.dll index c3b9d894..7754a788 100644 Binary files a/dotnet/extlibs/csfml-graphics.dll and b/dotnet/extlibs/csfml-graphics.dll differ diff --git a/dotnet/extlibs/csfml-window.dll b/dotnet/extlibs/csfml-window.dll index b7331f21..5f763d17 100644 Binary files a/dotnet/extlibs/csfml-window.dll and b/dotnet/extlibs/csfml-window.dll differ diff --git a/dotnet/src/Window/Event.cs b/dotnet/src/Window/Event.cs index 543ada66..08374c40 100644 --- a/dotnet/src/Window/Event.cs +++ b/dotnet/src/Window/Event.cs @@ -294,6 +294,12 @@ namespace SFML { /// Scroll amount public int Delta; + + /// X coordinate of the mouse cursor + public int X; + + /// Y coordinate of the mouse cursor + public int Y; } //////////////////////////////////////////////////////////// diff --git a/dotnet/src/Window/EventArgs.cs b/dotnet/src/Window/EventArgs.cs index d66e569c..acbd040c 100644 --- a/dotnet/src/Window/EventArgs.cs +++ b/dotnet/src/Window/EventArgs.cs @@ -132,10 +132,18 @@ namespace SFML public MouseWheelEventArgs(MouseWheelEvent e) { Delta = e.Delta; + X = e.X; + Y = e.Y; } /// Scroll amount public int Delta; + + /// X coordinate of the mouse cursor + public int X; + + /// Y coordinate of the mouse cursor + public int Y; } //////////////////////////////////////////////////////////// diff --git a/include/SFML/Window/Event.hpp b/include/SFML/Window/Event.hpp index ad7af14f..f241b282 100644 --- a/include/SFML/Window/Event.hpp +++ b/include/SFML/Window/Event.hpp @@ -223,8 +223,8 @@ public : //////////////////////////////////////////////////////////// struct MouseMoveEvent { - int X; ///< X position of the mouse, relative to the left of the owner window - int Y; ///< Y position of the mouse, relative to the top of the owner window + int X; ///< X position of the mouse pointer, relative to the left of the owner window + int Y; ///< Y position of the mouse pointer, relative to the top of the owner window }; //////////////////////////////////////////////////////////// @@ -235,8 +235,8 @@ public : struct MouseButtonEvent { Mouse::Button Button; ///< Code of the button that has been pressed - int X; ///< X position of the mouse, relative to the left of the owner window - int Y; ///< Y position of the mouse, relative to the top of the owner window + int X; ///< X position of the mouse pointer, relative to the left of the owner window + int Y; ///< Y position of the mouse pointer, relative to the top of the owner window }; //////////////////////////////////////////////////////////// @@ -246,6 +246,8 @@ public : struct MouseWheelEvent { int Delta; ///< Number of ticks the wheel has moved (positive is up, negative is down) + int X; ///< X position of the mouse pointer, relative to the left of the owner window + int Y; ///< Y position of the mouse pointer, relative to the top of the owner window }; //////////////////////////////////////////////////////////// diff --git a/src/SFML/Window/Win32/WindowImplWin32.cpp b/src/SFML/Window/Win32/WindowImplWin32.cpp index 01a0bf48..246b4f1f 100644 --- a/src/SFML/Window/Win32/WindowImplWin32.cpp +++ b/src/SFML/Window/Win32/WindowImplWin32.cpp @@ -532,9 +532,17 @@ void WindowImplWin32::ProcessEvent(UINT message, WPARAM wParam, LPARAM lParam) // Mouse wheel event case WM_MOUSEWHEEL : { + // Mouse position is in screen coordinates, convert it to window coordinates + POINT position; + position.x = LOWORD(lParam); + position.y = HIWORD(lParam); + ScreenToClient(myHandle, &position); + Event event; event.Type = Event::MouseWheelMoved; event.MouseWheel.Delta = static_cast(HIWORD(wParam)) / 120; + event.MouseButton.X = position.x; + event.MouseButton.Y = position.y; SendEvent(event); break; }