Running this simple SDL program on windowsXP,DirectX9
when alt+tab and return I get “error: Blit surfaces
were lost, reload them” "error:
DirectDrawSurface3::Blt: Surface was lost"
What’s going on? It seems to still run. Tried to
SDL_SetVideoMode but it doesn’t fix it.
Here’s the code.
#include <SDL/SDL.h>
#include <windows.h>
SDL_Surface *screen;
int Gamestate;
Uint8 *keys;
enum { play, done };
SDLmain {
Gamestate = play;
SDL_Init( SDL_INIT_VIDEO ) ;
screen=SDL_SetVideoMode(800, 600, 0,
SDL_HWSURFACE|SDL_FULLSCREEN|SDL_DOUBLEBUF );
while( Gamestate < done){
SDL_Event ev;
while(SDL_PollEvent(&ev) > 0){
switch ( ev.type){
case SDL_ACTIVEEVENT:
if( ev.active.gain ){
if (SDL_BlitSurface(screen, 0, screen, 0)
== -2 )
fprintf(stderr, “SDL error: %s\n”,
SDL_GetError());
}
break;
default: break;
} }
keys = SDL_GetKeyState(NULL);
if ( keys[SDLK_ESCAPE] ) Gamestate = done;
SDL_FillRect(screen, 0, 0);
SDL_Flip(screen);
}
fprintf(stderr, “SDL error: %s\n”, SDL_GetError());
SDL_Quit();
return 0; }__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com