Using Allegro 5, how do initialize a game in fullscreen mode so that it respects the format of the screen (widescreen 16:9 vs normal 3:4)
al_create_display (w, h)
Let’s you select any ratio you want. For example you can set 640×480, regardless of the screen size. But it will look weird on a widescreen monitor.
How do you know which ratio to use?
Hm, I can answer this as well – use
al_get_monitor_info().Now you can either render everything in a 640×480 rectangle centered within 1366×768 to make it appear pixel-perfect, or alternatively scale your graphics up by 768/480 and keep two black bars to the left and right. If you use OpenGL for rendering, both are very easy to do by simply altering the projection matrix.