summaryrefslogtreecommitdiffhomepage
path: root/FaceTrackNoIR/PPJoyServer.cpp
diff options
context:
space:
mode:
authorWim Vriend <facetracknoir@gmail.com>2010-06-13 15:44:02 +0000
committerWim Vriend <facetracknoir@gmail.com>2010-06-13 15:44:02 +0000
commitc6bf844769902c2eda1cb0789dd5872fe9d962ac (patch)
tree12292eb39811efc74f10c16c8db98127fe467370 /FaceTrackNoIR/PPJoyServer.cpp
parent513d1c8521aad3cd5ba7db3b87349553a793c151 (diff)
PPJoy settings dialog added. First try.
git-svn-id: svn+ssh://svn.code.sf.net/p/facetracknoir/code@12 19e81ba0-9b1a-49c3-bd6c-561e1906d5fb
Diffstat (limited to 'FaceTrackNoIR/PPJoyServer.cpp')
-rw-r--r--FaceTrackNoIR/PPJoyServer.cpp51
1 files changed, 42 insertions, 9 deletions
diff --git a/FaceTrackNoIR/PPJoyServer.cpp b/FaceTrackNoIR/PPJoyServer.cpp
index 53b6322b..a33ceb34 100644
--- a/FaceTrackNoIR/PPJoyServer.cpp
+++ b/FaceTrackNoIR/PPJoyServer.cpp
@@ -30,8 +30,8 @@
#include "Tracker.h"
#include <Winsock.h>
-long PPJoyServer::PPJoyCorrection = 1470;
-long PPJoyServer::analogDefault = (PPJOY_AXIS_MIN+PPJOY_AXIS_MAX)/2 - PPJoyServer::PPJoyCorrection;
+//long PPJoyServer::PPJoyCorrection = 1470;
+//long PPJoyServer::analogDefault = (PPJOY_AXIS_MIN+PPJOY_AXIS_MAX)/2 - PPJoyServer::PPJoyCorrection;
static const char* DevName = "\\\\.\\PPJoyIOCTL1";
/** constructor **/
@@ -51,7 +51,7 @@ PPJoyServer::PPJoyServer( Tracker *parent ) {
}
/* Open a handle to the control device for the first virtual joystick. */
- /* Virtual joystick devices are names PPJoyIOCTL1 to PPJoyIOCTL16. */
+ /* Virtual joystick devices are named PPJoyIOCTL1 to PPJoyIOCTL16. */
h = CreateFileA((LPCSTR) DevName,GENERIC_WRITE,FILE_SHARE_WRITE,NULL,OPEN_EXISTING,0,NULL);
/* Make sure we could open the device! */
@@ -111,16 +111,15 @@ void PPJoyServer::run() {
}
// The effective angle for faceTracking will be < 90 degrees, so we assume a smaller range here
- Analog[0] = scale2AnalogLimits( virtRotX, -50.0f, 50.0f ); // Pitch
- qDebug() << "PPJoyServer says: Pitch =" << Analog[0] << " VirtRotX =" << virtRotX ;
- Analog[1] = scale2AnalogLimits( virtRotY, -50.0f, 50.0f ); // Yaw
- Analog[2] = scale2AnalogLimits( virtRotZ, -50.0f, 50.0f ); // Roll
+ Analog[0] = scale2AnalogLimits( virtRotX, -50.0f, 50.0f ); // Pitch
+ Analog[1] = scale2AnalogLimits( virtRotY, -50.0f, 50.0f ); // Yaw
+ Analog[2] = scale2AnalogLimits( virtRotZ, -50.0f, 50.0f ); // Roll
// The effective movement for faceTracking will be < 50 cm, so we assume a smaller range here
Analog[3] = scale2AnalogLimits( virtPosX, -40.0f, 40.0f ); // X
- Analog[5] = scale2AnalogLimits( virtPosY, -40.0f, 40.0f ); // Y (5?)
- Analog[6] = scale2AnalogLimits( virtPosZ, -40.0f, 40.0f ); // Z (6?)
+ Analog[4] = scale2AnalogLimits( virtPosY, -40.0f, 40.0f ); // Y
+ Analog[5] = scale2AnalogLimits( virtPosZ, -40.0f, 40.0f ); // Z
checkAnalogLimits();
@@ -162,4 +161,38 @@ double y;
return (long) y;
}
+
+//
+// Constructor for server-settings-dialog
+//
+PPJoyControls::PPJoyControls( QWidget *parent, Qt::WindowFlags f ) :
+QWidget( parent , f)
+{
+ ui.setupUi( this );
+
+ connect(ui.btnOK, SIGNAL(clicked()), this, SLOT(doOK()));
+ connect(ui.btnCancel, SIGNAL(clicked()), this, SLOT(doCancel()));
+}
+
+//
+// Destructor for server-dialog
+//
+PPJoyControls::~PPJoyControls() {
+}
+
+//
+// OK clicked on server-dialog
+//
+void PPJoyControls::doOK() {
+ qDebug() << "doOK clicked";
+}
+
+//
+// Cancel clicked on server-dialog
+//
+void PPJoyControls::doCancel() {
+ qDebug() << "doCancel clicked";
+ this->close();
+}
+
//END