Jump to content
Sign in to follow this  
marceldev89

[UI] Algorithm behind safeZoneX/Y/W/H

Recommended Posts

Hi,

I'm looking for the algorithm behind the safeZoneX/Y/W/H variables. I know there's a bunch of things involved in getting those values like aspect ratio, resolution, interface size, absolute positioning and probably more but I couldn't come up with how it's actually calculated.

I'm convinced there must be someone here that does know this. :)

Share this post


Link to post
Share on other sites

It seems that I don't need the full algorithm anymore. :)

For those looking for this info in the future:

x = 0.28 * safezoneW + safezoneX;

y = 0.24 * safezoneH + safezoneY;

w = 0.117188 * safezoneW;

h = 0.542373 * safezoneH;

translates into (for a 1920 x 1200 resolution)

x = (0.28 * 1920)

y = (0.24 * 1200)

w = (0.117188 * 1920)

h = (0.542373 * 1200)

Apparently you can fully disregard safeZoneX/Y/W/H when positioning the controls using pixels.

Share this post


Link to post
Share on other sites

x = (_xPos/100) * safezoneW + safezoneX;
y = (_yPos/100) * safezoneH + safezoneY;
w = (_width/100) * safezoneW;
h = (_height/100) * safezoneH;

All values are from 0 to 100.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×