Forum

Framerate-Dependent Mouse Turn Speed?

Discuss programming topics for any language, any source base. If it is programming related but doesn't fit in one of the below categories, it goes here.

Moderator: InsideQC Admins

Framerate-Dependent Mouse Turn Speed?

Postby jitspoe » Sat Oct 05, 2013 10:53 pm

I'm not sure if this is specific to Windows 7, but I just noticed that, when running at 60+fps, everything seems to be fine - the mouse does not have accel and appears to turn the player consistently. If I run at a lower framerate, however, the player turns slower, especially when moving the mouse rapidly.

I'm using this:

SystemParametersInfo(SPI_SETMOUSE, 0, newmouseparms_noaccel, 0);

to make sure accel is disabled. I'm pretty sure I have accel disabled in the windows settings as well.

Is there a better way to get mouse input than the old GetCursorPos()/SetCursorPos()? I know it can be done with Direct Input somehow, but I seem to recall something about DirectInput not working in some cases, rendering the mouse movement not functional.
jitspoe
 
Posts: 217
Joined: Mon Jan 17, 2005 5:27 am

Re: Framerate-Dependent Mouse Turn Speed?

Postby jitspoe » Sun Oct 06, 2013 12:14 am

Figured out what the issue is. When running with a low framerate, the mouse cursor can reach the edge of the screen, causing "negative accel" because the cursor is clipped to the window size.
jitspoe
 
Posts: 217
Joined: Mon Jan 17, 2005 5:27 am

Re: Framerate-Dependent Mouse Turn Speed?

Postby Spike » Sun Oct 06, 2013 12:02 pm

your newmouseparms_noaccel should be {0,0,0}.
some quake-derived engines use {1,0,0} which will double the speed without any acceleration on xp, but still allows a small amount of acceleration in vista+.

last I heard rawinput is the favoured input api on windows, but is only available from XP upwards (not 2k/9x).
you can query all sorts of devices, but beware that a few are reported twice as amalgamations of other devices.
multitouch devices on tablets can be supported with it too, but you need to parse the HID messages yourself.
I've no idea what apis they've left uncrippled in winrt, I don't really care either.
Spike
 
Posts: 2881
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Re: Framerate-Dependent Mouse Turn Speed?

Postby jitspoe » Sun Oct 06, 2013 7:43 pm

Yeah, the params are 0, 0, 0. Like I said, the problem turned out to be the cursor clipping since I was playing in a small window with a low framerate. I'm still going to investigate implementing raw input, though. On Windows, this is done with WM_INPUT and GetRawInputData: http://msdn.microsoft.com/en-us/library/ee418864(VS.85).aspx#WM_INPUT

Anybody know the best way to get raw mouse input on linux natively (without SDL or other libraries)?

Reading around, I'm kind of curious what Valve did wrong with their raw input implementation. I see a lot of complaints about it, ex: http://www.reddit.com/r/GlobalOffensive ... ut_faulty/
jitspoe
 
Posts: 217
Joined: Mon Jan 17, 2005 5:27 am

Re: Framerate-Dependent Mouse Turn Speed?

Postby jitspoe » Tue Oct 08, 2013 6:37 am

Using the code from the msdn link in my previous post seemed to work just fine. Still need to find a Linux solution.
jitspoe
 
Posts: 217
Joined: Mon Jan 17, 2005 5:27 am


Return to General Programming

Who is online

Users browsing this forum: No registered users and 1 guest