aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2012-08-14 18:16:37 +0200
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2012-08-14 18:16:37 +0200
commit9a7d82b700167d5d023c06c3432fb165bff30c2f (patch)
tree602234fc4080dc2ec6660d5c2dbdc6706feccc59
parentc331551e407fda9803522433dc8871fa6cc5f4ba (diff)
downloadosc-graphics-9a7d82b700167d5d023c06c3432fb165bff30c2f.tar.gz
automatically zoom background image
-rw-r--r--effect-pad.c13
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();