Cause scaling to always be square.

This commit is contained in:
onpon4 2017-02-05 17:25:17 -05:00
parent e36a1e82e7
commit 2446baf718
1 changed files with 3 additions and 1 deletions

View File

@ -490,6 +490,7 @@ void gfx_free()
void gfx_loadBackground(const char *filename)
{
SDL_Surface *new_bg;
double scale;
if (gfx_background != NULL)
{
@ -498,7 +499,8 @@ void gfx_loadBackground(const char *filename)
}
new_bg = gfx_loadImage(filename);
SDL_SetColorKey(new_bg, 0, 0);
gfx_background = zoomSurface(new_bg, (double)screen->w / new_bg->w, (double)screen->h / new_bg->h, 0);
scale = MAX((double)screen->w / new_bg->w, (double)screen->h / new_bg->h);
gfx_background = zoomSurface(new_bg, scale, scale, 0);
SDL_FreeSurface(new_bg);
}