home *** CD-ROM | disk | FTP | other *** search
/ Adventures in Heaven 2 / adventuresinheaven2powergamesfordosandwindows.iso / windows / arcade / cbzone / unix2nt.c < prev    next >
C/C++ Source or Header  |  1992-05-27  |  1KB  |  71 lines

  1. #include "c_includ.h"
  2. #ifdef WIN31
  3. #include <toolhelp.h>
  4. #endif
  5.  
  6. HPEN hpen[MAX_COLORS];
  7. HBRUSH hbrushBlack;
  8. HBRUSH hbrushFill;
  9.  
  10. VKEY vkey[] = { VK_LBUTTON, 0, 'a', 'A',
  11.         'Q', 0, 'Q', 'Q',
  12.         VK_RBUTTON, 0, 'c', 'C' };
  13.  
  14. // Stub out c_score.c by Eric Fogelin
  15. LONG scores( LONG score)
  16. {
  17.     return 0;
  18. }
  19. /*
  20. */
  21.  
  22. // Implement gettimeofday by Eric Fogelin
  23. void gettimeofday( struct timeval *unixtime, int dummy )
  24. {
  25. #ifdef WIN32
  26.     unsigned int millisecs;
  27.  
  28.     millisecs = GetTickCount();
  29.     unixtime->tv_sec = millisecs / 1000;            // seconds
  30.     unixtime->tv_usec = (millisecs % 1000) * 1000;  // micro seconds
  31. #else
  32.     time_t secs;
  33.  
  34.     unixtime->tv_sec = secs;
  35.     unixtime->tv_usec = 0;
  36. #endif
  37. }
  38. /*
  39. */
  40.  
  41. #ifdef WIN31
  42. void Sleep( DWORD msec )
  43. {
  44.     DWORD endtime;
  45.     // TIMERINFO ti;
  46.     BOOL done;
  47.  
  48.     // TimerCount( &ti );
  49.     endtime = GetTickCount() + msec;
  50.     do {
  51.     done = ( GetTickCount() >= endtime);
  52.     // TimerCount( &ti );
  53.     // done = ( ti.dwmsSinceStart >= endtime);
  54.     } while (!done);
  55. }
  56. /*
  57. */
  58. #endif //WIN31
  59.  
  60. // Implement select by Eric Fogelin
  61. // select appears to be used as a fine grain delay (microseconds)
  62. void select( int dummy1, int dummy2, int dummy3, int dummy4, struct timeval *unixtime )
  63. {
  64. #ifdef WIN32
  65.     // Convert from micro to milliseconds
  66.     Sleep( unixtime->tv_sec * 1000 + unixtime->tv_usec/1000 );
  67. #endif
  68. }
  69. /*
  70. */
  71.