Mouse ball values

Hi
We breifly touched on this subject before, but I’m nearing done on the linux version so I was hopeing for some clarification. Currently the windows version returns -1 to +1 for ball movement on the mouse, the problem with this is it is digital, imagine it used for mouselook (quake style) you would get very strange movemtn, you would be moving or not, no speed changes with change of mouse speed, it needs to be more analog, they way I have done this for the linux version is to add up all the values from the events at the native level and return that, this often ends up with much more variable values based on the speed the mouse is moved. I currently have this disabled so the linux version behaves the same as the windows one (whats the point in a port of an API if they play differently). I don’t know if its possible under direct input as I don’t know much about it, but it seems to me to make sense. What do others think?

Cheers

Endolf

I agree, after it was explained to me, that the Win32 mouse code is wrong and inadequate.

My suggestion is that it return a reasonable delta value that hopefully is scaled pretty much the same across all of our platforms.

E, GP, you agree?

If so I’ll take an action item to fix Win32 next week.

Hi
Let us know when you’ve done the windows version and I can flip the code over in the linux one, means the two version will remain consistant :). As for the values to return, with the wheel on my mouse I can feel it almost click round to positions, and i’m wondering if one position = +/-1 to the value in the next event that gets fired. I’m wondering if internally to the hardware there is something similar for the x and y axes. Most games that use the mouse have a mouse speed adjustment, which I suspect is because the different mice and different platforms return different values, I’m not sure how we could scale it anyway, what exactly is the maximum value from a mouse? :slight_smile:

Cheers

Endolf

P.S. whilst your at it, there are 5 buttons on my mouse, any ideas how to get the extra two to show up in the win32 jinput? Mouse.Buttons has room for them ;D

yeah while Im in there Ill look at the buttojns.

I don’t think there really is a max value for the mouse as every read should return a delta from the last value, which is to sya its a relative value rather then absolute value controller.

Hi
exactly, that was my point, I have no idea how we can arrange a set of values to return from the different platforms when we have no idea what values are min and max? :), I suggest we return what the native side gives us and suggest that games writers have a mouse sensitivity setting in their config somewhere that allows the user to change it, just like quake/half-life/unreal/…/… :slight_smile:

Comments?

Endolf

Again sounds sensible 8)

I agree. I will adapt to whatever you guys decide in that manner.

Note that on the OSX version every input element will know what its min and max is as well as what the scaled values are. HID provides a lot of information about every component.

If there is a need for all developers to adjust for mouse sensitivity, should we put some hooks in to make the adjustment in the JInput library… based on a setting from the application?

I’m just thinking that if there is going to be a “right” way to use mouse input, it might as well be implemented once in the library.

Hi
You saying that MouseBall should have something like setScale(float scale) and all returned values from float getPollData() are scaled by this amount?

Yes, something like that. I honestly don’t know what sort of numbers you would get back on each platform… but if that makes sense then sure. If platform specific defaults are set so that it looks approximately the same for Joe Coder regardless of the platform his code is running on that would be great.

Yeah, you’ll be able to do that with the OSX variant. I’ve spent some extra time to bring back everything from the OSX native HID libraries so that these adjustments/changes can be done in Java without me needing to go back into the native HID core since I feel so dirty after writing so much C (not even C++) code.

So unclean… so unclean…

[quote]If there is a need for all developers to adjust for mouse sensitivity, should we put some hooks in to make the adjustment in the JInput library… based on a setting from the application?

I’m just thinking that if there is going to be a “right” way to use mouse input, it might as well be implemented once in the library.
[/quote]
Hm. If we think its going to be availbale on all paltforms then we can define a shared MouseDevice super-type that has those controls on it.

Oterhwise Id say document it as part of your MouseDevice object and let the user down-cast to access it.

Hi
I think it should be part of the MouseBall coreAPI class, there is no point putting in plugin dependant things, no-one should use them as you then end up with different things happening on different platforms. I thought the whole point was to get something common across the platforms.

Cheers

Endolf

Normalizing mouse input is certainly something that can be cross platform and put in the core mouse API. A standard mouse under OSX has axis values that range from +/- 32767 as opposed to 0-1 so we just need to normalize on something and then we can scale the values from there.

Hi
The linux plugin an’t be normalised as it works at the moment, if queues all the underlying events up, that means if your framerate drops cause of gc or whatever, you will still see a full mouse movement, that means that there is no maximum value for mouse movements under linux, it depends on how far you moved it and how long it’s been since you last polled.

Unfortunately I don’t believe I can do that with the way the OSX HID system works. Every value that comes back from HID is pretty much listed in rawMin/rawMax, scaledMin/scaledMax and all I can do is give you whatever value is there. I can queue it up, but that’s kinda pointless for axis movement as it generates so many events that it doesn’t make sense to queue up several hundred of them. Button clicks however are another story. I queue up all keystrokes and button clicks because they are digital actions and I can’t lose those.