Hi… i’m have a problem with the next code :
SDL_Surface *saved = NULL;
SDL_Surface *screen = SDL_SetVideoMode(640, 480, 16,
SDL_HWSURFACE|SDL_DOUBLEBUF);
SDL_Surface back = SDL_LoadBMP(“arena.bmp”); / 32x32 pixels */
SDL_Surface ship = SDL_LoadBMP(“ship.bmp”); / 40x40 pixels */
SDL_Rect r, currentPos;
r.x=r.y=0;
r.w=back->w;
r.h=back->h;
/* this paint the entire screen with a BMP */
for(x=0; x < 640; x+=32)
for(y=0; y < 480; y+=32)
{
r.x = x;
r.y = y;
SDL_BlitSurface(back, NULL, screen, &r);
}
SDL_Flip(screen);
currentPos.w = ship->w;
currentPos.h = ship->h;
CurrentPos.x = currentPos.y=0;
while(…)
{
if (saved)
SDL_BlitSurface(saved, NULL, screen, ¤tPos);
...
... /* handle keyboard input and change the currentPos.x or/and
currentPos.y values */
…
if (!saved)
saved = SDL_CreateRGBSurface(SDL_HWSURFACE, ship.w, ship.h,
screen->format->BitsPerPixel,
screen->format->Rmask,
screen->format->Gmask,
screen->format->Bmask,
screen->format->Amask);
SDL_BlitSurface(screen, ¤tPos, saved, NULL);
SDL_BlitSurface(ship, NULL, screen, ¤tPos);
SDL_Flip(screen);
}
Well, this is basicaly the mail loop, but in “saved” always i have a
black surface… and before to do the “ship” blit, the screen backroung
is eraser. what am i doing wrong ??
Thx again ......
PD : somebody know a SDL mailing list in spanish ??? …–
±----------------------------------------------------+
| Ricardo Markiewicz | El software es como |
±------------------------------+ el sexo… si es |
| Linux Inside! - S.u.S.E. 6.2 | gratis… Mejor!! |
| Kernel 2.2.14 | |
±----------------------------------------------------+