Metropoli BBS
VIEWER: vdemo.slt MODE: TEXT (ASCII)
/****************************************************************/
/*                                                              */
/*  Demo of how to use various video display, cut, paste, and   */
/*  other video manipulations.                                  */
/*                                                              */
/*                   Copyright 1995 deltaComm Development, Inc. */
/*                                                              */
/****************************************************************/

main()
{
 int c, d, e, m, o;
 str dem[8];
 int dp, ep, mp, op;

 clear_scr();                             // Clear screen
 gotoxy(10, 10);                          // Move to position 10, 10
 c=_fore_color;                           // Save & change
 _fore_color=5;                           // color
 printsc("DEMO");
 _fore_color=c;

 vgetchrs(10, 10, dem, 0, 4);             // Read characters from screen
 for (c=11; c<20; c=c+1)                  // Loop, printing chars on
  vputchrs(10, c, dem, 0, 4, c-10);       // successive lines in colors

 vgetchrsa(10, 10, dem, 0, 4);            // Read chars from screen in color

 gotoxy(10, 10);
 d=vgetchr();                             // Read one char including color
 gotoxy(11, 10);                          // Lather, rinse, repeat 4 times
 e=vgetchr();
 gotoxy(12, 10);
 m=vgetchr();
 gotoxy(13, 10);
 o=vgetchr();

 dp=ep=mp=op=10;                          // set all four of these ints to 10

 while ((dp<20) or (ep<20) or (mp<20) or (op<20))
  {                                       // Loop while any not complete
   c=random(4)+1;                         // Select one of the four randomly

   if ((c==1) and (dp<20))                // Test if our random selection has
    {                                     // been incremented to 20.  If not,
     dp=dp+1;                             // Increment position one, and then
     gotoxy(10, dp);                      // go there.  Put the "d" character
     vputchr(d);                          // on-screen, delay 1/5 second, and
     delay(2);                            // move on through the loop.
    }

   if ((c==2) and (ep<20))                // Each letter, D, E, M, O, needs to
    {                                     // be tested in the same manner.  The
     ep=ep+1;                             // end result is an interesting
     gotoxy(11, ep);                      // video "DEMO"....
     vputchr(e);
     delay(2);
    }

   if ((c==3) and (mp<20))
    {
     mp=mp+1;
     gotoxy(12, mp);
     vputchr(m);
     delay(2);
    }

   if ((c==4) and (op<20))
    {
     op=op+1;
     gotoxy(13, op);
     vputchr(o);
     delay(2);
    }
  }

 vputchrsa(10, 21, dem, 0, 4);            // Put all chars on-screen in color
}
[ RETURN TO DIRECTORY ]