home *** CD-ROM | disk | FTP | other *** search
/ Collection of Hack-Phreak Scene Programs / cleanhpvac.zip / cleanhpvac / FNTPAK32.ZIP / C.EXE / DEMO_SYM.C < prev    next >
C/C++ Source or Header  |  1995-08-16  |  4KB  |  128 lines

  1. /***********************************************************************
  2.  
  3.     Demo_SYM.C                Copyright 1994, Rob W. Smetana
  4.  
  5.     TURN screen-swapping on if appropriate!!!
  6.  
  7.     Demonstrate how to:
  8.  
  9.      1.  Select symbols (or icons) from Font Pak's library.
  10.  
  11.      2.  Determine how many symbols there are.
  12.  
  13.     Requires:
  14.  
  15.      1.  LdSymbols.OBJ (text-mode symbols)
  16.  
  17.     Notes:
  18.           It is CRITICAL that you be in TEXT-mode when you call the
  19.           text-mode procedures.  A crash awaits you if you're not.
  20.  
  21. *************************************************************************/
  22.  
  23. #include <font_pak.h>       /* for prototypes */
  24. #include <dos.h>            /* for CLS (Clear Screen) and LOCATE */
  25.  
  26.  
  27. /* We'll demonstrate these functions.
  28.    Prototypes are in Font_Pak.H.  Functions are in LDCursor.Obj.
  29.  
  30.    void extern pascal far RSLOADSYMBOL (int, int, int);
  31.    int  extern pascal far NUM16SYMBOLS ();
  32.    int  extern pascal far GetMonitor (); (in video.obj)
  33. */
  34.  
  35. #define  VIDEO  0x10        /* ditto */
  36.  
  37. /* prototypes for local functions */
  38. void locate (unsigned char , unsigned char);
  39. void cls (unsigned char);
  40.  
  41. /* locate the cursor using BIOS SetCursor function -- page 0 hardcoded */
  42.  
  43. void locate (row, col)
  44. unsigned char row, col;
  45. {
  46.     union REGS reg;
  47.     reg.h.ah = 2;
  48.     reg.h.dh = row-1;           /* we use 1,1 as top, left; BIOS uses 0,0 */
  49.     reg.h.dl = col-1;
  50.     reg.h.bh = 0;
  51.     int86(VIDEO, ®, ®);
  52. }
  53.  
  54.  
  55. /* CLS using BIOS Scroll function */
  56.  
  57. void cls (colr)
  58.  
  59. unsigned char colr;
  60.  
  61. {
  62.     union REGS reg;
  63.  
  64.     reg.h.ah = 6;           /* service 6 -- scroll up  */
  65.     reg.h.al = 0;           /* scroll 0 lines -- clear */
  66.  
  67.     reg.h.ch = 0;           /* scroll 25 x 80 screen:  0,0 to 24,79 */
  68.     reg.h.cl = 0;
  69.     reg.h.dh = 24;
  70.     reg.h.dl = 79;
  71.     reg.h.bh = colr;
  72.     int86(VIDEO, ®, ®);
  73. }
  74.  
  75.  
  76. int main (void)
  77. {
  78.     int WhichSymbol, Block, AsciiCode;
  79.     int NumSymbols;
  80.  
  81.     NumSymbols = NUM16SYMBOLS (); /* how many 16-point symbols are there?*/
  82.  
  83.     cls(27);
  84.     locate (1, 1);
  85.  
  86.  
  87.     if (GETMONITOR() < 4)         /* Bail out if no EGA/VGA */
  88.        {
  89.         printf ("Sorry. This demo requires an EGA, VGA or compatible monitor.");
  90.         return (-99);
  91.        }
  92.  
  93.  
  94.     printf("          Demonstrate using Font Pak's %d TEXT-MODE symbols and icons.\n\n",NumSymbols);
  95.     printf(" NOTE:  We're displaying 2 symbols at once -- since some are 2-byte symbols.\n");
  96.     printf("        BE SURE to read Font Pak's manual for important tips on using symbols.\n\n");
  97.     printf("                      Press <SPACE> to move to the next one.");
  98.  
  99.     AsciiCode = 192;                 /* re-map the shape of ASCII 192 & 193 */
  100.  
  101.     for (WhichSymbol = 1; WhichSymbol < NumSymbols+1; WhichSymbol++)
  102.        {
  103.  
  104.          /* load the next one */
  105.          RSLOADSYMBOL (0, WhichSymbol, AsciiCode);
  106.          RSLOADSYMBOL (0, WhichSymbol+1, AsciiCode+1);
  107.          locate (12, 26);
  108.          printf ("Here are symbols %d and %d --> └┴ ", WhichSymbol, WhichSymbol + 1);
  109.  
  110.          /* wait for a key */
  111.          getch ();
  112.  
  113.          WhichSymbol = WhichSymbol + 1;  /* displaying 2, so step by 2 */
  114.  
  115.          /* gotoxy (30,4); write('This is cursor # ', WhichSymbol); */
  116.      }
  117.     cls(27);
  118.  
  119.     RSLOADDEFAULT(14, 0);            /* restore the default font */
  120.     RSLOADDEFAULT(16, 0);
  121.  
  122.     locate (12, 15);
  123.     printf ("That's all . . .  And remember, this was ALL in TEXT mode!\n\n\n\n\n");
  124.     return (0);
  125.  
  126. }   /* end main */
  127.  
  128.