[SDL] Hardware surfaces Again

Patricia Curtis patricia.curtis at gmail.com
Tue Aug 7 22:33:51 PDT 2007


Hi Guys
          I have implemented some code to make hardware surfaces, but i am
not sure if i have it right so could someone look at this for me, also I
have had to use SDL_DisplayFormatAlpha or everything that moved on the
screen left trails which all though they looked good, they were
obviously not right. I also remember i think it was Torsten saying don't use
SDL_DisplayFormatAlpha so whats right whats wrong and what can i do to make
use of the hardware for blitting with and without alpha channels)

SDL_Surface * LoadSurfaceVideoMem(char * FileName)
{
               SDL_Surface * VideoMemSurface;
// load the image
               SDL_Surface * TempSurface =
SDL_DisplayFormatAlpha(IMG_Load(FileName));
// create a hardware surface
                VideoMemSurface =
SDL_DisplayFormatAlpha(SDL_CreateRGBSurface(SDL_HWSURFACE | SDL_SRCALPHA
|SDL_ASYNCBLIT | SDL_HWACCEL , TempSurface->w, TempSurface->h, 32, RMASK,
GMASK, BMASK ,AMASK));
// copy the surface pixels
               CopySurface(TempSurface, VideoMemSurface);
               SDL_FreeSurface(TempSurface);
               return VideoMemSurface;
}

Thanks in advance, the past and the present,

Trish x
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20070808/21743bb6/attachment.htm 


More information about the SDL mailing list