diff options
author | Wim Vriend <facetracknoir@gmail.com> | 2010-06-11 18:09:28 +0000 |
---|---|---|
committer | Wim Vriend <facetracknoir@gmail.com> | 2010-06-11 18:09:28 +0000 |
commit | a0feb94b670a150e4574f1921cfcfe59049be822 (patch) | |
tree | 26491b9b08295d80974a8303ca90370eb4151e63 /FaceTrackNoIR/PPJoyServer.h | |
parent | 602e4770360fb125ebdb129a6b777fe08a433370 (diff) |
PPJoy 1st success
git-svn-id: svn+ssh://svn.code.sf.net/p/facetracknoir/code@10 19e81ba0-9b1a-49c3-bd6c-561e1906d5fb
Diffstat (limited to 'FaceTrackNoIR/PPJoyServer.h')
-rw-r--r-- | FaceTrackNoIR/PPJoyServer.h | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/FaceTrackNoIR/PPJoyServer.h b/FaceTrackNoIR/PPJoyServer.h index f6c9b66f..83b3617a 100644 --- a/FaceTrackNoIR/PPJoyServer.h +++ b/FaceTrackNoIR/PPJoyServer.h @@ -43,6 +43,20 @@ using namespace std; class Tracker; // pre-define parent-class to avoid circular includes
+#define NUM_ANALOG 7 /* Number of analog values which we will provide */
+#define NUM_DIGITAL 1 /* Number of digital values which we will provide */
+
+#pragma pack(push,1) /* All fields in structure must be byte aligned. */
+typedef struct
+{
+ unsigned long Signature; /* Signature to identify packet to PPJoy IOCTL */
+ char NumAnalog; /* Num of analog values we pass */
+ long Analog[NUM_ANALOG]; /* Analog values */
+ char NumDigital; /* Num of digital values we pass */
+ char Digital[NUM_DIGITAL]; /* Digital values */
+} JOYSTICK_STATE;
+#pragma pack(pop)
+
class PPJoyServer : public QThread {
Q_OBJECT
@@ -50,12 +64,11 @@ public: // public member methods
PPJoyServer( Tracker *parent );
- virtual ~PPJoyServer() {};
+ ~PPJoyServer();
// protected member methods
protected:
void run();
- void terminate();
private slots:
// void readPendingDatagrams();
@@ -67,6 +80,16 @@ private: Tracker *headTracker; // For upstream messages...
+ HANDLE h;
+ JOYSTICK_STATE JoyState;
+ DWORD RetSize;
+ DWORD rc;
+ long *Analog;
+ char *Digital;
+
+ static long analogDefault,PPJoyCorrection;
+ long centerPos[3],centerRot[3];
+
/** member variables for saving the head pose **/
float virtPosX;
float virtPosY;
@@ -76,6 +99,9 @@ private: float virtRotY;
float virtRotZ;
+ void checkAnalogLimits();
+ long scale2AnalogLimits( float x, float min_x, float max_x );
+
public:
void setVirtRotX(float rot) { virtRotX = rot; }
void setVirtRotY(float rot) { virtRotY = rot; }
|