Friday, September 27, 2013

Resolution-Independent Coordinate System

Today, I'm thinking about UI issues.

I have dialogue displaying, but the basic layout was tied to the screen resolution (currently 1280x720, because it fits nicely on my 1920x1080 monitor in windowed mode).  I began wondering what an ideal "virtual" coordinate system would look like, where you just use one coordinate system and scale it for the actual screen resolution.

This causes some problems with fonts, which should really be rendered at screen resolution, so I'm leaving those out of the equation for now.  You can make some progress playing with point sizes, but in the end it probably won't be exactly the same on different resolutions.

So, what would a good "virtual" coordinate system look like? 

You could have 0..1 in each axis, but then you have to work with a lot of fiddly decimals, and that doesn't take into account aspect ratio.

I think ideally, the coordinates should divide evenly by a large number of primes so you can create symmetric divisions without requiring fractions.

You could maybe have something like 1600x900, which is good for a 16x9 aspect ratio.  1600 doesn't divide evenly by 3, though.

Since 1920x1080 is my target resolution, I decided to just go with that.  It's pixel-accurate at the target, and both divide evenly by multiple powers of 2, as well as 3 and 5.

 The rest of today consisted of a little bit of modeling, and I picked up my guitar for the first time in a couple months - I clearly need to get my hands back in shape again.  :)

No comments:

Post a Comment