Posted By
|
Message
|
Ecstazy
Registered 04/01/2002
Points 179
|
4th December, 2008 at 10:54:40 -
I'm trying to make the mouse reposition at a certain area of the game's window, at first I thought it would be really easy by just using the mouse extension on MMF2 and setting the actual X and Y, but then I realized those X and Y values are relative to the monitor and not the game's window, so if I set the mouse to 0,0 for example, it wouldn't set it at the top left edge of the playfield but at the top left edge of the entire screen.
My way of thought is pretty much effective only on full screen games, and if you're scrolling there's some more math involved.
Is there any way to position the mouse relative to the actual game coordinates? I was looking around in the expression editor, hoping to pull off something like "Position of screen plus wherever I want the mouse", but couldn't find something like that.
Amongst Strangers
http://www.create-games.com/project.asp?id=1445
|
Silveraura God's God
Registered 08/08/2002
Points 6747
|
4th December, 2008 at 11:10:42 -
You should be able to use a Window extension to find the position of the top and left sides of the screen. That should give you a value to 0 in on, and add too when positioning the mouse.
http://www.facebook.com/truediamondgame
|
Ecstazy
Registered 04/01/2002
Points 179
|
4th December, 2008 at 19:00:24 -
Thanks, works great with the Window Control object.
Amongst Strangers
http://www.create-games.com/project.asp?id=1445
|
Pixelthief Dedicated klik scientist
Registered 02/01/2002
Points 3419
|
4th December, 2008 at 20:00:55 -
Remember that the windows control object will give you the X/Y position on the desktop of the top left of the entire program's window, INCLUDING menu bar, windows bar, frame around the game, etc. If you want to find the actual X/Y of a location on the window exactly, you either have to disable all menus/title bars/frames, or do some more complicated stuffs
Gridquest V2.00 is out!!
http://www.create-games.com/download.asp?id=7456
|
Ecstazy
Registered 04/01/2002
Points 179
|
5th December, 2008 at 16:00:56 -
Yeah I noticed, I did something that works in my Windows shell but I don't know how accurate it'll be on different shells or versions of Windows (if I recall correctly Vista has a thinner title bar).
Amongst Strangers
http://www.create-games.com/project.asp?id=1445
|
RedEnchilada formerly RedEchidna
Registered 01/08/2008
Points 301
|
6th December, 2008 at 15:10:28 -
I'm not sure of the actual wording, but ActualX("Mouse Object")-Xmouse should get the position of the top-left corner of the screen. Just add that when you need to move it.
Edit: Of course, change the Xes to Ys when you need the Y position.
Edited by RedEnchilada
http://www.youtube.com/watch?v=WYrSD35vHo4
woooooooooooooooooaah maaaaaaaaaaaaaaaaaaaaan
|
|
|