[Fwd: double buffering code]

One thing that I found with blitting to an entire surface, was that if I did
something like this:

screen is a 640x480 hw surface
background is a 640x480 sw surface

SDL_Rect r = { 0, 0, 640, 480 }; // ie, the dimensions of the screen
SDL_BlitSurface( screen, NULL, background, &r );

I wouldn’t get anything on the screen!

But if I changed it to

SDL_BlitSurface( screen, NULL, background, NULL );

it worked fine.

m.–
“We can deny everything, except that we have the possibility of being better.
Simply reflect on that.”
– His Holiness The Dalai Lama

your SDL_Rect r is 641 x 481 pixels, try

SDL_Rect r = { 0, 0, 639, 479 };

instead. ;-)On Thu, 25 Feb 1999, you wrote:

One thing that I found with blitting to an entire surface, was that if I did
something like this:

screen is a 640x480 hw surface
background is a 640x480 sw surface

SDL_Rect r = { 0, 0, 640, 480 }; // ie, the dimensions of the screen
SDL_BlitSurface( screen, NULL, background, &r );


Karsten-O. Laux
klaux at student.uni-kl.de
http://www.rhrk.uni-kl.de/~klaux
UIN 21614933 (Bert)

It’s dying in this function:

if ( SDL_BlitSurface(screen, NULL, images, &img) < 0 )
{
ComplainAndExit();
}

screen is what I’m trying to blit to images, and I’m trying to get
images to draw to the screen.

I’ve got screen and images defined as follows:

   screen = SDL_SetVideoMode(640, 480, 0,

SDL_HWSURFACE|SDL_FULLSCREEN);

   images = SDL_SetVideoMode(640, 480, 0,

SDL_HWSURFACE|SDL_FULLSCREEN);

I honestly don’t know how to check to see if the rectangles clip the
screen. I’m sorry, I just haven’t had much experience with game
programming and sdl in general yet.

with SDL_SetVideoMode() you initialize the screen buffer. Obviously there can
only be one. Other surfaces should be created by SDL_AllocSurface(…)

regards,On Thu, 25 Feb 1999, you wrote:


Karsten-O. Laux
klaux at student.uni-kl.de
http://www.rhrk.uni-kl.de/~klaux
UIN 21614933 (Bert)

Karsten-Olaf Laux wrote:

It’s dying in this function:

if ( SDL_BlitSurface(screen, NULL, images, &img) < 0 )
{
ComplainAndExit();
}

screen is what I’m trying to blit to images, and I’m trying to get
images to draw to the screen.

I’ve got screen and images defined as follows:

   screen = SDL_SetVideoMode(640, 480, 0,

SDL_HWSURFACE|SDL_FULLSCREEN);

   images = SDL_SetVideoMode(640, 480, 0,

SDL_HWSURFACE|SDL_FULLSCREEN);

I honestly don’t know how to check to see if the rectangles clip the
screen. I’m sorry, I just haven’t had much experience with game
programming and sdl in general yet.

with SDL_SetVideoMode() you initialize the screen buffer. Obviously there can
only be one. Other surfaces should be created by SDL_AllocSurface(…)

regards,


Karsten-O. Laux
klaux at student.uni-kl.de
http://www.rhrk.uni-kl.de/~klaux
UIN 21614933 (Bert)

Is this the correct way to create a 640x480 memory bitmap?

screen = SDL_AllocSurface(0,640, 480, 8, 0, 0, 0, 0);

Mike.> On Thu, 25 Feb 1999, you wrote:

Is this the correct way to create a 640x480 memory bitmap?

screen = SDL_AllocSurface(0,640, 480, 8, 0, 0, 0, 0);

Yes.

See ya!
-Sam Lantinga (slouken at devolution.com)

Lead Programmer, Loki Entertainment Software–
Author of Simple DirectMedia Layer -
http://www.devolution.com/~slouken/SDL/