diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2012-08-14 18:16:37 +0200 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2012-08-14 18:16:37 +0200 |
commit | 9a7d82b700167d5d023c06c3432fb165bff30c2f (patch) | |
tree | 602234fc4080dc2ec6660d5c2dbdc6706feccc59 | |
parent | c331551e407fda9803522433dc8871fa6cc5f4ba (diff) | |
download | osc-graphics-9a7d82b700167d5d023c06c3432fb165bff30c2f.tar.gz |
automatically zoom background image
-rw-r--r-- | effect-pad.c | 13 |
1 files changed, 12 insertions, 1 deletions
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 <SDL.h> #include <SDL_image.h> #include <SDL_framerate.h> +#include <SDL_rotozoom.h> //#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(); |