Detect mouse outside of game window?

Started by RickJ, Sun 13/03/2005 01:27:08

Previous topic - Next topic

RickJ

When running a game in window mode, how can I detect if the mouse cursor has been positioned outside the AGS game window?   

Rui 'Trovatore' Pires

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'.
Reach for the moon. Even if you miss, you'll land among the stars.

Kneel. Now.

Never throw chicken at a Leprechaun.

Esseb

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.

RickJ

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.   :=

YOke

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.

Enlightenment is not something you earn, it's something you pay for the rest of your life.

SSH

How about amking your game run full screen but making it LOOK like its running in a window  ;)
12

Pumaman

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.

Pod

Why not just add an option to lock the cursor to the window?  Doxbox does it!

Gilbert

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.

Pod

Really? I prefer it, it means I don't "overshoot" the window, as I did so much with AGS.

SMF spam blocked by CleanTalk