home *** CD-ROM | disk | FTP | other *** search
/ Lion Share / lionsharecd.iso / utils_mz / v10n11.zip / VIDEO.C < prev    next >
Text File  |  1991-05-10  |  2KB  |  51 lines

  1. // video.c
  2.  
  3. #include    <stdio.h>
  4. #include    <conio.h>
  5.  
  6. extern char _video;                             // declare external variable
  7.  
  8. #define TextColor(foreground,background)    (foreground+(background<<4))
  9. #define CRLF    "\n\r"
  10.  
  11. void display_textinfo(struct text_info *t);
  12.  
  13. void main(void)
  14.     {
  15.     struct text_info textinfo, *viddata = (struct text_info *)&_video;
  16.  
  17.     window(10,5,70,22);                         // set window size
  18.     textattr(TextColor(BLACK,CYAN));            // set text colors
  19.     clrscr();                                   // clear screen
  20.     gettextinfo(&textinfo);                     // TC function
  21.  
  22.     cprintf(CRLF "Data returned by gettextinfo():" CRLF);
  23.     display_textinfo(&textinfo);
  24.  
  25.     cprintf(CRLF "Data acquired via _video and direct memory access:" CRLF);
  26.     display_textinfo(viddata);
  27.  
  28.     cprintf(CRLF CRLF CRLF "Press any key to continue...");
  29.     getch();
  30.  
  31.     window(1,1,80,25);
  32.     textattr(TextColor(LIGHTGRAY,BLACK));
  33.     clrscr();
  34.     }
  35.  
  36.  
  37. void display_textinfo(struct text_info *t)
  38.     {
  39.     cprintf("Window parameters: left=%d top=%d right=%d bottom=%d" CRLF,
  40.         t->winleft,t->wintop,
  41.         t->winright,t->winbottom);
  42.     cprintf("Current Text Attribute:%d  Normal attribute:%d" CRLF,
  43.         t->attribute,
  44.         t->normattr);
  45.     cprintf("Video mode:%d" CRLF,t->currmode);
  46.     cprintf("Screen dimensions (width x height): %dx%d" CRLF,
  47.         t->screenwidth,
  48.         t->screenheight);
  49.     cprintf("Cursor Position: X=%d Y=%d" CRLF,t->curx, t->cury);
  50.     }
  51.