Reason of SDL_flip() errors under DirectX

Hi

I have made my game’s logic independent of the video frame rate.

Here is my method :

while(1==1) {

time = get_elsaped_time( );
move_everything(time);
display( ); //include SDL_Flip

}

In this way all the game objects move indepently of the frame rate and I
display as much frames as possible. This works fine under linux with X or
the frame buffer, and under Windows in windowed mode. In fullscreen
(DoubleBuf) mode with Windows the game speed is ok but I lose a lot of
frames. I found that calling SDL_Flip only every 7-10 ms solved the problem,
but I wasn’t satisfied by this solution. My actual solution is to embed the
SDL_Flip into a loop to test the returned result:
while (SDL_Flip( screen) < 0); .

In this way I am sure that the flip has been done. My question is what are
the possible causes of the errors ? How do you handle them ? Does a -1 means
that the flip has just been delayed and will be done as soon as possible ?

My configuration is :
Windows 2000
SDL 1.2.5 used under MinGW
ATI 128

Thanks

Julien

Julien

Hi
I have made my game’s logic independent of the video frame rate.
Here is my method :

while(1==1) {
time = get_elsaped_time( );
move_everything(time);
display( ); //include SDL_Flip
}

In this way all the game objects move indepently of the frame rate and
I display as much frames as possible.

I had that originally and it worked fine under Linux and Windows, until
I added sound and music. The music just died under Windows. Adding a
SDL_delay() call inside the loop will give share some CPU time and I
guess that’s a Good Thing ™

Lic. Gabriel Gambetta
ARTech - GeneXus Development Team
ggambett at artech.com.uy> ----- Original Message -----

From: Julien Pauty [mailto:jpauty@irisa.fr]
Sent: Jueves, 22 de Mayo de 2003 10:12 a.m.
To: sdl at libsdl.org
Subject: [SDL] Reason of SDL_flip() errors under DirectX

Hi

I have made my game’s logic independent of the video frame rate.

Here is my method :

while(1==1) {

time = get_elsaped_time( );
move_everything(time);
display( ); //include SDL_Flip

}

In this way all the game objects move indepently of the frame rate and I
display as much frames as possible. This works fine under linux with X
or the frame buffer, and under Windows in windowed mode. In fullscreen
(DoubleBuf) mode with Windows the game speed is ok but I lose a lot of
frames. I found that calling SDL_Flip only every 7-10 ms solved the
problem, but I wasn’t satisfied by this solution. My actual solution is
to embed the SDL_Flip into a loop to test the returned result: while
(SDL_Flip( screen) < 0); .

In this way I am sure that the flip has been done. My question is what
are the possible causes of the errors ? How do you handle them ? Does a
-1 means that the flip has just been delayed and will be done as soon as
possible ?

My configuration is :
Windows 2000
SDL 1.2.5 used under MinGW
ATI 128

Thanks

Julien

Julien


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl