FreeBASIC  0.91.0
gfx_sleep.c
Go to the documentation of this file.
1 /* sleep function */
2 
3 #include "fb_gfx.h"
4 
5 int fb_hGfxInputBufferChanged( void );
6 
7 /*:::::*/
8 void fb_GfxSleep ( int msecs )
9 {
10  /* infinite? wait until any key is pressed */
11  if( msecs == -1 )
12  {
13  while( !fb_hGfxInputBufferChanged( ) )
14  fb_Delay( 50 );
15  return;
16  }
17 
18  /* if above n-mili-seconds, check for key input, otherwise,
19  don't screw the precision with slow console checks */
20  if( msecs >= 100 )
21  while( msecs > 50 )
22  {
24  return;
25 
26  fb_Delay( 50 );
27  msecs -= 50;
28  }
29 
30  if( msecs > 0 )
31  fb_Delay( msecs );
32 
33 }