Hey, could someone post code for creating a blank
surface?
Thanks__________________________________________________
Do You Yahoo!?
Send your FREE holiday greetings online!
http://greetings.yahoo.com
Hey, could someone post code for creating a blank
surface?
Thanks__________________________________________________
Do You Yahoo!?
Send your FREE holiday greetings online!
http://greetings.yahoo.com
Hey, could someone post code for creating a blank surface?
Assuming you want it in the same format as the screen format, which you’ve
already initialised, the following function should do what you want:
SDL_Surface *create_blank_surface (int width, int height)
{
SDL_Surface *surface = NULL;
SDL_Surface *screen = SDL_GetVideoSurface();
// create the new surface
surface = SDL_CreateRGBSurface (screen->flags, width, height,
screen->format->BitsPerPixel,
screen->format->Rmask,
screen->format->Gmask,
screen->format->Bmask,
screen->format->Amask);
// fill the new surface with black
if (surface != NULL)
SDL_FillRect (surface, NULL, Map_RGB(surface->format, 0x0,0x0,0x0));
return surface;
} // end create_blank_surface()
Instead of just using the screen’s flags, you might want to modify the above
function to let you pass your own in; you may also want to be using Map_RGBA()
if you’re using alpha.
Hope this is what you’re looking for :-)On Thu, 3 Jan 2002, Red wrote:
–
Mike.
Mike wrote:
// fill the new surface with black
if (surface != NULL)
SDL_FillRect (surface, NULL, Map_RGB(surface->format, 0x0,0x0,0x0));
SDL_CreateRGBSurface fills newly created software surfaces with zeroes so
this isn’t strictly needed
Hey, thanks a lot the code worked perfectly. Now I
need to know if there’s a way to output text with sdl.
Herbert__________________________________________________
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/