PDA

View Full Version : How can I 'pause' the game for a few seconds (Unix-Solaris) ?



BigShooter
10-22-2003, 09:21 PM
Is there a way to 'pause' a game, say for 3 seconds with a simple function call, on Unix (Solaris) ?

Thank you,
Luke

10-23-2003, 12:55 AM
How about just stop updating your game data? Bonus points for rendering a *PAUSED* logo as well.

BigShooter
10-23-2003, 12:11 PM
Yes, this is what I want to do ("stop updating the game data") but I don't know how to pause the game for specific amount of time, e.g. 2 seconds.
Thank you,
Luke

guest
10-23-2003, 01:00 PM
It depends on your platform. Look for clock, time, delay, etc. functions in your related manpages.

10-23-2003, 01:07 PM
You can try the well named sleep function.

unsigned int sleep (unsigned int seconds) Function
The sleep function waits for seconds or until a signal is delivered, whichever happens first.

If sleep function returns because the requested interval is over, it returns a value of zero. If it returns because of delivery of a signal, its return value is the remaining time in the sleep interval.

The sleep function is declared in unistd.h.
http://www.gnu.org/manual/glibc-2.2.5/html_node/Sleeping.html