# Screen size changes and HUD positions

This topic is 3695 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## 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 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 on other sites
Or if you want a challenge you could go for vector graphics, no such clarity-at-different-resolutions problems there.

##### Share on other sites
What about a virtual coordinate system? :)

##### 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:10Virtual width = aspect ratio * 480 = 768left = -((768 - 640) / 2) = -(128 / 2) = -64right = 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.

1. 1
2. 2
JoeJ
20
3. 3
frob
19
4. 4
5. 5

• 10
• 10
• 12
• 13
• 9
• ### Forum Statistics

• Total Topics
632199
• Total Posts
3004733

×