home *** CD-ROM | disk | FTP | other *** search
/ Point Programming 1 / PPROG1.ISO / c / tpal4c10 / tpaldemo.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-06-03  |  5.3 KB  |  179 lines

  1. /* TPAL4C demo program v1.00
  2.  
  3.  To compile this demo program you must create a project file containing:
  4.  
  5.         TPALDEMO.C
  6.         FONTS_x.LIB
  7.         TPALC_x.LIB
  8.  
  9.  'x' is the letter of the memory module you want to use.  (This demo requires
  10.  Compact or larger memory module!)
  11.  
  12.         S = small
  13.         M = medium
  14.         C = compact
  15.         L = large
  16.         H = huge
  17.  
  18.  * Note:  The unregistered version only contains the small memory module. *
  19.  
  20. */
  21.  
  22. #include <dos.h>
  23. #include <stdlib.h>
  24. #include <stdio.h>
  25. #include <conio.h>
  26. #include <string.h>
  27. #include <time.h>
  28. #include "fonts.h"
  29. #include "tpal.h"
  30.  
  31. void Center(int row, char st[80]);
  32. void InOut(void);
  33.  
  34. void main(void)
  35. {
  36.      int i;
  37.  
  38.      if (!TGetVGA())
  39.      {
  40.         printf("\nSorry, but you *MUST* have VGA to run this demo!\n\n");
  41.         exit(1);
  42.      }
  43.  
  44.      InitTPALDriver();
  45.      TFadeOutPalette(5);
  46.      _setcursortype(_NOCURSOR);
  47.      textattr(15);
  48.      clrscr();
  49.      TSetFont(script);
  50.      textattr(12);
  51.      Center(5, "Did you know that by accessing the video port directly");
  52.      textattr(10);
  53.      Center(7, "you can change the palette in any text video mode?");
  54.      textattr(13);
  55.      InOut();
  56.  
  57.      TSetFont(scribble);
  58.      Center(5, "Wouldn't your programs look better with");
  59.      textattr(9);
  60.      Center(7, "smooth-fading TEXT palettes?");
  61.      textattr(10);
  62.      Center(12, "(not to mention these cool fonts!)");
  63.      textattr(7);
  64.      Center(24, "Remember:  This is in text mode, not a graphic mode!");
  65.      InOut();
  66.  
  67.      TSetFont(puter);
  68.      textattr(15);
  69.      Center (2,"You can use ANY of VGA's 256,000 color combinations in TEXT mode!");
  70.      Center (25,"Press any key to continue ...");
  71.      gotoxy(1,5);
  72.      for (i=0;i<=14;i++)
  73.      {
  74.         textattr(14-i);
  75.         textbackground(i);
  76.         cprintf("                              This is awsome!!                                \r\n");
  77.      }
  78.      textbackground(0);
  79.      TFadeInPalette(7);
  80.      randomize();
  81.      while(!kbhit())
  82.      {
  83.         TSetPalette((rand()%62)+1,rand()%63,rand()%63,rand()%63);
  84.      }
  85.      getch();
  86.      TFadeOutPalette(7);
  87.      clrscr();
  88.      TResetPalette();
  89.      TBlankPalette();
  90.  
  91.      TSetFont(thix);
  92.      textattr(14);
  93.      Center(5, "This will work with any VGA video card!");
  94.      textattr(10);
  95.      Center(7, "Works with all the extended 256 text colors (VGA)");
  96.      textattr(11);
  97.      Center(9, "And now YOU can do this too!");
  98.      InOut();
  99.  
  100.      TSetFont(future);
  101.      textattr(15);
  102.      textbackground(7);
  103.      clrscr();
  104.      Center(12, "You can even set the brightness of the display!");
  105.      Center(14, "This is COLOR 15 (bright white) on 7 (white)");
  106.      Center(15, "The brightness is at 50%!");
  107.      TSetBright(31);
  108.      delay(3000);
  109.      Center(14, "This is still COLOR 15 (bright white) on 7 (white)");
  110.      Center(15, "But now the brightness is at 100% (normal)!");
  111.      TResetPalette();
  112.      delay(3000);
  113.      TFadeOutPalette(7);
  114.  
  115.      TSetFont(king);
  116.      textbackground(0);
  117.      clrscr();
  118.      Center(5, "You could fade-in ...");
  119.      textattr(13);
  120.      gotoxy(1, 10);
  121.      cprintf("                 █████  ████     █████  ██   ██ ████     ██  ██\r\n");
  122.      cprintf("                ██   ██  ██     ██   ██ ██   ██  ██      ██  ██\r\n");
  123.      cprintf("                ███      ██     ██   ██ ██   ██  ██      ██  ██\r\n");
  124.      cprintf("                  ███    ██     ██   ██ ██ █ ██  ██       ████\r\n");
  125.      cprintf("                    ███  ██     ██   ██ ███████  ██        ██\r\n");
  126.      cprintf("                ██   ██  ██  ██ ██   ██ ███████  ██  ██    ██\r\n");
  127.      cprintf("                 █████  ███████  █████  ██   ██ ███████   ████\r\n");
  128.      TFadeInPalette(40);
  129.      delay(2000);
  130.      TFadeOutPalette(7);
  131.  
  132.      clrscr();
  133.      textattr(13);
  134.      Center(5, "OR you can fade-in nice and ...");
  135.      textattr(15);
  136.      gotoxy(1, 10);
  137.      cprintf("                     ███████   ███    █████   ██████    ██\r\n");
  138.      cprintf("                      ██   █  ██ ██  ██   ██  █ ██ █    ██\r\n");
  139.      cprintf("                      ██     ██   ██ ███        ██      ██\r\n");
  140.      cprintf("                      ████   ██   ██   ███      ██      ██\r\n");
  141.      cprintf("                      ██     ███████     ███    ██      ██\r\n");
  142.      cprintf("                      ██     ██   ██ ██   ██    ██\r\n");
  143.      cprintf("                     ████    ██   ██  █████    ████     ██\r\n");
  144.      TFadeInPalette(1);
  145.      delay(2000);
  146.      TFadeOutPalette(7);
  147.  
  148.      clrscr();
  149.      TResetFont();
  150.      Center(1, "TPAL4C v1.00 - (C) Copyright 1994 Peak Computing");
  151.      textattr(12);
  152.      Center(5, "But of course, it's all up to you!");
  153.      textattr(7);
  154.      Center(9, "If you plan to use these routines I ask you to");
  155.      Center(11, "PLEASE REGISTER!");
  156.      Center(13, "Registration only costs $15.00");
  157.      Center(15, "See ORDER.FRM for registration information.");
  158.      gotoxy(1, 20);
  159.      TFadeInPalette(7);
  160.      delay(3000);
  161.      TPALDone();
  162.      _setcursortype(_NORMALCURSOR);
  163.      exit(0);
  164. }
  165.  
  166. void Center(int row, char st[80])
  167. {
  168.     gotoxy(40-(strlen(st)/2+.5),row);
  169.     cprintf("%s",st);
  170. }
  171.  
  172. void InOut(void)
  173. {
  174.     TFadeInPalette(7);
  175.     delay(2500);
  176.     TFadeOutPalette(7);
  177.     clrscr();
  178. }
  179.