MouseXSpeed() and MouseYSpeed() functions?

BlitzMax Forums/BlitzMax Programming/MouseXSpeed() and MouseYSpeed() functions?

Wayward(Posted 2004) [#1]
Is there a way to read the fine-grained movement of the mouse before it gets translated into screen coordinates?

At first I thought I needed the MouseXSpeed() and MouseYSpeed() functions from Blitz3D (BlitzMax doesn't have them), but I went back to Blitz3D to test those functions and they were no more accurate than the MouseX() and MouseY() functions.


Phish(Posted 2004) [#2]
I'd like those functions, whether they're fine grained or not! I know it's possible to make them yourself, but isn't that meant to be the nice thing about Blitz?


LeisureSuitLurie(Posted 2004) [#3]
Geez, people. (mousex()-lastmousex)/timesincelasttimeireadthemouse


N(Posted 2004) [#4]
Lurie: The point is that Blitz should already have these functions- that's why people buy it. So they don't have to do unneccessary stuff such as this, but rather get straight to writing their game(s) or application(s),

It's not hard to write MouseXSpeed() or MouseYSpeed(), but they should have been included on release.


Wayward(Posted 2004) [#5]
I'm not asking for MouseXSpeed() and MouseYSpeed() functions that are limited to screen resolution (sorry, if the title of the thread mislead you). I'm asking if there's a way to read mouse movements at a finer resolution than screen pixels which I erroneously thought the Blitz3D MouseSpeed functions did.

DirectInput does what I'm after, according to the documentation: "The data returned for the x-axis and y-axis of a mouse indicates the movement of the mouse itself, not the cursor. The units of measurement are based on the values returned by the mouse hardware and have nothing to do with pixels or any other form of screen measurement."

Surely reading mouse movement with a high degree of accuracy would be helpful for BlitzMax programmers developing first-person shooters among other things? I need it to control a mouse pointer with sub-pixel precision as my sprites move smoothly but my mouse pointer jumps pixel to pixel. My current workaround is to fake sub-pixel accuracy by scaling (with acceleration) the pixel-based MouseX() and MouseY() values, but I'd prefer to work with more accurate mouse x and y values to start with.

I'd quite understand if high-resolution mouse functions aren't feasible due to cross-platform compatibility reasons.


flying willy(Posted 2004) [#6]
Now I would like more information on this please.

Seems clear that it would benefit.


skidracer(Posted 2004) [#7]
I had a look at adding them at the time MoveMouse got added. There were enough issues/gotchas with MoveMouse across platforms that supporting MouseSpeed in brl.system beyond the example code for MoveMouse didn't seem sensible.

However pub.freejoy seems a more suitable place for supporting the use of the mouse as a game input device. The lowlevel USB device stuff for Mac is already in there and some DirectInput support for Windows is in the works...

I was also thinking of adding support for a joystick device that works off arrows/ctrl/alt keys so a mouse device would seem to complement this approach also. The keyboard joy device seemed a good idea after I found emulating a gamepad is suprisingly difficult (release the up and left keys together and your player is always left facing up or left and not the diagonal direction you were just walking in).


ImaginaryHuman(Posted 2004) [#8]
Oh, cus it's sequential?


Dreamora(Posted 2004) [#9]
skid: then your gamepad must be quite old if it hasn't even 8 way controls ...


Wayward(Posted 2004) [#10]
Thanks, Skidracer. I'm just happy to know these matters are being considered.

Dreamora: Skidracer was talking about emulating a joystick with the keyboard.