Advertisement

BackBuffer function dosnt work...

Started by August 31, 2004 02:31 PM
2 comments, last by Feidias 20 years, 5 months ago
ive done a backbuffer function but it dosnt work..... heres the code

#include <SDL/SDL.h>
SDL_Surface *screen;
SDL_Surface *bbuf;
SDL_Surface *image;
void backbuffer(SDL_Surface *image, int x, int y)
{
  SDL_Rect dest;

  dest.x = x;
  dest.y = y;
  dest.w = image->w;
  dest.h = image->h;
  SDL_BlitSurface(image, &dest, bbuf, &dest);
  SDL_BlitSurface(bbuf, &dest, screen, &dest);
}
i dont get an error when i compile... thanx [Edited by - Washu on August 31, 2004 2:50:40 PM]
is your back buffer a valid surface?

what are you trying to do with this?

check out the tutorials on my site, they cover stuff like this.
HxRender | Cornerstone SDL TutorialsCurrently picking on: Hedos, Programmer One
Advertisement
The first blit is unneccessary because you are using same SDL_Rect as the size. You could just blit the image on screen directly. Remember to use SDL_UpdateRect to make the image actually show in windowed mode.
Well, if you actually need the back buffer then it's neccessary, but you need TWO routines: first which draws graphics on back buffer and another one which will update the graphics on screen surface and then updates it with SDL_UpdateRect.

You can also set up a double buffer and use SDL_Flip to swap the drawing buffer.

This topic is closed to new replies.

Advertisement