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.

Newcomers AppGameKit Corner / Mouse world coordinates after SetViewZoom

Author
Message
Scotty1973
AGK Backer
13
Years of Service
User Offline
Joined: 2nd Jun 2011
Location: Burton-on-Trent, uk
Posted: 15th May 2016 23:11
Hi

I have been using the mouse to select sprites and position them in world coordinates after using SetViewOffset() by using
mouse.screenx=getpointerx()
mouse.Screeny=getpointery()
mouse.worldx=GetViewOffsetX() + mouse.screenx
mouse.worldy=GetViewOffsetY() + mouse.Screeny

This has worked well, but I was experimenting with the SetViewZoom function and this obviously alters my world mouse coordinates.

Is there a way to get the mouse world coordinates after zooming in or out?

Many thanks

Scotty
CJB
Valued Member
20
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Essex, UK
Posted: 19th May 2016 11:41
Try:

ScreenToWorldX(getpointerx())
and
ScreenToWorldY(getpointery())

V2 T1 (Mostly)
Phone Tap!
Uzmadesign

Login to post a reply

Server time is: 2024-11-24 00:17:53
Your offset time is: 2024-11-24 00:17:53