Mouse Controller options
Moderators: winston, another_commander
Mouse Controller options
I tried out the Mouse Control feature of Oolite today. I have some suggestions. First of all, Most Mice today have a scroll wheel. Why not make this control the speed? And second, many mice have web navigation buttons on the side. They're just two small buttons where the thumb can easily get to them. How about linking them to the Torus drive and the fuel injectors?
-
- Quite Grand Sub-Admiral
- Posts: 6680
- Joined: Wed Feb 28, 2007 7:54 am
Re: Mouse Controller options
Mouse wheel controlling speed when mouse control is active is coming up.
As for the other mouse buttons, sorry. I don't have a new fancy mouse here so I cannot test at all. It should be possible to do though, although the question then becomes: why torus and injectors and not something else.
As for the other mouse buttons, sorry. I don't have a new fancy mouse here so I cannot test at all. It should be possible to do though, although the question then becomes: why torus and injectors and not something else.
- gsagostinho
- ---- E L I T E ----
- Posts: 573
- Joined: Sun Jul 19, 2015 1:09 pm
Re: Mouse Controller options
Great news! I am another mouse commander so I am really looking forward to thisanother_commander wrote:Mouse wheel controlling speed when mouse control is active is coming up.
-
- Quite Grand Sub-Admiral
- Posts: 6680
- Joined: Wed Feb 28, 2007 7:54 am
Re: Mouse Controller options
You should be able to test it in tomorrow's build.
Note: Not available for Mac, since mouse wheel support has not yet been coded in for this platform.
Note: Not available for Mac, since mouse wheel support has not yet been coded in for this platform.
- gsagostinho
- ---- E L I T E ----
- Posts: 573
- Joined: Sun Jul 19, 2015 1:09 pm
Re: Mouse Controller options
Great, I will give it a try and report any issues. Many thanks.
- gsagostinho
- ---- E L I T E ----
- Posts: 573
- Joined: Sun Jul 19, 2015 1:09 pm
Re: Mouse Controller options
Working like a charm, thanks for yet one more new feature!another_commander wrote:You should be able to test it in tomorrow's build.
- Cody
- Sharp Shooter Spam Assassin
- Posts: 16081
- Joined: Sat Jul 04, 2009 9:31 pm
- Location: The Lizard's Claw
- Contact:
Re: Mouse Controller options
<nods>Working like a charm...
I would advise stilts for the quagmires, and camels for the snowy hills
And any survivors, their debts I will certainly pay. There's always a way!
And any survivors, their debts I will certainly pay. There's always a way!
Re: Mouse Controller options
So make it configurable. I said Torus and Fuel injectors because that would allow for almost keyboard-less flight. Someone else though may want to use them to arm and fire missiles, or who knows what else.another_commander wrote: ↑Sat Jul 22, 2017 11:37 amMouse wheel controlling speed when mouse control is active is coming up.
As for the other mouse buttons, sorry. I don't have a new fancy mouse here so I cannot test at all. It should be possible to do though, although the question then becomes: why torus and injectors and not something else.
As for fancy mouses, I saw several cheap mouses yesterday at Walmart that had the 2 side buttons. They are usually programmed for web navigation.
- Norby
- ---- E L I T E ----
- Posts: 2577
- Joined: Mon May 20, 2013 9:53 pm
- Location: Budapest, Hungary (Mainly Agricultural Democracy, TL10)
- Contact:
Re: Mouse Controller options
I bought mine in a local megastore (Auchan) with Laser sensor (2000dpi), two additional buttons on left side and was only $7. Thank you China!
- gsagostinho
- ---- E L I T E ----
- Posts: 573
- Joined: Sun Jul 19, 2015 1:09 pm
Re: Mouse Controller options
In the meantime, you can also use a program to assign a keyboard key to a mouse button. On Linux, you can use xbindkeys, and I am sure something like this exists also for Windows and OS X.byronarn wrote:So make it configurable. I said Torus and Fuel injectors because that would allow for almost keyboard-less flight. Someone else though may want to use them to arm and fire missiles, or who knows what else.
Re: Mouse Controller options
I can implement this for Mac, but how is it supposed to work?another_commander wrote: ↑Sat Jul 22, 2017 7:17 pmNote: Not available for Mac, since mouse wheel support has not yet been coded in for this platform.
When I get a scrollWheel event, it comes with a delta, which has greater values when turning the wheel faster. But the interface is such that I can only report up/down/neutral.
I can make it so that if I get a larger delta, it keeps reporting up/down longer before it starts reporting neutral again. But this means lag.
If I don't, it takes a lot of scrolling to go from stationary to full speed.
Alternatively, I can make it so that when you 'nudge' up or down from neutral, it keeps reporting that direction until you nudge in the opposite direction, and then go back to neutral, essentially making the wheel a 3-position rocker switch.
[EDIT} The rocker switch approach would be horrible for chart zooming though.. [/EDIT]
-
- Quite Grand Sub-Admiral
- Posts: 6680
- Joined: Wed Feb 28, 2007 7:54 am
Re: Mouse Controller options
This part from the SDL library source shows how it is supposed to work on Windows:
The variable
Actually using the delta value could be a good idea, but it means that we would have to rebuild SDL for Windows (and most probably Linux too) to somehow keep track and return also the value of
Code: Select all
case WM_MOUSEWHEEL:
if ( SDL_VideoSurface && ! DINPUT_FULLSCREEN() ) {
int move = (short)HIWORD(wParam);
if ( move ) {
Uint8 button;
if ( move > 0 )
button = SDL_BUTTON_WHEELUP;
else
button = SDL_BUTTON_WHEELDOWN;
posted = SDL_PrivateMouseButton(
SDL_PRESSED, button, 0, 0);
posted |= SDL_PrivateMouseButton(
SDL_RELEASED, button, 0, 0);
}
}
move
contains the delta value of the mousewheel movement, but as you can see it is not used for anything other than determine whether the wheel was moved up or down. This is what is returned to the game and this is basically why the game interface is designed with three states in mind: up, down or neutral. I guess that in order to make it behave the same on the Mac, you just need to handle it similarly, i.e. if delta > 0 send a wheel up state, if delta < 0 send a wheel down and if delta == 0 send state neutral.Actually using the delta value could be a good idea, but it means that we would have to rebuild SDL for Windows (and most probably Linux too) to somehow keep track and return also the value of
move
above.Re: Mouse Controller options
Thanks. That looks simpler than what I came up with in the mean time.
Please have a look at this: https://github.com/jobi-wan/oolite/comm ... 6401c4322d
It takes into account the delta-Y of the scroll wheel event, and for damping it takes into account the delta-T of the game tick.
I tried to do a best-of-both-worlds: the delta determines how long it keeps reporting up/down, but moving in the opposite direction resets it immediately, much like the keyboard controls do, although these obviously don't have a delta.
(I have a plane to catch [no, not Delta ] and will probably not be able to respond until later tomorrow.)
Please have a look at this: https://github.com/jobi-wan/oolite/comm ... 6401c4322d
It takes into account the delta-Y of the scroll wheel event, and for damping it takes into account the delta-T of the game tick.
I tried to do a best-of-both-worlds: the delta determines how long it keeps reporting up/down, but moving in the opposite direction resets it immediately, much like the keyboard controls do, although these obviously don't have a delta.
(I have a plane to catch [no, not Delta ] and will probably not be able to respond until later tomorrow.)
-
- Quite Grand Sub-Admiral
- Posts: 6680
- Joined: Wed Feb 28, 2007 7:54 am
Re: Mouse Controller options
From a very quick look, it appears functional, but I am not sure about the GameController entry, maybe that needs to be guarded with #ifdef for Mac-only use.
We can take a closer look at this once 1.86 is out. This could be the first 1.87 feature.
We can take a closer look at this once 1.86 is out. This could be the first 1.87 feature.
Re: Mouse Controller options
Yes, this does not compile where gameView has no updateControls. #if OOLITE_MAC_OS_X -ing it would make it compile.
But it would be nicer if I didn't need it at all.
Edit to add: This one is much more in line with the implementation on SDL:
https://github.com/jobi-wan/oolite/comm ... bb5d816b01
But it would be nicer if I didn't need it at all.
Edit to add: This one is much more in line with the implementation on SDL:
https://github.com/jobi-wan/oolite/comm ... bb5d816b01