diff -r ffa851df0825 -r 2fb8b9db1c86 symbian-qemu-0.9.1-12/libsdl-trunk/docs/html/guidetimeexamples.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/symbian-qemu-0.9.1-12/libsdl-trunk/docs/html/guidetimeexamples.html Fri Jul 31 15:01:17 2009 +0100 @@ -0,0 +1,183 @@ +
#define TICK_INTERVAL 30 + +static Uint32 next_time; + +Uint32 time_left(void) +{ + Uint32 now; + + now = SDL_GetTicks(); + if(next_time <= now) + return 0; + else + return next_time - now; +} + + +/* main game loop */ + + next_time = SDL_GetTicks() + TICK_INTERVAL; + while ( game_running ) { + update_game_state(); + SDL_Delay(time_left()); + next_time += TICK_INTERVAL; + }