[SDL] Surface problem?

NighTiger nightiger at gameprog.it
Wed Feb 23 04:07:37 PST 2005


Hi guys,
another problem I've this function

SDL_Surface *grabframe(SDL_Surface *source, SDL_Rect grabr, Uint32 cols, 
Uint32 frm)
{
  // crea una surface delle dimensioni della tiles e del formato sorgente
  SDL_Surface *temp = SDL_CreateRGBSurface(SDL_SWSURFACE, grabr.w, 
grabr.h, source->format->BitsPerPixel,
  source->format->Rmask, source->format->Gmask, source->format->Bmask, 
source->format->Amask);

  // ottengo x e y da passare alla SDL_Rect
  grabr.x = grabr.x + (frm % cols) * grabr.w;
  grabr.y = grabr.y + (frm / cols) * grabr.h;

  // blitto sulla surface temp
  SDL_BlitSurface(source, &grabr, temp, NULL);

  // ritorno la surface ottenuta
  return temp;
}

and this work fine when I make a virtual screen with my tiles
I have this function too, for the sprite

SDL_Surface* S_show(SPRITE *sprite)
{
  return grabframe(sprite->sf, sprite->rt, sprite->am.cols, sprite->am.att);
}

when I call the S_show into my main loop the image is not drawed...

anybody can understand why?
tnx





More information about the SDL mailing list