| 1 | ///////////////////////////////////////////////////////////////////////////// |
| 2 | // Name: joystick.h |
| 3 | // Purpose: wxJoystick class |
| 4 | // Author: Guilhem Lavaux |
| 5 | // Modified by: |
| 6 | // Created: 01/02/97 |
| 7 | // RCS-ID: $Id$ |
| 8 | // Copyright: |
| 9 | // Licence: wxWindows licence |
| 10 | ///////////////////////////////////////////////////////////////////////////// |
| 11 | |
| 12 | #ifndef __JOYSTICKH__ |
| 13 | #define __JOYSTICKH__ |
| 14 | |
| 15 | #ifdef __GNUG__ |
| 16 | #pragma interface "joystick.h" |
| 17 | #endif |
| 18 | |
| 19 | #include "wx/event.h" |
| 20 | #include "wx/thread.h" |
| 21 | |
| 22 | class WXDLLEXPORT wxJoystick: public wxObject, public wxThread |
| 23 | { |
| 24 | DECLARE_DYNAMIC_CLASS(wxJoystick) |
| 25 | public: |
| 26 | /* |
| 27 | * Public interface |
| 28 | */ |
| 29 | |
| 30 | wxJoystick(int joystick = wxJOYSTICK1); |
| 31 | |
| 32 | // Attributes |
| 33 | //////////////////////////////////////////////////////////////////////////// |
| 34 | |
| 35 | wxPoint GetPosition(void) const; |
| 36 | int GetZPosition(void) const; |
| 37 | int GetButtonState(void) const; |
| 38 | int GetPOVPosition(void) const; |
| 39 | int GetPOVCTSPosition(void) const; |
| 40 | int GetRudderPosition(void) const; |
| 41 | int GetUPosition(void) const; |
| 42 | int GetVPosition(void) const; |
| 43 | int GetMovementThreshold(void) const; |
| 44 | void SetMovementThreshold(int threshold) ; |
| 45 | |
| 46 | // Capabilities |
| 47 | //////////////////////////////////////////////////////////////////////////// |
| 48 | |
| 49 | bool IsOk(void) const; // Checks that the joystick is functioning |
| 50 | int GetNumberJoysticks(void) const ; |
| 51 | int GetManufacturerId(void) const ; |
| 52 | int GetProductId(void) const ; |
| 53 | wxString GetProductName(void) const ; |
| 54 | int GetXMin(void) const; |
| 55 | int GetYMin(void) const; |
| 56 | int GetZMin(void) const; |
| 57 | int GetXMax(void) const; |
| 58 | int GetYMax(void) const; |
| 59 | int GetZMax(void) const; |
| 60 | int GetNumberButtons(void) const; |
| 61 | int GetNumberAxes(void) const; |
| 62 | int GetMaxButtons(void) const; |
| 63 | int GetMaxAxes(void) const; |
| 64 | int GetPollingMin(void) const; |
| 65 | int GetPollingMax(void) const; |
| 66 | int GetRudderMin(void) const; |
| 67 | int GetRudderMax(void) const; |
| 68 | int GetUMin(void) const; |
| 69 | int GetUMax(void) const; |
| 70 | int GetVMin(void) const; |
| 71 | int GetVMax(void) const; |
| 72 | |
| 73 | bool HasRudder(void) const; |
| 74 | bool HasZ(void) const; |
| 75 | bool HasU(void) const; |
| 76 | bool HasV(void) const; |
| 77 | bool HasPOV(void) const; |
| 78 | bool HasPOV4Dir(void) const; |
| 79 | bool HasPOVCTS(void) const; |
| 80 | |
| 81 | // Operations |
| 82 | //////////////////////////////////////////////////////////////////////////// |
| 83 | |
| 84 | // pollingFreq = 0 means that movement events are sent when above the threshold. |
| 85 | // If pollingFreq > 0, events are received every this many milliseconds. |
| 86 | bool SetCapture(wxWindow* win, int pollingFreq = 0); |
| 87 | bool ReleaseCapture(void); |
| 88 | |
| 89 | protected: |
| 90 | int m_joystick; |
| 91 | wxPoint m_lastposition; |
| 92 | int m_axe[15]; |
| 93 | int m_buttons; |
| 94 | wxWindow *m_catchwin; |
| 95 | int m_polling; |
| 96 | |
| 97 | void *Entry(void); |
| 98 | }; |
| 99 | |
| 100 | #endif |
| 101 | // __JOYSTICKH__ |
| 102 | |