A quick question that have been on my mind for a while

Hi

This is not a BIG problem that needs to be solved, in fact it’s only a
question that arose while I was coding something. If I want to create a
surface that has the same dimensions and bitdepth etc. as the videosurface,
but I want it to be empty. (Thus I can not copy it)
Is there no command for doing this? Do you have to do the following:

mGameSurface = SDL_CreateRGBSurface(video_surface->flags,
video_surface->w,
video_surface->h,
video_surface->format->BitsPerPixel,
video_surface->format->Rmask,
video_surface->format->Gmask,
video_surface->format->Bmask,
video_surface->format->Amask);

So, thats my question :wink:
This is not very tiredsome to do… I just wonder if I have missed a
function called somthing similar to
SDL_CreateSurfaceThatIsSameAsVieoSurfaceButEmpty?

Take care…

Best regards
Daniel Liljeberg_________________________________________________________________
MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*.
http://join.msn.com/?page=features/virus

hmm… i think thats the best way to do it without making your own function,
but that would just hide the fact you were doing that every time and not
really change anything :P> ----- Original Message -----

From: damien_@hotmail.com (Daniel Liljeberg)
To:
Sent: Wednesday, August 20, 2003 6:44 AM
Subject: [SDL] A quick question that have been on my mind for a while

Hi

This is not a BIG problem that needs to be solved, in fact it’s only a
question that arose while I was coding something. If I want to create a
surface that has the same dimensions and bitdepth etc. as the
videosurface,
but I want it to be empty. (Thus I can not copy it)
Is there no command for doing this? Do you have to do the following:

mGameSurface = SDL_CreateRGBSurface(video_surface->flags,
video_surface->w,
video_surface->h,

video_surface->format->BitsPerPixel,

                                   video_surface->format->Rmask,
                                   video_surface->format->Gmask,
                                   video_surface->format->Bmask,
                                   video_surface->format->Amask);

So, thats my question :wink:
This is not very tiredsome to do… I just wonder if I have missed a
function called somthing similar to
SDL_CreateSurfaceThatIsSameAsVieoSurfaceButEmpty?

Take care…

Best regards
Daniel Liljeberg


MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*.
http://join.msn.com/?page=features/virus


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

Maybe using memcpy… (memcpy(mGameSurface, video_surface,
sizeof(video_surface))
and then freeing the mGameSurface->surface->pixels pointer… Just a
punch in the dark…

Good Luck.

Juan Ignacio Carniglia - Programmer - Buenos Aires, Argentina.> -----Original Message-----

From: sdl-admin at libsdl.org [mailto:sdl-admin at libsdl.org] On
Behalf Of Damien Damien
Sent: Wednesday, August 20, 2003 10:44 AM
To: sdl at libsdl.org
Subject: [SDL] A quick question that have been on my mind for a while

Hi

This is not a BIG problem that needs to be solved, in fact
it’s only a
question that arose while I was coding something. If I want
to create a
surface that has the same dimensions and bitdepth etc. as the
videosurface,
but I want it to be empty. (Thus I can not copy it)
Is there no command for doing this? Do you have to do the following:

mGameSurface = SDL_CreateRGBSurface(video_surface->flags,
video_surface->w,
video_surface->h,

video_surface->format->BitsPerPixel,
video_surface->format->Rmask,
video_surface->format->Gmask,
video_surface->format->Bmask,
video_surface->format->Amask);

So, thats my question :wink:
This is not very tiredsome to do… I just wonder if I have missed a
function called somthing similar to
SDL_CreateSurfaceThatIsSameAsVieoSurfaceButEmpty?

Take care…

Best regards
Daniel Liljeberg


MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*.
http://join.msn.com/?page=features/virus


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

mGameSurface = SDL_CreateRGBSurface(video_surface->flags,
video_surface->w,
video_surface->h,
video_surface->format->BitsPerPixel,
video_surface->format->Rmask,
video_surface->format->Gmask,
video_surface->format->Bmask,
video_surface->format->Amask);

So, thats my question :wink:

Yep, that’s the right way to do it.

See ya,
-Sam Lantinga, Software Engineer, Blizzard Entertainment