# Can I create a SDL_Surface as I do with Allegro?

Using allegro I can create a Bitmap to draw just doing:

BITMAP* bmp = NULL;
bmp = create_bitmap(width,height); // I don't remember exactly the parameters


I'm using SDL now, and i want create an SDL_Surface to draw the game level (that is static). I create an SDL_Surface, draw the tiles on it, then just blit this surface to the screen instead of drawing the tiles directly on screen (I believe this will require more processing);

Is there a way to create a blank SDL_Surface as I did with Allegro to draw before I blit it?

• If you care about searching on the sdl documentation, yes, there are. – Gustavo Maciel Mar 18 '12 at 17:25
• Also, I'd check Lazy Foo', as he does a lot of really good stuff regarding SDL, including Surface stuff. – thePalindrome Mar 19 '12 at 4:51

You are looking for this function:

SDL_Surface* SDL_CreateRGBSurface(Uint32 flags, int width, int height, int bitsPerPixel,

SDL_Surface * screen;