Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: RickJ on Sun 13/03/2005 01:27:08

Title: Detect mouse outside of game window?
Post by: RickJ on Sun 13/03/2005 01:27:08
When running a game in window mode, how can I detect if the mouse cursor has been positioned outside the AGS game window?   
Title: Re: Detect mouse outside of game window?
Post by: Rui 'Trovatore' Pires on Sun 13/03/2005 01:52:01
I doubt you can. At least in AGS. Like, AGS has total and unrivalled power of the game itself, but the area outside the window is the OS' domain, not AGS'.
Title: Re: Detect mouse outside of game window?
Post by: Esseb on Sun 13/03/2005 02:49:48
Not sure if you can, but you can always have the one pixel wide border of the game screen be "off-screen", and if the cursor is there, do your magic. This is assuming the cursor is in fact positioned there when it moves outside, and not somewhere else crazy if you move it fast enough.
Title: Re: Detect mouse outside of game window?
Post by: RickJ on Sun 13/03/2005 04:55:49
I'd like to turn-off the in-game cursor when the user mouses out of the game window.   I tried what you suggest Esseb but it's not reliable.  If the mouse is moving fast enough the in-game cursor get's left behind and so you never see it in the end zone (I've tried with an adjustable border).   

Too bad there is not an event or built-in variable or something.   I was just wondering if anyone knew a trick or something.   :=
Title: Re: Detect mouse outside of game window?
Post by: YOke on Sun 13/03/2005 10:41:41
This is sort of a twist on what Esseb was suggesting.
I guess you can use a cursor image with lots of blank space on all sides and then use the ChangeCursorHotspot command to offset the cursor graphics when the mouse is placed at the edges of the screen.
Title: Re: Detect mouse outside of game window?
Post by: SSH on Sun 13/03/2005 10:48:32
How about amking your game run full screen but making it LOOK like its running in a window  ;)
Title: Re: Detect mouse outside of game window?
Post by: Pumaman on Sun 13/03/2005 15:32:48
This isn't currently possible to do. Support for this could be added to AGS in future, but it's rather a specialized request and I don't know that I could justify it.

A plugin could probably deal with this if you want to go down that route.
Title: Re: Detect mouse outside of game window?
Post by: Pod on Sun 13/03/2005 15:40:00
Why not just add an option to lock the cursor to the window?  Doxbox does it!
Title: Re: Detect mouse outside of game window?
Post by: Gilbert on Mon 14/03/2005 02:50:32
Actually the problem was that AGS can be run fullscreen (which should be default for most games), which makes that function not very useful in some cases.
In my opinion, running the game windowed is just an alternate display method (not really meant to make a game play differently), as teh cursor can never go beyond the AGS area in fullscreen, so the current implementation of keeping the AGS gane cursor on the edge of teh window when the actual window cursor move away is okay in my opinion.

I don't quite like the way DOSBOX captures the mouse in windowed mode actually, in my opinion it would be even better if it can use the same way as AGS does.
Title: Re: Detect mouse outside of game window?
Post by: Pod on Tue 15/03/2005 17:33:09
Really? I prefer it, it means I don't "overshoot" the window, as I did so much with AGS.