[SDL] new empty surface

nwagenaar at digitaldynamics.nl nwagenaar at digitaldynamics.nl
Mon Jul 8 13:33:01 PDT 2002


Hi Mirko,

allthough SDL_CreateRGBSurface seems to be complicated, it's the
function you require to make a new empty surface :

menu = SDL_CreateRGBSurface(
			SDL_SWSURFACE,
			100, 50, // Sizes
 			16,      // BPP
#if SDL_BYTEORDER == SDL_LIL_ENDIAN /* OpenGL RGBA masks */
			0x000000FF, 
			0x0000FF00, 
			0x00FF0000, 
			0xFF000000);
#else
			0xFF000000,
			0x00FF0000, 
			0x0000FF00, 
			0x000000FF);
#endif

Voila! A new SDL_Surface named menu. This should do for you :)

Regards,

Niels Wagenaar

> -----Oorspronkelijk bericht-----
> Van: koenig [mailto:koenig at v-i-t.de]
> Verzonden: maandag 8 juli 2002 21:53
> Aan: sdl
> Onderwerp: [SDL] new empty surface
> 
> 
> Hi
> 
> How can i get an new empty surface of a size?
> I made a variable SDL_Surface* menu.
> I want it to be 100x50 to blit buttons on it and then later blit the
> whole menu surface to the screen.
> 
> I tried SDL_ConvertSurface, but than i couldn't change the size.
> I tried SDL_CreateRGBSurface, but this semme to complicated 
> for me. Such
> an long function just to make a surface?
> 
> Isn't there a function to create a surface of the screen's format but
> with differnt size?
> 
> Mirko
> _______________________________________________
> SDL mailing list
> SDL at libsdl.org
> http://www.libsdl.org/mailman/listinfo/sdl
> 






More information about the SDL mailing list