Umasoft
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
Joystick.h
1 //
2 // Joystick.h - provide access to wxWidget's joystick capabilities for Win32
3 // if it was not compiled into the main library.
4 //
5 // Copyright (c) 2006-2008 Virtual Terrain Project
6 // Free for all uses, see license.txt for details.
7 //
8 
9 #include "wx/wxprec.h"
10 
11 #ifndef WX_PRECOMP
12 #include "wx/wx.h"
13 #endif
14 
15 #if WIN32
16 
17 #if wxUSE_JOYSTICK
18 #include "wx/joystick.h"
19 #else
20 
21 class wxJoystick
22 {
23  public:
24  /*
25  * Public interface
26  */
27  wxJoystick(int joystick = wxJOYSTICK1);
28 
29  // Attributes
31 
32  wxPoint GetPosition(void) const;
33  int GetZPosition(void) const;
34  int GetButtonState(void) const;
35  int GetPOVPosition(void) const;
36  int GetPOVCTSPosition(void) const;
37  int GetRudderPosition(void) const;
38  int GetUPosition(void) const;
39  int GetVPosition(void) const;
40  int GetMovementThreshold(void) const;
41  void SetMovementThreshold(int threshold) ;
42 
43  // Capabilities
45 
46  static int GetNumberJoysticks(void);
47 
48  bool IsOk(void) const; // Checks that the joystick is functioning
49  int GetXMin(void) const;
50  int GetYMin(void) const;
51  int GetZMin(void) const;
52  int GetXMax(void) const;
53  int GetYMax(void) const;
54  int GetZMax(void) const;
55  int GetNumberButtons(void) const;
56  int GetNumberAxes(void) const;
57  int GetMaxButtons(void) const;
58  int GetMaxAxes(void) const;
59  int GetPollingMin(void) const;
60  int GetPollingMax(void) const;
61  int GetRudderMin(void) const;
62  int GetRudderMax(void) const;
63 
64  bool HasRudder(void) const;
65  bool HasZ(void) const;
66  bool HasPOV(void) const;
67  bool HasPOV4Dir(void) const;
68  bool HasPOVCTS(void) const;
69 
70  // Operations
72 
73  // pollingFreq = 0 means that movement events are sent when above the threshold.
74  // If pollingFreq > 0, events are received every this many milliseconds.
75  bool SetCapture(wxWindow *win, int pollingFreq = 0);
76  bool ReleaseCapture(void);
77 
78 protected:
79  int m_joystick;
80 };
81 
82 #endif // !wxUSE_JOYSTICK
83 
84 #endif // WIN32
85 
86