Well I tried the suggestions for the cross-fader and used alpha values and
now my cross-fader updates at a whopping 1 frame a second. Thats right it
takes 700-900 ms to blit the alpha channeled bitmap.
I supply my code below
#include <stdio.h>
#include <stdlib.h>
#include “SDL-1.1.6\SDL.h”
int done;
SDL_Event event;
Uint8 *keys;
int frames = 0;
float fps, t;
Uint32 t1;
int ScrW = 800;
int ScrH = 600;
main(int argc, char *argv[])
{
SDL_Surface *screen;
SDL_Init(SDL_INIT_VIDEO);
screen = SDL_SetVideoMode(ScrW, ScrH,32, SDL_SWSURFACE | SDL_SRCALPHA |
SDL_DOUBLEBUF | SDL_FULLSCREEN);
SDL_WM_SetCaption(“Text Test”, “test”);
SDL_ShowCursor(0);
SDL_Surface *pic1 = SDL_LoadBMP(“Data\pic1.bmp”);
pic1 = SDL_DisplayFormatAlpha(pic1);
SDL_Surface *pic2 = SDL_LoadBMP(“Data\pic2.bmp”);
pic2 = SDL_DisplayFormatAlpha(pic2);
while (done == 0)
{
while ( SDL_PollEvent(&event) )
{
switch (event.type)
{
case SDL_QUIT: done = 1; break;
case SDL_KEYDOWN:
if (event.key.keysym.sym == SDLK_ESCAPE) { done = 1; }
break;
}
}
SDL_BlitSurface(pic1, NULL, screen, NULL);
SDL_SetAlpha(pic2, SDL_SRCALPHA | SDL_RLEACCEL, 128);
SDL_BlitSurface(pic2, NULL, screen, NULL);
SDL_Flip(screen);
}
SDL_FreeSurface(pic1);
SDL_FreeSurface(pic2);
Arial.Free();
SDL_Quit();
exit(0);
return(0);
}
The code above that basically shows half of each picture runs at 1 frame a
second. Any suggestions
Piotr Dubla