home *** CD-ROM | disk | FTP | other *** search
/ Amiga ACS 1998 #6 / amigaacscoverdisc1998-061998.iso / games / descent / source / bios / testj.c < prev    next >
Text File  |  1998-06-08  |  3KB  |  115 lines

  1. /*
  2. THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
  3. SOFTWARE CORPORATION ("PARALLAX").  PARALLAX, IN DISTRIBUTING THE CODE TO
  4. END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
  5. ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
  6. IN USING, DISPLAYING,  AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
  7. SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
  8. FREE PURPOSES.  IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
  9. CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES.  THE END-USER UNDERSTANDS
  10. AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.  
  11. COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
  12. */
  13. /*
  14.     TESTJ.C - joystick testing routines
  15. */
  16.  
  17. #include <stdio.h>
  18. #include <conio.h>
  19.  
  20. #include "types.h"
  21. #include "joy.h"
  22. #include "key.h"
  23. #include "mouse.h"
  24. #include "swift.h"
  25. #include "fix.h"
  26. #include "timer.h"
  27.  
  28. void main (void)
  29. {
  30.     int k;
  31.     int x,y, e, i,j,t1,t2,t3;
  32.     int axis[4];
  33.     fix xt1, xt2, bt;
  34.     int axis_min[4], axis_center[4], axis_max[4], c1, c2, c3;
  35.  
  36.     setbuf( stdout, NULL );
  37.  
  38.     minit();
  39.     dpmi_init();
  40.     timer_init();
  41.     joy_init();
  42.     joy_set_slow_reading(JOY_BIOS_READINGS);
  43.     key_init();
  44. //    mouse_init();
  45.  
  46.     timer_set_rate( 9943 );
  47.  
  48.     joy_flush();
  49.  
  50.     t1 = timer_get_fixed_seconds();
  51.     
  52.     t1 = t2 = 0;
  53.     k = JOY_ALL_AXIS;
  54.     while (!key_inkey())    {
  55.         //k = joy_get_btns();
  56.         delay(100);
  57.         t1 = timer_get_fixed_seconds();
  58.         t3 = t1 - t2;
  59.         t2  = t1;
  60.         k = joy_get_button_down_time(0);
  61.         printf( "%f\t%f\n", f2fl(k), f2fl(t3) );
  62.         //k = joystick_read_raw_axis( JOY_ALL_AXIS, axis );
  63.         //printf( "X1:%d\tY1:%d\tX2:%d\tY2:%d\n", axis[0], axis[1], axis[2], axis[3] );
  64.     }
  65.     exit(0);
  66. }
  67.  
  68. /*
  69. Normal joystick
  70.     -2 buttons                    
  71.     -2 analog channels
  72.  
  73. Dual joysticks
  74.     -4 buttons
  75.     -4 analog channels
  76.  
  77. Thrustmaster (Pro) Flight Control System Mark I
  78.     -4 buttons
  79.     -If not used with WCS Mark II, then has a hat switch on channel BY
  80.     that returns 4 digital values.
  81.     
  82. Thrustmaster Weapons Control System Mark II
  83.     -adds analog throttle on BY, but makes the FCS hat switch return
  84.      
  85. CH Flightstick Pro
  86.     -4 buttons + hat switch (buttons use bit combinations)
  87.     -Analog throttle on BY.
  88.  
  89. Gravis Gamepad
  90.     -4 buttons
  91.     -XY axis returns digital values, needs sensitivity adjustment like keyboard
  92.  
  93. Logitech Cyberman
  94.     -3 digital buttons
  95.     -Pitch, bank, heading, up/down digital values, but in future might be analog
  96.     -Analog XY
  97.  
  98. Mouse
  99.     -3 digital buttons
  100.     -2 analog channels
  101.  
  102. analog throttle           {analog axis}
  103. analog turn up/down     {analog axis}
  104. analog turn left/right  {analog axis}
  105. analog slide up/down       [modifier]{analog axis}
  106. analog slide left/right [modifier]{analog axis}
  107.  
  108.  
  109.     
  110.  
  111.  
  112. */
  113.  
  114. 
  115.