support a case where width, height and ratio in params are all zeros

This commit is contained in:
Sebastian Krzyszkowiak 2019-03-29 21:26:25 +01:00
parent deb38e778c
commit 834b1028f5
No known key found for this signature in database
GPG key ID: E8F235CF3BDBC3FF

View file

@ -713,7 +713,10 @@ SYMBOL_INTERNAL void SetupViewport(struct Game* game) {
game->_priv.window_width = al_get_display_width(game->display);
game->_priv.window_height = al_get_display_height(game->display);
if ((game->viewport.width == 0) || (game->viewport.height == 0)) {
if (game->viewport.width == 0 && game->viewport.height == 0) {
game->viewport.width = game->_priv.window_width;
game->viewport.height = game->_priv.window_height;
} else if (game->viewport.width == 0 || game->viewport.height == 0) {
game->viewport.height = al_get_display_height(game->display);
game->viewport.width = (int)(game->_priv.params.aspect * game->viewport.height);
if (game->viewport.width > al_get_display_width(game->display)) {