Advertisement Jump to content
Sign in to follow this  

Creating a plain SDL surface?

This topic is 3823 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello! Is there some way to create an SDL surface with a specific width and height, without loading a bitmap or setting the video mode? [Edited by - TriKri on July 29, 2008 8:29:44 AM]

Share this post

Link to post
Share on other sites

Uint32 rmask, gmask, bmask, amask;

rmask = 0xff000000;
gmask = 0x00ff0000;
bmask = 0x0000ff00;
amask = 0x000000ff;
rmask = 0x000000ff;
gmask = 0x0000ff00;
bmask = 0x00ff0000;
amask = 0xff000000;

SDL_Surface * NewSurface = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h,32, bmask, gmask, rmask, amask);

Change the masks to fit you color and alpha needs

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!