home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft-Programers-Library-v1.3.iso / sampcode / qc_prog / chap14 / initstuf.c < prev    next >
Encoding:
C/C++ Source or Header  |  1988-04-07  |  1.8 KB  |  66 lines

  1. /*  initstuf.c -- initializing module for grafchar.c */
  2. /*  assign graphics character codes to an array      */
  3. /*  and initialize screen                            */
  4.  
  5. #include "scrn.h"   /* Clearscr(), Home(), Setcurs() */
  6. #include "grafchar.h"
  7. extern unsigned char Grchr[];  /* defined in grafchar.c */
  8. void Print_attr(char *, unsigned char, unsigned char);
  9. void Init_stuff()
  10. {
  11.     int i;
  12.  
  13.     /* initialize array with graphics characters */
  14.     for (i = 0; i < NUMCHARS; i++)
  15.         Grchr[i] = GCSTART + i;
  16.     Clearscr();
  17.     Home();
  18.  
  19.     /*   show key meanings at bottom of screen */
  20.     Setcurs(BOTLINE + 1, 0, PAGE);
  21.     for (i = 0; i < 40; i++) /* graphics chars */
  22.     {
  23.         putch(Grchr[i]);
  24.         putch(SPACE);
  25.     }
  26.     Setcurs(BOTLINE + 2, 0, PAGE);
  27.     for (i = 0; i < 40; i++)  /* key assignments */
  28.     {
  29.         putch('0' + i);
  30.         putch(SPACE);
  31.     }
  32.     Setcurs(BOTLINE + 3, 0, PAGE);
  33.     for (i = 40; i < NUMCHARS; i++) /* second row */
  34.     {
  35.         putch(Grchr[i]);
  36.         putch(SPACE);
  37.     }
  38.         /* show function key assignments */
  39.     printf(" SPACE : ERASE  PgUp : No Draw ");
  40.     printf(" PgDn : Draw  ESC : Quit");
  41.     Setcurs(BOTLINE + 4, 0, PAGE);
  42.     for (i = 40; i < NUMCHARS; i++) /* second row */
  43.     {
  44.         putch('0' + i);
  45.         putch(SPACE);
  46.     }
  47.        /* more function key assignments */
  48.     Print_attr("F1 : Normal ", NORMAL, PAGE);
  49.     Print_attr("F2 : Reverse Video ", VIDREV, PAGE);
  50.     Setcurs(BOTLINE + 5, 16, PAGE);
  51.     Print_attr("F3 : Blinking ", NORMAL | BLINK, PAGE);
  52.     Print_attr("F4 : Intense ", NORMAL | INTENSE, PAGE);
  53.     Home();
  54. }
  55.  
  56. void Print_attr(str, attr, page)
  57. char *str;
  58. unsigned char attr, page;
  59. {
  60.     while (*str != '\0')
  61.     {
  62.         Write_ch_atr(*str++, attr, page, 1);
  63.         Cursrt();
  64.     }
  65. }
  66.