Misc. functions
int sge_Random(int min, int max)
Returns a random integer between (and including) min and max.
void sge_Randomize(void)
Seed the random number generator with a number from the system clock. Should be called once before the first use of sge_Random.
Uint32 sge_CalibrateDelay(void)
Tests and returns the current resolution (the smallest delay possible) of SDL_Delay(). This test will
take 10-50ms to complete.
Uint32 sge_DelayRes(void)
Returns the latest result of sge_CalibrateDelay() or 10ms as default.
Uint32 sge_Delay(Uint32 ticks)
The SGE version of SDL_Delay(). SDL_Delay() burns time by giving it to the system, which gives other
tasks more CPU time. BUT (if you're not running a realtime OS) the delay will not take the exact time
you specified and will not be the same on a different machine or OS. sge_Delay() uses sge_DelayRes()
to get the safe amount of time to burn with SDL_Delay() and burns the rest in a loop. This should
give the same delay on all machines & OSes but still give more CPU time to other tasks if possible.
Note that if the user starts something CPU intensive after you called sge_CalibrateDelay() the result
will be less reliable.
Returns the exact time delayed.
Copyright © 1999-2003 Anders Lindström
Last updated 030808