diff options
Diffstat (limited to 'linden/indra/newview/llviewerjoystick.h')
-rw-r--r-- | linden/indra/newview/llviewerjoystick.h | 73 |
1 files changed, 68 insertions, 5 deletions
diff --git a/linden/indra/newview/llviewerjoystick.h b/linden/indra/newview/llviewerjoystick.h index b4107bb..c7c78f3 100644 --- a/linden/indra/newview/llviewerjoystick.h +++ b/linden/indra/newview/llviewerjoystick.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /** | 1 | /** |
2 | * @file llviewerjoystick.h | 2 | * @file llviewerjoystick.h |
3 | * @brief Viewer joystick functionality. | 3 | * @brief Viewer joystick / NDOF device functionality. |
4 | * | 4 | * |
5 | * $LicenseInfo:firstyear=2001&license=viewergpl$ | 5 | * $LicenseInfo:firstyear=2001&license=viewergpl$ |
6 | * | 6 | * |
@@ -32,12 +32,75 @@ | |||
32 | #ifndef LL_LLVIEWERJOYSTICK_H | 32 | #ifndef LL_LLVIEWERJOYSTICK_H |
33 | #define LL_LLVIEWERJOYSTICK_H | 33 | #define LL_LLVIEWERJOYSTICK_H |
34 | 34 | ||
35 | class LLViewerJoystick | 35 | #include "stdtypes.h" |
36 | |||
37 | #define LIB_NDOF (LL_WINDOWS || LL_DARWIN) | ||
38 | |||
39 | #if LIB_NDOF | ||
40 | #include "ndofdev_external.h" | ||
41 | #else | ||
42 | #define NDOF_Device void | ||
43 | #define NDOF_HotPlugResult S32 | ||
44 | #endif | ||
45 | |||
46 | typedef enum e_joystick_driver_state | ||
47 | { | ||
48 | JDS_UNINITIALIZED, | ||
49 | JDS_INITIALIZED, | ||
50 | JDS_INITIALIZING | ||
51 | } EJoystickDriverState; | ||
52 | |||
53 | class LLViewerJoystick : public LLSingleton<LLViewerJoystick> | ||
36 | { | 54 | { |
37 | public: | 55 | public: |
38 | static BOOL sOverrideCamera; | 56 | LLViewerJoystick(); |
39 | static void scanJoystick(); | 57 | virtual ~LLViewerJoystick(); |
40 | static void updateCamera(BOOL reset = FALSE); | 58 | |
59 | void init(bool autoenable); | ||
60 | void updateStatus(); | ||
61 | void scanJoystick(); | ||
62 | void moveObjects(bool reset = false); | ||
63 | void moveAvatar(bool reset = false); | ||
64 | void moveFlycam(bool reset = false); | ||
65 | F32 getJoystickAxis(U32 axis) const; | ||
66 | U32 getJoystickButton(U32 button) const; | ||
67 | bool isJoystickInitialized() const {return (mDriverState==JDS_INITIALIZED);} | ||
68 | bool isLikeSpaceNavigator() const; | ||
69 | void setNeedsReset(bool reset = true) { mResetFlag = reset; } | ||
70 | void setCameraNeedsUpdate(bool b) { mCameraUpdated = b; } | ||
71 | bool getCameraNeedsUpdate() const { return mCameraUpdated; } | ||
72 | bool getOverrideCamera() { return mOverrideCamera; } | ||
73 | void setOverrideCamera(bool val); | ||
74 | bool toggleFlycam(); | ||
75 | void setSNDefaults(); | ||
76 | std::string getDescription(); | ||
77 | |||
78 | protected: | ||
79 | void updateEnabled(bool autoenable); | ||
80 | void terminate(); | ||
81 | void agentSlide(F32 inc); | ||
82 | void agentPush(F32 inc); | ||
83 | void agentFly(F32 inc); | ||
84 | void agentRotate(F32 pitch_inc, F32 turn_inc); | ||
85 | void agentJump(); | ||
86 | void resetDeltas(S32 axis[], bool flycam_and_build = false); | ||
87 | #if LIB_NDOF | ||
88 | static NDOF_HotPlugResult HotPlugAddCallback(NDOF_Device *dev); | ||
89 | static void HotPlugRemovalCallback(NDOF_Device *dev); | ||
90 | #endif | ||
91 | |||
92 | private: | ||
93 | F32 mAxes[6]; | ||
94 | long mBtn[16]; | ||
95 | EJoystickDriverState mDriverState; | ||
96 | NDOF_Device *mNdofDev; | ||
97 | bool mResetFlag; | ||
98 | F32 mPerfScale; | ||
99 | bool mCameraUpdated; | ||
100 | bool mOverrideCamera; | ||
101 | |||
102 | static F32 sLastDelta[7]; | ||
103 | static F32 sDelta[7]; | ||
41 | }; | 104 | }; |
42 | 105 | ||
43 | #endif | 106 | #endif |