Using SDL_Surfaces before SDL_SetVideoMode


I am a newbie to this list, however I have been using the SDL library for quite some time. Now I think this library is really really great (really, no joking:) – it made cool games on Linux (and other platforms, of course) possible, just like DirectX did on windows.

Now for that reason I think it’s well worth the effort trying to make it better. And that’s just the reason why I’m going to discuss with you many things in the SDL API and documentation that I think are missing, incorrect and so on.

Even if not more than one of my complaints proves legitimate, I will be happy.

And of course, I don’t want just to criticise. I’d love to work hard and send a patch in cases when you approve that something truly needs correcting.

Today I picked the problem of using the SDL_Surface structures before calling SDL_SetVideoMode.
(We need to do this in order to use SDL_WM_SetIcon, which can only be called BEFORE calling SDL_SetVideoMode;
the well-known way to do this is to use SDL_LoadBMP to load the icon)

What’s written in the documentation:

(1) SDL_CreateRGBSurface must be called after SDL_SetVideoMode
(2) SDL_CreateRGBSurface – there’s nothing on the subject
(3) SDL_LoadBMP – there’s nothing on the subject

I think (3) implies correctly, that SDL_VideoMode doesn’t need to be called prior to SDL_LoadBMP.

However: (1) and (2) should behave in the same manner with respect to SDL_SetVideoMode. We might say it should be added to SDL_CreateRGBSurface’s doc. that it can only be called after SDL_SetVideoMode.

On the other hand, one might to load an icon from a different fileformat, or to create it in a different way.

Thus perhaps it should be added to the documentation of SDL_CreateRGBSurface & SDL_CreateRGBSurfaceFrom, that they can be used prior to SDL_SetVideoMode if some conditions are met. (Creating a SDL_SWSURFACE, perhaps?)

One other problem even with the current documentation is, that since we can create surfaces with SDL_LoadBMP prior to calling SDL_SetVideoMode is that we might try to use SDL_BlitSurface or SDL_FillRect on these.

When I tried it, they returned -1 and did nothing, so perhaps the documentation should note that doing this is not possible?

Best regards,
Jiri Svoboda - e-mailov? schr?nka 1000 MB