This is a quick one:
How do you add a timer delay to a game loop?
Using SDL you do the following:
#define GAME_LOOP_DELAY_MS 12
...
while(LastTickCount + GAME_LOOP_DELAY_MS > SDL_GetTicks());
LastTickCount = SDL_GetTicks();
This will work even on overclocked/underclocked hardware. Use it wisely.
Cheers
How do you add a timer delay to a game loop?
Using SDL you do the following:
#define GAME_LOOP_DELAY_MS 12
...
while(LastTickCount + GAME_LOOP_DELAY_MS > SDL_GetTicks());
LastTickCount = SDL_GetTicks();
This will work even on overclocked/underclocked hardware. Use it wisely.
Cheers
0 Comments:
Post a Comment
<< Home