Page 1 of 1

Mouse handling with screens

Posted: Sun Nov 11, 2012 12:23 pm
by wombats
Hi,

Would it be possible to make changes to how the mouse is handled with screens? I would like to simply use the standard system cursor in my game, but it doesn't seem to be possible. I know I can use the WindowMouseX, etc. functions with OpenWindowedScreen(), but this is not an option for full screen. I understand that the intention is for us to supply our own sprite as a cursor, but I would still really like to be able to use the standard system cursor.

Is there a reason the system cursor is hidden when using ExamineMouse()? Could we not have the option as to whether or not it should be hidden? (Such as a HideMouse(true) function.)

Also, unless I'm doing something wrong, I cannot get the mouse to leave the game window (OpenWindowedScreen()) to go to another application. It would be nice for this to be possible without having to make the user press a key to allow it.

I obviously don't know the reasoning behind the way PureBasic does it, and I'm sure there was a good reason, but it would be very nice to have more flexibility with regards to handling the mouse.

Thank you for considering these changes.

Re: Mouse handling with screens

Posted: Mon Nov 12, 2012 5:54 pm
by void
What you want is ReleaseMouse().

By default it captures the mouse, as that's the usual use case for most games, but you can release it if you want.

Re: Mouse handling with screens

Posted: Mon Nov 12, 2012 6:12 pm
by wombats
If I call ReleaseMouse() at the end of my main loop, then none of the mouse functions work. I understand about capturing the mouse, but I am requesting the ability to use the standard system cursor if I so desire.

Re: Mouse handling with screens

Posted: Tue Nov 13, 2012 3:28 am
by void
wombats wrote:If I call ReleaseMouse() at the end of my main loop, then none of the mouse functions work. I understand about capturing the mouse, but I am requesting the ability to use the standard system cursor if I so desire.
Look at the top of the mouse library documentation.

The way these mouse functions work prohibits the standard cursor being present; this is capturing the mouse. If you want the standard OS mouse cursor, then you have to interact with the OS closer to the way a normal application does. This means using WindowMouseX(), WindowMouseY() and EventType(), or using direct OS API calls.

Unfortunately, there is no middle ground. The game style mouse functions require mouse capturing.

Re: Mouse handling with screens

Posted: Tue Nov 13, 2012 1:14 pm
by PMV
wombats wrote:If I call ReleaseMouse() at the end of my main loop, then none of the mouse functions work. I understand about capturing the mouse, but I am requesting the ability to use the standard system cursor if I so desire.
like void said already ... but to be clear:
If you want to use the system-mouse ... just use it.
Already possible with WindowMouseX(), WindowMouseY()
and so on. If you want to use the DirectInput-Mouse, then
use that with MouseX(), MouseY() and so on.
:wink:

Feature already implemented :lol:

MFG PMV

Re: Mouse handling with screens

Posted: Tue Nov 13, 2012 1:45 pm
by wombats
And if I want to use the system mouse in full screen? It's possible in other engines. I can't use WindowMouseX(), etc. there, as I said in the first post. I don't see why it's necessary for PureBasic to force the capture of the mouse.

Re: Mouse handling with screens

Posted: Tue Nov 13, 2012 9:51 pm
by void
wombats wrote:And if I want to use the system mouse in full screen? It's possible in other engines. I can't use WindowMouseX(), etc. there, as I said in the first post. I don't see why it's necessary for PureBasic to force the capture of the mouse.
The feature request you want to make at this point is for an easier "windowed full screen" option, which would more readily permit using WindowMouseX() etc.

The thing you actually asked for, using the game mouse functions with the OS mouse in actual fullscreen, is not possible because that's not how the API provided to PureBasic works.

PureBasic cannot change that.