[SDL] Using IMG_Load with SDL_DisplayFormat
Philip D. Bober
wildfire1138 at mchsi.com
Wed Oct 30 13:58:00 PST 2002
You can't check to see if IMG_Load returns NULL if you do it like that, and
you can't free the surface either.
Try doing it like this:
SDL_Surface * blah=NULL;
SDL_Surface * temp=IMG_Load ( "data/images/block0.jpg");
if(temp){
blah=SDL_DisplayFormat(temp);
SDL_FreeSurface(temp);
}else{
//handle the error.
}
----- Original Message -----
From: "Altay Cebe" <altaycebe at vpw.wh.uni-dortmund.de>
To: <sdl at libsdl.org>
Sent: Wednesday, October 30, 2002 4:40 PM
Subject: [SDL] Using IMG_Load with SDL_DisplayFormat
Hi
Whenever i use SDL_DisplayFormat in addition with IMG_load (from SDL_image
libary) i get an segmentation Fault:
SDL_Surface * blah = SDL_DisplayFormat ( IMG_Load (
"data/images/block0.jpg"))
I don't know what i'm doing wrong here. IMG_Load returns a Pointer to a
SDL_Surface and SDL_DisplayFormat expects a pointer to a SDL_Surface.
Any suggestions ?
_______________________________________________
SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl
More information about the SDL
mailing list