home *** CD-ROM | disk | FTP | other *** search
/ Turbo Toolbox / Turbo_Toolbox.iso / 1991 / 01 / tricks / demo.c < prev    next >
Encoding:
C/C++ Source or Header  |  1990-10-22  |  4.3 KB  |  148 lines

  1. /*-< Anfang DEMO.C >--------------------------------------*
  2.  *  (c) 1990 by Manfred Birnkott  &  toolbox              *
  3.  *  Compiler: Turbo-C ab Version 2.0                      *
  4.  *--------------------------------------------------------*/
  5. #include <conio.h>
  6. #include "screen.h"
  7. #include "screen.c"
  8. /*--------------------------------------------------------*
  9.  *  Beispiel-Programm für die Anwendung der               *
  10.  *  SCREEN-Funktionen                                     *
  11.  *--------------------------------------------------------*/
  12. void main()
  13.   {int i;
  14.    char coord[] = {6,3,8,3,8,6,10,6,10,3,12,3,12,11,10,11,
  15.                    10,8,8,8,8,11,6,11,6,3};
  16.  
  17.    textattr(ATTR(BLUE,LIGHTGRAY)); clrscr();
  18.    cprintf("Demonstration der SCREEN-Funktionen:\r\n\r\n");
  19.  
  20.    cprintf("Linien vertikal und horizontal ");
  21.    drawvline(2,5,12); drawhline(5,12,30);
  22.    getch();
  23.  
  24.    cprintf("in beliebigen Stilen und Farben.");
  25.    textlinestyle(LINESTYLE_2);
  26.    drawvline(4,5,12); drawhline(6,12,30);
  27.    textlinestyle(LINESTYLE_1);
  28.    textlineattr(ATTR(RED,LIGHTGRAY);
  29.    drawvline(6,5,12); drawhline(7,12,30);
  30.    textlinestyle(LINESTYLE_2);
  31.    textlineattr(ATTR(YELLOW,BLUE);
  32.    drawvline(8,5,12); drawhline(8,12,30);
  33.    getch();
  34.  
  35.    gotoxy(35,5); cprintf("Oder Rahmen ");
  36.    textlineattr(ATTR(BLUE,LIGHTGRAY));
  37.    drawframe(35,7,55,10);
  38.    getch();
  39.  
  40.    cprintf("beliebiger Form und Farbe.");
  41.    framelinestyle(FRAMESTYLE_2);
  42.    textlineattr(ATTR(GREEN,LIGHTGRAY);
  43.    drawframe(57,7,65,12);
  44.    framelinestyle(FRAMESTYLE_4);
  45.    textlineattr(ATTR(WHITE,BLACK);
  46.    drawframe(67,7,78,11);
  47.    getch();
  48.  
  49.    gotoxy(35,14); cprintf("Mit Window-Unterstützung ");
  50.    window(35,16,70,25); textcolor(RED);
  51.    for (i=0;i<27;i++) cprintf("windowframe ");
  52.    window(40,18,60,21); textattr(ATTR(WHITE,BLUE));
  53.    clrscr();
  54.    framelinestyle(FRAMESTYLE_1);
  55.    textlineattr(ATTR(YELLOW,BLUE);
  56.    windowframe();
  57.    for (i=0;i<20;i++) cprintf("windowframe ");
  58.    getch();
  59.  
  60.    shadowmode(3); shadowattr(ATTR(DARKGRAY,BLACK));
  61.    windowframe();
  62.    window(1,1,80,25); textattr(ATTR(BLUE,LIGHTGRAY));
  63.    gotoxy(60,14); cprintf("und Schattenwurf.\r");
  64.    getch();
  65.  
  66.    cprintf("Aber der besondere Clou sind\r\n"
  67.            "die drei Überlappungsmodi.");
  68.    getch();
  69.    textlineattr(ATTR(GREEN,LIGHTGRAY));
  70.    textlinestyle(LINESTYLE_1);
  71.  
  72.    crosslinemode(0);
  73.    drawvline(18,19,21); drawhline(19,2,18);
  74.    drawvline(10,17,21);
  75.    gotoxy(1,23); cprintf("Modus 0: keine Überlappung");
  76.    getch();
  77.  
  78.    crosslinemode(1);
  79.    drawvline(18,19,21); drawhline(19,2,18);
  80.    drawvline(10,17,21);
  81.    gotoxy(1,23); cprintf("Modus 1: Überlappung      ");
  82.    getch();
  83.  
  84.    crosslinemode(2);
  85.    drawvline(18,19,21); drawhline(19,2,18);
  86.    drawvline(10,17,21);
  87.    gotoxy(1,23); cprintf("Modus 2: Überlappung\r\n"
  88.                          "und Glättung der Kanten");
  89.    getch();
  90.  
  91.    window(35,14,80,25); clrscr();
  92.    cprintf("Besondere Effekte erzielt man mit Modus 2:");
  93.    window(1,1,80,25);
  94.    getch();
  95.  
  96.    textlineattr(ATTR(CYAN,LIGHTGRAY));
  97.    shadowmode(0);
  98.    drawframe(35,16,60,23);
  99.    gotoxy(37,17); cprintf("Rahmen");
  100.    getch();
  101.  
  102.    drawhline(18,35,60);
  103.    gotoxy(37,19); cprintf("mit Unterteilungen");
  104.    getch();
  105.  
  106.    window(50,21,75,24); clrscr();
  107.    windowframe();
  108.    cprintf(" und überlappte Fenster.");
  109.    getch();
  110.  
  111.    window(1,1,80,12); clrscr();
  112.    cprintf("Beliebige Polygonzüge können ");
  113.    getch();
  114.  
  115.    cprintf("auf vielfache Weise gezeichnet werden.");
  116.    textlineattr(ATTR(RED,LIGHTGRAY));
  117.    crosslinemode(0); drawpolygon(13,coord);
  118.    getch();
  119.  
  120.    for (i=0;i<13;i++) coord[2*i]+=10;
  121.    crosslinemode(1); drawpolygon(13,coord);
  122.    getch();
  123.  
  124.    for (i=0;i<13;i++) coord[2*i]+=10;
  125.    crosslinemode(2); drawpolygon(13,coord);
  126.    getch();
  127.  
  128.    for (i=0;i<13;i++) coord[2*i]+=10;
  129.    textlinestyle(LINESTYLE_2); drawpolygon(13,coord);
  130.    getch();
  131.  
  132.    for (i=0;i<13;i++) coord[2*i]+=10;
  133.    textlinestyle(LINESTYLE_3); drawpolygon(13,coord);
  134.    getch();
  135.  
  136.    for (i=0;i<13;i++) coord[2*i]+=10;
  137.    textlinestyle(LINESTYLE_4); drawpolygon(13,coord);
  138.    getch();
  139.  
  140.    for (i=0;i<13;i++) coord[2*i]+=10;
  141.    textlinestyle("▓▓"); drawpolygon(13,coord);
  142.    getch();
  143.  
  144.    window(1,1,80,25); clrscr(); textcolor(RED);
  145.    gotoxy(30,12); cprintf("Ende der Demonstration.");
  146.    getch();
  147.   }
  148. /*-< Ende DEMO.C >----------------------------------------*/