[SDL] How can I implement fade-in/fade-out

cocobear cocobear.cn at gmail.com
Sun Dec 9 00:30:12 PST 2007


void Screen::fade_in(void)
{
        int i;
        SDL_Surface *surface;

        surface = load_image("black.bmp");
        if(surface == NULL) {
                fprintf(stderr, "Load image error: %s\n",
SDL_GetError()); exit(-1);
        }
        for (i=2;i<=256;i<<=1) {

                SDL_SetAlpha(surface,SDL_RLEACCEL,(Uint8)i);
                SDL_BlitSurface(surface,NULL,screen,NULL);
                update();
        }
}

This code does'nt work!



More information about the SDL mailing list