home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / snip9707.zip / SPIN.C < prev    next >
C/C++ Source or Header  |  1997-07-05  |  912b  |  32 lines

  1. /* +++Date last modified: 05-Jul-1997 */
  2.  
  3. /*
  4. **  Miscellaneous text spinners demonstration
  5. **
  6. **  public domain by Jon Guthrie, Bob Stout, and others
  7. */
  8.  
  9. #include <stdio.h>
  10.  
  11. #define DURATION 500    /* Length of demo       */
  12. #define SSLOWDOWN 15    /* Make spinner look ok */
  13. #define TSLOWDOWN 20    /* Make target look ok  */
  14.  
  15. main()
  16. {
  17.       unsigned i;
  18.       char spinner[] = "|/-\\", target[] = ".oO";
  19.  
  20.       for (i = 0; i < DURATION; ++i)
  21.       {
  22.             unsigned scount = i / SSLOWDOWN, tcount = i / TSLOWDOWN;
  23.             unsigned scountdown  = DURATION / SSLOWDOWN;
  24.             unsigned tcountdown  = DURATION / TSLOWDOWN;
  25.  
  26.             printf("CW %c ... CCW %c ... Explode %c ... Implode %c\r",
  27.                   spinner[scount & 3], spinner[(scountdown - scount) & 3],
  28.                   target[tcount % 3], target[(tcountdown - tcount) % 3]);
  29.       }
  30.       return 0;
  31. }
  32.