Making a game with responsive resolution
- by alexandervrs
I am making a game, however I wish for it to be resolution agnostic.
My target resolution i.e. where things look as intended is 1600 x 900.
My ideas are:
Make the HUD stay fixed to the sides no matter what resolution, use different size for HUD graphics under a certain resolution and another under a certain large one.
Use large HD sprites/backgrounds which are a power of 2, so they scale nicely.
Use the player's native resolution. Scale the game area (not the HUD) to fit (resulting zooming in some and cropping the game area sides if necessary for widescreen, no stretch), but always fill the screen.
Have a min and max resolution limit for small and very large displays where you will just change the resolution(?) or scale up/down to fit.
What I am a bit confused though is what math formula I would use to scale the game area correctly based on the resolution no matter the aspect ratio, fully fit in a square screen and with some clip to the sides for widescreen.
Pseudocode would help as well. :)