SFML community forums
General => Feature requests => Topic started by: Tank on September 22, 2009, 01:49:51 am
-
Hey,
is it possible to add mouse positions to the MouseWheelEvent structure? This is currently only possible through sf::Input(). Unfortunately I don't have access to sf::Window::GetInput() where I need the positions.
-
As the mouse hasn't move since the last MouseMoved event you don't need this information one more time ( it's the same ) .
-
Well, the same goes for MouseButtonEvent, doesn't it?
And it's good as it is because it's comfortable and makes sense: The user pressed a button, where? And I want: The user moved the wheel, where?
-
Well, the same goes for MouseButtonEvent, doesn't it?
And it's good as it is because it's comfortable and makes sense: The user pressed a button, where? And I want: The user moved the wheel, where?
Agreed, and added to the task list.
-
Thanks Laurent.
I already did the (small) patch yesterday, so if you're interested, you may want to apply it:
+++ src/SFML/Window/Win32/WindowImplWin32.cpp 2009-09-22 01:55:41.000000000 +0200
@@ -562,6 +562,8 @@
Event event;
event.Type = Event::MouseWheelMoved;
event.MouseWheel.Delta = static_cast<Int16>(HIWORD(wParam)) / 120;
+ event.MouseWheel.X = LOWORD(lParam);
+ event.MouseWheel.Y = HIWORD(lParam);
SendEvent(event);
break;
}
+++ src/SFML/Window/Linux/WindowImplX11.cpp 2009-09-22 01:54:29.000000000 +0200
@@ -819,6 +819,8 @@
Event event;
event.Type = Event::MouseWheelMoved;
event.MouseWheel.Delta = windowEvent.xbutton.button == Button4 ? 1 : -1;
+ event.MouseWheel.X = windowEvent.xbutton.x;
+ event.MouseWheel.Y = windowEvent.xbutton.y;
SendEvent(event);
}
break;
Edit: Just noticed that it's missing the "int X" and "int Y" members in the MouseWheelEvent struct.
-
Thanks for the patch, but there's much more to change (CSFML, SFML.Net, tutorials, documentation, ...) ;)
-
True. :)
-
It's implemented now.
By the way, your patch has an error: on Windows, and unlike other mouse events, WM_MOUSEWHEEL gives the mouse position in screen coordinates; so it has to be converted to window coordinates ;)
-
Thank you very much.
Oh okay, I haven't read the MSDN carefully enough, I guess. ;)