joystick.h 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/unix/joystick.h
  3. // Purpose: wxJoystick class
  4. // Author: Guilhem Lavaux
  5. // Modified by:
  6. // Created: 01/02/97
  7. // Copyright: (c) Guilhem Lavaux
  8. // Licence: wxWindows licence
  9. /////////////////////////////////////////////////////////////////////////////
  10. #ifndef _WX_UNIX_JOYSTICK_H_
  11. #define _WX_UNIX_JOYSTICK_H_
  12. #include "wx/event.h"
  13. class WXDLLIMPEXP_FWD_CORE wxJoystickThread;
  14. class WXDLLIMPEXP_ADV wxJoystick: public wxObject
  15. {
  16. DECLARE_DYNAMIC_CLASS(wxJoystick)
  17. public:
  18. /*
  19. * Public interface
  20. */
  21. wxJoystick(int joystick = wxJOYSTICK1);
  22. virtual ~wxJoystick();
  23. // Attributes
  24. ////////////////////////////////////////////////////////////////////////////
  25. wxPoint GetPosition() const;
  26. int GetPosition(unsigned axis) const;
  27. bool GetButtonState(unsigned button) const;
  28. int GetZPosition() const;
  29. int GetButtonState() const;
  30. int GetPOVPosition() const;
  31. int GetPOVCTSPosition() const;
  32. int GetRudderPosition() const;
  33. int GetUPosition() const;
  34. int GetVPosition() const;
  35. int GetMovementThreshold() const;
  36. void SetMovementThreshold(int threshold) ;
  37. // Capabilities
  38. ////////////////////////////////////////////////////////////////////////////
  39. bool IsOk() const; // Checks that the joystick is functioning
  40. static int GetNumberJoysticks() ;
  41. int GetManufacturerId() const ;
  42. int GetProductId() const ;
  43. wxString GetProductName() const ;
  44. int GetXMin() const;
  45. int GetYMin() const;
  46. int GetZMin() const;
  47. int GetXMax() const;
  48. int GetYMax() const;
  49. int GetZMax() const;
  50. int GetNumberButtons() const;
  51. int GetNumberAxes() const;
  52. int GetMaxButtons() const;
  53. int GetMaxAxes() const;
  54. int GetPollingMin() const;
  55. int GetPollingMax() const;
  56. int GetRudderMin() const;
  57. int GetRudderMax() const;
  58. int GetUMin() const;
  59. int GetUMax() const;
  60. int GetVMin() const;
  61. int GetVMax() const;
  62. bool HasRudder() const;
  63. bool HasZ() const;
  64. bool HasU() const;
  65. bool HasV() const;
  66. bool HasPOV() const;
  67. bool HasPOV4Dir() const;
  68. bool HasPOVCTS() const;
  69. // Operations
  70. ////////////////////////////////////////////////////////////////////////////
  71. // pollingFreq = 0 means that movement events are sent when above the threshold.
  72. // If pollingFreq > 0, events are received every this many milliseconds.
  73. bool SetCapture(wxWindow* win, int pollingFreq = 0);
  74. bool ReleaseCapture();
  75. protected:
  76. int m_device;
  77. int m_joystick;
  78. wxJoystickThread* m_thread;
  79. };
  80. #endif // _WX_UNIX_JOYSTICK_H_