Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
DevastatioN

Mouse in SDL Ports (Choco, EE, Odamex, PRBoom)

Recommended Posts

Grader said:

So you are saying that when WINDIB is used there's no way around to "free" the cursor?

It's possible to make it differently. PrBoom uses that method and that's because its behavior is different.

prboom.bat
SET SDL_VIDEODRIVER=windib
prboom.exe


But if you do not use this (current) technique:

SDL_GetRelativeMouseState(&x, &y);
D_PostEvent(ev_mouse, x, y);
SDL_WarpMouse(centerx, centery);

then mouse movements will be awful. PrBoom still has it. After I discovered why SDL mouse movement is so laggy in some situations (more correctly: I discovered how to fix, not why it happens) I recoded it in current way and most (all?) SDL-based ports have stolen that. You can find few topics about that here.

Current behaviour is much better, because mouse movement is smoother.

Share this post


Link to post
Grader said:

Yep. It's still has it.
But I guest it's fine, since you always can set 1280x1024 and/or lower mouse resolution...
And maybe add this to FAQ...

My bad :(
Misunderstood you. mouse_accumulate_motion is added and set to 0 by default.
Setting it to 1 DID help!
You did it, man, thanks! :)

Share this post


Link to post

My guess is - you changed the code so that calling SDL_GetRelativeMouseState(&x, &y) and centering the mouse is done more often and results are accumulated untill next calling of D_PostEvent(&ev), right?

Share this post


Link to post
Grader said:

My guess is - you changed the code so that calling SDL_GetRelativeMouseState(&x, &y) and centering the mouse is done more often and results are accumulated untill next calling of D_PostEvent(&ev), right?

Yes. I do it each frame in case of uncapped framerate and instead of sleep(ms_to_next_tick) in case of capped framerate

http://pastebin.org/335903

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×