home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / windows / winccdem.zip / DEMO2.C < prev    next >
Text File  |  1987-08-15  |  3KB  |  76 lines

  1. /*
  2. ************************************************************************
  3. *   FILE NAME...... DEMO2.C                                            *
  4. *   DESCRIPTION.... WINCC demo                                         *
  5. *                                                                      *
  6. *   Copyright (c) 1987 by Doug J. Lieu                                 *
  7. *   All rights reserved.                                               *
  8. ************************************************************************
  9.    This program is a different approach of using WINCC library.
  10. */
  11.  
  12. #include "stdio.h"
  13. #include "win_hd.h"
  14.  
  15.  
  16. void
  17. main()
  18. {
  19.         int     i, j, large_w[4], small_w[4], msg_w, left;
  20.  
  21.         winitial();                                     /* initialize the window environment */
  22.         cls();                                          /* clear screen */
  23.  
  24.         for (i = 0; i < 4; i++) {                       /* open first 4 large windows: the cylinder */
  25.                 left = i * 12 + 18;
  26.                 large_w[i] = wfopen( 9, 17, left, left + 7, BLU_CYN, BDR_DLN, BLU_CYN, NULL, NULL);
  27.                 wmode(CTRL_ON);
  28.         }
  29.  
  30.         for (i = 0; i < 4; i++) {                       /* open 4 small windows: the piston */
  31.                 left = i * 12 + 19;
  32.                 j = (i % 2) * 2;
  33.                 small_w[i] = wfopen(9 + j, 15 + j, left, left + 5, RED_BLK, BDR_SLN, BLU_CYN, NULL, NULL);
  34.                 wmode(CTRL_ON);
  35.                 wset_ctype(CSR_BLANK);
  36.         }
  37.  
  38.         msg_w = message(NULL, " Press Ctrl-C to stop ", STAY);
  39.  
  40.         while (1) {
  41.                 if (get_kstat() == CTRL_C)                              /* if interrupted */
  42.                         break;
  43.  
  44.                 for (i = 0; i < 2; i++) {                               /* move the piston */
  45.                         wactive(small_w[0]);
  46.                         wshift(DOWN);
  47.                         wactive(small_w[2]);
  48.                         wshift(DOWN);
  49.                         wactive(small_w[1]);
  50.                         wshift(UP);
  51.                         wactive(small_w[3]);
  52.                         wshift(UP);
  53.                 }
  54.  
  55.                 for (i = 0; i < 2; i++) {
  56.                         wactive(small_w[0]);
  57.                         wshift(UP);
  58.                         wactive(small_w[2]);
  59.                         wshift(UP);
  60.                         wactive(small_w[1]);
  61.                         wshift(DOWN);
  62.                         wactive(small_w[3]);
  63.                         wshift(DOWN);
  64.                 }
  65.         }
  66.  
  67.         wclose(msg_w);
  68.         for (i = 0; i < 4; i++) {
  69.                 wclose(small_w[i]);
  70.                 wclose(large_w[i]);
  71.         }
  72.  
  73.         wset_ctype(CSR_NORMAL);                                         /* set cursor to normal type */
  74.         exit(0);
  75. }
  76.