home *** CD-ROM | disk | FTP | other *** search
/ SPACE 2 / SPACE - Library 2 - Volume 1.iso / games / 144 / pascal / joytest.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1987-06-16  |  2.3 KB  |  84 lines

  1. { -----------------------------------------------------------------------------
  2.                                  NOTICE:
  3.  
  4.       THESE MATERIALS are UNSUPPORTED by OSS!  If you do not understand how to
  5.       use them do not contact OSS for help!  We will not teach you how to 
  6.       program in Pascal.  If you find an error in these materials, feel free
  7.       to SEND US A LETTER explaining the error, and how to fix it.
  8.  
  9.  
  10.       THE BOTTOM LINE:
  11.  
  12.          Use it, enjoy it, but you are on your own when using these materials!
  13.  
  14.  
  15.                                DISCLAIMER:
  16.  
  17.       OSS makes no representations or warranties with respect to the contents
  18.       hereof and specifically disclaim all warranties of merchantability or
  19.       fitness for any particular purpose.   This document is subject to change
  20.       without notice.
  21.       
  22.       OSS provides these materials for use with Personal Pascal.  Use them in
  23.       any way you wish.
  24.  
  25.  
  26.    -------------------------------------------------------------------------- }
  27.  
  28.  
  29. {**************************************************************************
  30.  
  31.         Program: JOYTEST.PAS
  32.  
  33.         11/17/86 MER
  34.  
  35.         This program demonstrates how to call the routines
  36.         in the joysubs.o module.
  37.  
  38.         LINK with JOYSUBS.O ( type "JOYSUBS.O" in the ADDITIONAL LINK FILES
  39.         area in LINKER OPTIONS... menu selection ).
  40.  
  41. **************************************************************************}
  42.  
  43. PROGRAM joytest;
  44.  
  45.   VAR c: char;
  46.  
  47. { These 3 routines are in the joysubs file-- we need to declare them EXTERNAL
  48.     here: }
  49.  
  50. { Call this before calling Stick() to turn off the mouse }
  51.  
  52.   PROCEDURE Init_Stick;
  53.     EXTERNAL;
  54.  
  55. { Call this to turn the mouse back on }
  56.  
  57.   PROCEDURE End_Stick;
  58.     EXTERNAL;
  59.  
  60.  
  61. { Call this routine to get the current joystick value.  The values returned
  62.   for the eight directions are as follows:
  63.  
  64.      5 1 9
  65.       \|/       If the trigger is depressed, then 128 will be added to the
  66.     4--0--8     direction value
  67.       /|\
  68.      6 2 10
  69.  
  70.   "which_stick" should be given the value 0 or 1. }
  71.  
  72.   FUNCTION Stick( which_stick: integer ): integer;
  73.     EXTERNAL;
  74.  
  75.  
  76.   BEGIN
  77.     Init_Stick;
  78.     REPEAT
  79.       writeln( Stick(0):2:h, ' ', Stick(1):2:h );
  80.     UNTIL keypress;
  81.     read(c);
  82.     End_Stick;
  83.   END.
  84.  
  85. {  End of file:  JOYTEST.PAS }
  86.