From 9a7d82b700167d5d023c06c3432fb165bff30c2f Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Tue, 14 Aug 2012 18:16:37 +0200 Subject: automatically zoom background image --- effect-pad.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'effect-pad.c') diff --git a/effect-pad.c b/effect-pad.c index b942bdc..4fa05dc 100644 --- a/effect-pad.c +++ b/effect-pad.c @@ -6,6 +6,7 @@ #include #include #include +#include //#define EFFECT_FIRE_COLORKEYED @@ -287,7 +288,17 @@ main(int argc, char **argv) SDL_IMAGE_ERROR("IMG_Load"); return EXIT_FAILURE; } - assert(image_surface->w == screen->w && image_surface->h == screen->h); + + if (image_surface->w != screen->w || image_surface->h != screen->h) { + SDL_Surface *new; + + new = zoomSurface(image_surface, + (double)screen->w/image_surface->w, + (double)screen->h/image_surface->h, + SMOOTHING_ON); + SDL_FreeSurface(image_surface); + image_surface = new; + } fire_surface = effect_fire_init(); -- cgit v1.2.3