[SDL] SDL_DisplayFormat before SDL_VideoInit

Dahman abderrahmane.madani at bncelettronica.com
Wed Jan 3 23:55:49 PST 2007


Hi, I'm new to SDL and I would make a question.
 
If I call the function
 
SDL_Surface *surface = SDL_DisplayFormat (image) 
if (surface == NULL)
    exit()
…
…
SDL_VideoInit(…)
 
I get a crash in the first call.
 
Yes, I know that the SDL_DisplayFormat have to be called after the SDL_VideoInit
but I think that the user, at least, expect to have a NULL surface otherwise.
So I got a look athttp://gmane.org/word.php?id=29554
http://gmane.org/word.php?id=29554 the source code and I saw that
SDL_DisplayFormat check the
SDL_PublicSurface variable before doing anything.
But if the video isn’t initialized then this variable is not initialized too, am
I right?
Isn't it better to test the current_video variable instead?
What do you think?
 
Thanks for the great library.
 
Best regards, Dahman






More information about the SDL mailing list