![]() |
jerky/jittering mouse movement | ![]() |
![]() |
jerky/jittering mouse movement | ![]() |
Creature
Guest
![]() |
![]() |
<asd1234qwerty <at> gmail.com> writes:
I've experienced this problem with cursors too, if you're using a custom cursor ( an image blitted at the position of the cursor ) or just the normal cursor, you could try putting a SDL_Delay(2) at each event reading, it might look strange to put a delay there, but usually it helps smooth out the mouse, it worked fine in OpenGL too for me, which also had mouse jittering. If you're using an image that is drawn at the mouse cursor, and you have to get the mouse position to update its x and y width, use SDL_GetMouseState(x, y) to get the positions of the mouse, avoid using event::button: ![]() event::button::y since they're just much slower, plus you have to pass the event structure around each time. Hopefully this was of some help, Creature |
||||||||||||
|
![]() |
jerky/jittering mouse movement | ![]() |
asd1234qwerty at gmail...
Guest
![]() |
![]() |
Creature wrote:
It's not about cursors, the mouse is hidden and grabbed. It's about getting accurate movement data from SDL, which seems to be bugged. SDL_Delay(2) didn't do anything but lagged the game at the event system polls by 2msec every frame.
Using events, SDL_GetRelativeMouseState(dx, dy) or SDL_GetMouseState(x, y) yielded exactly the same data, and I wouldn't even expect that such would differ.
Oh well, thanks anyway. Update: as keyboard keys seem to randomly chop down mouse movement, mouse clicks also have the effect tempering with it, but in contrast, they mostly increase movement. Some thought that on slow computers this effect originated from the relatively small SDL event queue, in which events were simply dropped. In my test case, I have changed MAXEVENTS from 128 to 16384 to make sure that the queue will never fill up. |
||||||||||||||||||
|
![]() |
jerky/jittering mouse movement | ![]() |
asd1234qwerty at gmail...
Guest
![]() |
![]() |
Short on replies I've looked into the SDL code and traced the "chopped
data" coming from the window manager. WinMessage() receives inaccurate data from lParam along with WM_MOVEMOUSE. I tried to use the GetCursorPos() method to see if it differs, and surprisingly it does seem to get the accurate data. Attached is a patch showing what I did. With it, there is no more distortion in the mouse movement. I still don't know why this works better, there's nothing about this on MSDN. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: sdl-wm_movemouse.patch URL: <http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20080718/7e03e8fb/attachment.txt> |
||||||||||
|