home *** CD-ROM | disk | FTP | other *** search
/ Collection of Hack-Phreak Scene Programs / cleanhpvac.zip / cleanhpvac / TANK11.ZIP / SOURCE.ZIP / JOY.H < prev    next >
C/C++ Source or Header  |  1993-01-17  |  884b  |  33 lines

  1. /* Demonstration of reading joy stick postition
  2.     Written March 24, 1988
  3.     Written by : ajmyrvold@violet.waterloo.edu (Alan J. Myrvold)
  4.     Technical assistance from : uunet!netxcom!jallen (John Allen)
  5.     Turbo C Version 1.0
  6.  
  7.     Changes: 1/93 Kevin Dahlhausen ap0962po.cwru.edu
  8.         thresholds, JoyStickx()
  9.  
  10. */
  11.  
  12. #ifndef __joystick__
  13.  
  14. #define __joystick__
  15. typedef struct {
  16.     int sw1,sw2;
  17.     int x,y;
  18.     int cenx,ceny;
  19.     int tu, td, tl, tr;  /* threshholds */
  20. } joy_stick;
  21.  
  22. #define JoyStickLeft(j)        (j.x <= j.tl)
  23. #define JoyStickRight(j)    (j.x >= j.tr)
  24. #define JoyStickUp(j)        (j.y <= j.tu)
  25. #define JoyStickDown(j)        (j.y >= j.td)
  26. #define JoyButton1(j)        (j.sw1)
  27. #define JoyButton2(j)        (j.sw2)
  28.  
  29. extern void read_stick(int stick,joy_stick *joy);
  30. extern int choose_stick();
  31. extern void set_thresh(int stick, joy_stick *joy);
  32. extern int joy_state(int stick, joy_stick *j);
  33. #endif