Metropoli BBS
VIEWER: wgt30.c MODE: TEXT (ASCII)
/*
==============================================================================
                      WordUp Graphics Toolkit Version 5.0                     
                             Demonstration Program 30                         
                                                                              
 Show how mouse routines may be used in text modes.                          
                                                                              
 *** PROJECT ***                                                             
 This program requires the file WGT5_WC.LIB to be linked.                    
                                                                              
 *** DATA FILES ***                                                          
 NONE                                                                        
                                                           WATCOM C++ VERSION 
==============================================================================
*/

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


void main(void)
{
  short i;                       /* Loop counter */

  printf ("WGT Example #30\n\n");
  printf ("Mouse routines are demonstrated in a couple of different text modes.\n");
  printf ("Press a key to end each section of the program.\n");
  printf ("\n\nPress any key to continue.\n");
  getch ();

  wsetmode (3);                  /* Color, 80-column text mode */

  i = minit ();                  /* Initialize mouse */
  mon ();                        /* Turn on cursor */
  do {
    printf("Mouse coordinates: %i,%i     Button: %i     %c", mouse.mx/4, mouse.my/8, mouse.but, 13);
  } while (!kbhit ());
  moff ();                       /* Hide cursor */
  getch ();

  wsetmode (1);                  /* Set to condensed text mode */
  minit ();

  mon ();                        /* Turn on cursor */
  do {
    printf ("Mouse coordinates: %2i,%2i     Button: %2i%c", mouse.mx/8, mouse.my/8, mouse.but, 13);
  } while (!kbhit ());
  moff ();                       /* Hide cursor */
  mdeinit ();                    /* Deinitialize the mouse handler */

  printf ("\n");
  getch ();
  wsetmode (3);                /* Return to 80-column text mode */
}
[ RETURN TO DIRECTORY ]