aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llviewerjoystick.h
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:45:42 -0500
committerJacek Antonelli2008-08-15 23:45:42 -0500
commitce28e056c20bf2723f565bbf464b87781ec248a2 (patch)
treeef7b0501c4de4b631a916305cbc2a5fdc125e52d /linden/indra/newview/llviewerjoystick.h
parentSecond Life viewer sources 1.19.1.4b (diff)
downloadmeta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.zip
meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.gz
meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.bz2
meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.xz
Second Life viewer sources 1.20.2
Diffstat (limited to 'linden/indra/newview/llviewerjoystick.h')
-rw-r--r--linden/indra/newview/llviewerjoystick.h73
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
35class 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
46typedef enum e_joystick_driver_state
47{
48 JDS_UNINITIALIZED,
49 JDS_INITIALIZED,
50 JDS_INITIALIZING
51} EJoystickDriverState;
52
53class LLViewerJoystick : public LLSingleton<LLViewerJoystick>
36{ 54{
37public: 55public:
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
78protected:
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
92private:
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