home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / progm / tc-book.zip / TESTMOVE.C < prev    next >
Text File  |  1987-08-20  |  1KB  |  50 lines

  1. /* ------------ testmove.c ------------ */
  2.  
  3. #include "twindow.h"
  4. #include "keys.h"
  5.  
  6. void testmove()
  7. {
  8.     WINDOW *wndA, *wndB, *wndC;
  9.     int c;
  10.  
  11.     wndA = establish_window(5, 5, 9, 19);
  12.     wndB = establish_window(10, 3, 9, 23);
  13.     wndC = establish_window(13, 8, 9, 12);
  14.     set_colors(wndA, ALL, RED, YELLOW, BRIGHT);
  15.     set_colors(wndB, ALL, AQUA, YELLOW, BRIGHT);
  16.     set_colors(wndC, ALL, WHITE, YELLOW, BRIGHT);
  17.     display_window(wndA);
  18.     display_window(wndB);
  19.     display_window(wndC);
  20.     wprintf(wndB, "\n I wouldn't care who");
  21.     wprintf(wndB, "\n wrote the laws if I");
  22.     wprintf(wndB, "\n could write the");
  23.     wprintf(wndB, "\n ballads.");
  24.     wprintf(wndB, "\n\n    Thomas Jefferson");
  25.     do    {
  26.         int x = 0, y = 0;
  27.         c = get_char();
  28.         switch (c)    {
  29.             case FWD:    x++;
  30.                         break;
  31.             case BS:    --x;
  32.                         break;
  33.             case UP:    --y;
  34.                         break;
  35.             case DN:    y++;
  36.             default:    break;
  37.         }
  38.         if (x || y)
  39.             rmove_window(wndB, x, y);
  40.     } while (c != ESC);
  41.     delete_window(wndA);
  42.     get_char();
  43.     delete_window(wndC);
  44.     get_char();
  45.     delete_window(wndB);
  46. }
  47.  
  48.  
  49.  
  50.