i am currently writing a 2D Platformer with Java and LWJGL. I am at the point where i want to display a hud - for displaying player lives, score, etc. and render an UI for my integrated level editor.
The game is designed to run with every screen resolution, the entire orthographic projection is scaled and positioned with a simple factor based on the designed screen size and current screen size. No need to calculate ratio, add cinematic borders, etc. Not sure if that is the correct way for handling different screen resolutions but works for my game, cause the camera is always centered on the player and zoomed based on the above factor.
But how to design/render and UI/HUD for my game which works my different screen resolutions too, i havent figured that out yet.
If i use a fixed screen size for hud/ui rendering everything will be fine, until the screen resolution is changed to an different aspect ratio, for example switching from 4/3 to 16/9 will stretch rendering. But switching from 800 x 600 to 1600 x 1200 will work fine.
Is there a good explanation how to design/render HUD´s for different screen resolutions / aspect ratios?
Here is a small video for showing the current handling of the zoom based on screen size:
Thanks in advance, Final