Sign in to follow this  
The Lion King

Resolution Independent Programming

Recommended Posts

What is the best way to do resolution independent programming. - When in FullScreen mode we change resolutions, how are we suppose to draw the objects in the bigger resolution (let's say from 800x600 to 1024x768). Objects are obviously small and the screen size and space increases along with resolution increase. - Second in Windowed mode, if the user resizes the Window, how can you resize the objects along with the proportion of the window size? Any clues or hints are welcome :)

Share this post


Link to post
Share on other sites
use the window sizes for this. Like Rectangle from current window center (w/2, h/2) that extends out from center by 75%(center + (w/2)*75%, etc), instead of programming in constant values such as rectangle at (128, 128, 512, 384).


Hope that helped

Share this post


Link to post
Share on other sites
If all of your objects are represented using coordinates relative to window/screen size, instead of absolute coordinates, then much of this will become easy. Just make everything go from 0.0 (one edge of the window/screen) to 1.0 (the opposite edge). Values above or below this would be beyond the edge of the window/screen. If you need to keep track of the window/screen ratio (width/height), however, I suppose it gets a bit more complicated, but the above method will still be a large part of the solution.

So if everything is in those relative coordinates, then you only need to calculate actual screen coordinates during the very last step, in order to get the objects onto the screen. Or if you're using a 3D API, you should be able to set up the projection matrix to handle that for you, and you'll never have to worry about it during drawing at all.

Share this post


Link to post
Share on other sites
Yes ... I am using the same thing as coordinates. Top left of the Window is 0 while top right depends upon the size ... if its 800, then 800 etc.

I think it would be great to not to re-size all the objects in the game with resolution increase. I would rather show some bigger world space then an ordinary 800x600.

That will work.

Thanks!

Share this post


Link to post
Share on other sites
Essentially you map the coordinates like everybody said, but for 2d data (HUD in 3d games or everything in 2d games) games usually include 2 or 3 versions of all the graphics (for say 800*600, 1152*864, 1600*1200) and then it will stretch the graphic closest to the current resolution (or maybe even blend between the one below and one above).

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this