Mouse handling with screens

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
wombats
Enthusiast
Enthusiast
Posts: 716
Joined: Thu Dec 29, 2011 5:03 pm

Mouse handling with screens

Post 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.
void
Enthusiast
Enthusiast
Posts: 116
Joined: Sat Aug 27, 2011 9:50 pm
Location: Washington, USA

Re: Mouse handling with screens

Post 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.
wombats
Enthusiast
Enthusiast
Posts: 716
Joined: Thu Dec 29, 2011 5:03 pm

Re: Mouse handling with screens

Post 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.
void
Enthusiast
Enthusiast
Posts: 116
Joined: Sat Aug 27, 2011 9:50 pm
Location: Washington, USA

Re: Mouse handling with screens

Post 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.
PMV
Enthusiast
Enthusiast
Posts: 727
Joined: Sat Feb 24, 2007 3:15 pm
Location: Germany

Re: Mouse handling with screens

Post 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
wombats
Enthusiast
Enthusiast
Posts: 716
Joined: Thu Dec 29, 2011 5:03 pm

Re: Mouse handling with screens

Post 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.
void
Enthusiast
Enthusiast
Posts: 116
Joined: Sat Aug 27, 2011 9:50 pm
Location: Washington, USA

Re: Mouse handling with screens

Post 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.
Post Reply