Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Moving camera, when mouse hits border.

Author
Message
inthepast
15
Years of Service
User Offline
Joined: 12th Feb 2009
Location:
Posted: 17th Feb 2009 14:02
Hey.. Just trying to get my head around something,

I want move my camera when my mouse hits the sides of the screen.. in the direction that the mouse hit. Example, Warcraft 3. Just wondering if there was a way I could border my screen with lines and each time the mouse moves on or over them the camera would move that way until the cursor is lifted off the line.

Or maybe impossible on GDK? Surely Not

Thanks in advance.
Gatorules
15
Years of Service
User Offline
Joined: 17th Dec 2008
Location:
Posted: 17th Feb 2009 17:53 Edited at: 17th Feb 2009 17:54
i believe you can, but ive never tested it, say:



just replace the edgesofscreen in the code with the coordinates of the edges on the screen, kinda obviously
jezza
16
Years of Service
User Offline
Joined: 8th Mar 2008
Location: Bham, UK
Posted: 17th Feb 2009 19:01
And how would you get mouse position? because AFAIK all the commands are relative (like mouse move). Other option would be to have some objects aligned with side of screen, and use pick object to see if mouse is over them.
prasoc
15
Years of Service
User Offline
Joined: 8th Oct 2008
Location:
Posted: 17th Feb 2009 21:47
dbMouseX() and dbMouseY()
jezza
16
Years of Service
User Offline
Joined: 8th Mar 2008
Location: Bham, UK
Posted: 17th Feb 2009 23:09
My bad xD.
inthepast
15
Years of Service
User Offline
Joined: 12th Feb 2009
Location:
Posted: 18th Feb 2009 10:56
Cheers guys.. Got it working.

Login to post a reply

Server time is: 2024-09-30 17:21:28
Your offset time is: 2024-09-30 17:21:28