[SDL] Segmentation fault when using rotozoomSurface
Christian Brønnum-Hansen
bronnum-hansen at mail.dk
Fri Feb 17 10:51:53 PST 2006
Hi!
I have written a little test program, to get to know the SDL_gfx library.
#include <SDL/SDL.h>
#include <SDL/SDL_rotozoom.h>
SDL_Surface *screen;
SDL_Surface *image;
SDL_Rect dest;
SDL_Event event;
Uint8 *keystate;
int quit;
int main(int argc, char *argv[]) {
screen = SDL_SetVideoMode(640, 480, 8, SDL_SWSURFACE);
image = SDL_LoadBMP("bil.bmp");
dest.x = 200;
dest.y = 200;
while(!quit) {
while (SDL_PollEvent(&event) ) {
switch (event.type) {
case SDL_KEYDOWN:
keystate = SDL_GetKeyState(NULL);
break;
case SDL_QUIT:
quit = 1;
}
if (keystate[SDLK_LEFT]) {
image = rotozoomSurface(image, -5, 1, 0);
}
}
dest.w = image->w;
dest.h = image->h;
SDL_BlitSurface(image, NULL, screen, &dest);
SDL_UpdateRects(screen, 1, &dest);
SDL_Delay(2000);
}
}
The problem is that is returns a segmentation fault and I don't understand
why.
Does anyone have a clue?
Thanks.
Christian.
More information about the SDL
mailing list