Metropoli BBS
VIEWER: wgt28.c MODE: TEXT (ASCII)
/*
==============================================================================
                      WordUp Graphics Toolkit Version 5.0                     
                             Demonstration Program 28                         
                                                                              
 Demonstrates wpan.                                                                
 Since 320x200x256 doesn't support multiple pages, the vertical             
 lines you might see when the screen scrolls down is just what is           
 in memory after the VGA screen buffer. Do not be alarmed.                  
                                                                              
 *** PROJECT ***                                                             
 This program requires the file WGT5_WC.LIB to be linked.                    
                                                                              
 *** DATA FILES ***                                                          
 NONE                                                                        
                                                           WATCOM C++ VERSION 
==============================================================================
*/

#include <conio.h>
#include <wgt5.h>

void main(void)
{
  short i;
  short oldmode;

  if ( !vgadetected () )
  {
    printf("Error - VGA card required for any WGT program.\n");
    exit (0);
  }
  printf ("WGT Example #28\n\n");
  printf ("VGA Hardware panning is demonstrated using WPAN.\n");
  printf ("Press a key to end the program at any time.\n");
  printf ("\n\nPress any key to continue.\n");
  getch ();


  oldmode = wgetmode ();         /* Gets the current mode */
  vga256 ();                     /* Initialize graphics mode */

  for (i = 1; i < 200; i++)      /* Draw a background for screen */
  {
    wsetcolor (i);
    wline (0, 0, 319, i);
    wsetcolor (200 - i);
    wline (319, 199, 0, i);
  }

  do
  {
    for (i = 0; i < 100; i++)       /* Pan down a row at a time */
    {
      wpan (i * 320);
      delay (20);
      if (kbhit ())
        break;
    }
    for (i = 0; i < 50; i++)        /* Make the screen shake */
    {
      wpan (rand () % 10);
      delay (40);
      if (kbhit ())
        break;
    }
  } while (!kbhit ());

  getch ();
  wsetmode (oldmode);            /* Restore initial video mode */
}
[ RETURN TO DIRECTORY ]