Another C question...

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!
 
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)
 
Back
Top