Another C question...

GO TO ADMIN PANEL > ADD-ONS AND INSTALL VERTIFORO SIDEBAR TO SEE FORUMS AND SIDEBAR

Daniel Eriksson

New Member
Joined
May 5, 2001
Messages
602
Points
16
Website
server3002.freeyellow.com
Is there a command in Saturn C that is similiar to SLEEP in basic. That stops the program until a button is pressed or the time goes out? Please help. I am making a game and i would need this!
 

ExCyber

Staff member
Joined
Aug 8, 2001
Messages
4,014
Points
36
Age
37
That won't do what he was asking for... I think what's needed is something like this (again, this isn't guaranteed to be correct):

Code:
void sleepuntilbutton (Uint32 frames)

{

  while (frames > 0)

   {

   SlSynch();

   if (Smpc_Peripheral[0].data && PER_DGT_TX) return;

   frames--

   }

}
This would (in theory) sleep for the specified number of frames, or until the X button is pressed. Of course, for a "real" program you'd probably want to abstract the button handling somehow...

edit: D'oh! Forgot the closing code tag...

(Edited by ExCyber at 4:21 pm on Jan. 15, 2002)
 
Top