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 / How is the "world" defined in percentage mode?

Author
Message
Eqqman
4
Years of Service
User Offline
Joined: 15th Jul 2015
Location:
Posted: 19th Aug 2015 10:08 Edited at: 19th Aug 2015 21:35
I'm working on a project that uses an isometric hex grid. using a virtual display, I can identify a hex from a given pixel. However, my routines don't work in the percentage system because I don't know how to convert the values I get from ScreenToWorld() into a pixel.

In the screenshot below, I have the mouse pointer near the bottom right of the screen. The first pair of floats is the (x, y) screen location of the mouse. The second pair of floats is the result I get from using ScreenToWorld(GetPointer()). So 99% of the screen X corresponds to 92% of something... but what exactly?



Goo Goo G'Joob!

Attachments

Login to view attachments
baxslash
Valued Member
Bronze Codemaster
12
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 19th Aug 2015 15:02
Can't see your screenshot... you can attach screenshots to your post and then edit your post to reference the image using the "image" button.

You have 2 options:
1-Don't use the percentage system. Use SetVirtualResolution instead
2-Calculate the size of a pixel in x and y


Using AppGameKit V2 Tier 1
Eqqman
4
Years of Service
User Offline
Joined: 15th Jul 2015
Location:
Posted: 19th Aug 2015 21:31 Edited at: 19th Aug 2015 21:35
Quote: "Can't see your screenshot... you can attach screenshots to your post and then edit your post to reference the image using the "image" button."

Thanks for the tip, I'll try it. I normally host my pictures in DropBox and link to that, but I've been having difficulty getting them to display. I don't know if the issue is this forum or DropBox, which has changed a bit since the last time I was heavily putting images in forum posts.

I want to keep the percentage system since I can guarantee that my app is full-screen no matter what size device is used, and I have code in place to make sure that if a graphic is a certain size, it remains that size no matter what aspect ratio is present. I'm very happy with the results except for the occasional hiccup like this. I'll try your suggestion for calculating pixel sizes- currently I'm deriving pixel locations from the known size of the background (which may or may not be larger than the screen) but that process is breaking down in this case.

EDIT: Fixed the picture, thanks for the tip!

Goo Goo G'Joob!

Login to post a reply

Server time is: 2019-07-20 02:45:48
Your offset time is: 2019-07-20 02:45:48