home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 22 gnu / 22-gnu.zip / spmio10.zip / gcc2 / pmio / test3.cc < prev    next >
C/C++ Source or Header  |  1994-08-28  |  982b  |  47 lines

  1. /*
  2.  * A simple pmio program that demonstrates color.
  3.  */
  4.  
  5. #include <stdio.h>
  6. #include <pmio.h>
  7. #include <unistd.h>
  8.  
  9. const char *color_names[] = {
  10.   "Black", "Blue", "Green", "Cyan", "Red", "Magenta", "Brown", "Light Gray",
  11.   "Dark Gray", "Light Blue", "Light Green", "Light Cyan", "Light Red",
  12.   "Light Magenta", "Yellow", "White"
  13.   };
  14.  
  15. int main ()
  16. {
  17.   start_pmio ();
  18.   printf ("Hello, world!\n");
  19.   int i;
  20.   for (i = 0; i < 16; i++)
  21.     {
  22.       set_fg ((i < 8) ? WHITE : BLACK);
  23.       set_bg (i);
  24.       printf (color_names[i]);
  25.       clreol ();
  26.       printf ("\n");
  27.       usleep (250000);
  28.     }
  29.   set_fg (BLACK);
  30.   set_bg (WHITE);
  31.   printf ("\n\nGoodbye world....\n");
  32.   for (i = 0; i < 16; i++)
  33.     {
  34.       printf ("%d\n", 16-i);
  35.       usleep (250000);
  36.     }
  37.   // Speed test
  38.   for (i = 0; i < 16; i++)
  39.     {
  40.       set_fg ((i < 8) ? WHITE : BLACK);
  41.       set_bg (i);
  42.       clrscr ();
  43.       printf (color_names[i]);
  44.     }
  45.   return 0;
  46. }
  47.