Sign in to follow this  
MARS_999

Screen size changes and HUD positions

Recommended Posts

How is everyone dealing with screen size changes and the positions of their HUD components? I am doing screenWidth * .9 and as you know this doesn't work to hot when you have a 1920 width vs. 800 wide. The locations are the same. Are most people just hard coding in the positions and set the HUD locations based on the users desired screen resolution? Thanks

Share this post


Link to post
Share on other sites
Quake 3 made everything in 640x480 and then scaled it up to the desired resolution. Not that this is the best solution, but scaling is still the key IMO.
I think you might need to deal with all the 4:3, 16:9 and 16:10 aspect ratios to get it perfect. Nonetheless, to get the HUD to look sharp in all resolutions, you could make one for each aspect ratio in the aspect's highest available resolution (presumeably 2560x1920 for 4:3, but this is for you to decide) and scale it down to the normal resolutions. This will use more memory, yes, but the problem with typical HUD's are that they cannot be assembled by 8-9 pieces of scalable textures or drawed with vector graphics as main menus or Win32 controls can. The problem with this is that you need to decide on the highest resolution for each aspect ratio, so, naturally, some SLI/CF people will play it at higher resolutions, unless you limit this option yourself, and will have to live with an upscaled version of the HUD.

Share this post


Link to post
Share on other sites
My GUI system has a virtual screen size of 640x480. At aspect ratios other than 4:3 (16:9 or 16:10 etc.) the horizontal bounds of the virtual screen are extended left and right, with the 640x480 area remaining in the middle of the screen.

For example, at a resolution of 1280x800 the virtual screen size is calculated as follows:
Aspect ratio = 16:10
Virtual width = aspect ratio * 480 = 768
left = -((768 - 640) / 2) = -(128 / 2) = -64
right = 640 + ((768 - 640) / 2) = 640 + (128 / 2) = 704

Final virtual screen bounds:
left: -64
right: 704
top: 0
bottom: 480

Controls can be docked to the sides of the screen allowing for full screen backgrounds (dock to the left and right), or to keep HUD elements in the corners of the screen. If a control is docked its position is used to offset it from the side of the screen to which it is docked.

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