summaryrefslogtreecommitdiffhomepage
path: root/ftnoir_protocol_vjoy
diff options
context:
space:
mode:
authorDonovan Baarda <abo@minkirri.apana.org.au>2014-10-15 14:07:20 +1100
committerDonovan Baarda <abo@minkirri.apana.org.au>2014-10-15 14:07:20 +1100
commitdbd04e283082ab869a22abf03c4c6280b03935bb (patch)
tree3951c6f91f76047e655f35e04db4eecd576c49df /ftnoir_protocol_vjoy
parentd880464fbe9180aefde94594330126e115066dc3 (diff)
parent051a2e4392bc75b246cc5cb897ae0bbb1f92042e (diff)
Merge branch 'unstable' of https://github.com/opentrack/opentrack into dev/kalman
Conflicts: ftnoir_filter_kalman/ftnoir_filter_kalman.h
Diffstat (limited to 'ftnoir_protocol_vjoy')
-rw-r--r--ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.cpp15
-rw-r--r--ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.h30
-rw-r--r--ftnoir_protocol_vjoy/ftnoir_protocol_vjoy_dialog.cpp4
-rw-r--r--ftnoir_protocol_vjoy/ftnoir_protocol_vjoy_dll.cpp4
4 files changed, 17 insertions, 36 deletions
diff --git a/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.cpp b/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.cpp
index a3a5cb5f..58fa2ab1 100644
--- a/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.cpp
+++ b/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.cpp
@@ -1,22 +1,21 @@
#include "ftnoir_protocol_vjoy.h"
-#include "facetracknoir/global-settings.h"
-#include <ftnoir_tracker_base/ftnoir_tracker_types.h>
+#include "facetracknoir/plugin-api.hpp"
-/** constructor **/
FTNoIR_Protocol::FTNoIR_Protocol()
{
- VJoy_Initialize("", "");
+ static char meh[1] = {0};
+ VJoy_Initialize(meh, meh);
}
-/** destructor **/
FTNoIR_Protocol::~FTNoIR_Protocol()
{
VJoy_Shutdown();
}
void FTNoIR_Protocol::sendHeadposeToGame( const double *headpose ) {
+#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
JOYSTICK_STATE state[2] = { 0 };
-
+
state[0].POV = (4 << 12) | (4 << 8) | (4 << 4) | 4;
state[0].XAxis = std::min<int>(VJOY_AXIS_MAX, std::max<int>(VJOY_AXIS_MIN, headpose[Yaw] * VJOY_AXIS_MAX / 180.0));
@@ -25,11 +24,11 @@ void FTNoIR_Protocol::sendHeadposeToGame( const double *headpose ) {
state[0].XRotation = std::min<int>(VJOY_AXIS_MAX, std::max<int>(VJOY_AXIS_MIN, headpose[TX] * VJOY_AXIS_MAX / 100.0));
state[0].YRotation = std::min<int>(VJOY_AXIS_MAX, std::max<int>(VJOY_AXIS_MIN, headpose[TY] * VJOY_AXIS_MAX / 100.0));
state[0].ZRotation = std::min<int>(VJOY_AXIS_MAX, std::max<int>(VJOY_AXIS_MIN, headpose[TZ] * VJOY_AXIS_MAX / 100.0));
-
+
VJoy_UpdateJoyState(0, state);
}
-extern "C" FTNOIR_PROTOCOL_BASE_EXPORT IProtocol* CALLING_CONVENTION GetConstructor()
+extern "C" OPENTRACK_EXPORT IProtocol* GetConstructor()
{
return new FTNoIR_Protocol;
}
diff --git a/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.h b/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.h
index 873b4e3c..eac3c610 100644
--- a/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.h
+++ b/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.h
@@ -26,15 +26,9 @@
* It is based on the (Linux) example made by Melchior FRANZ. *
********************************************************************************/
#pragma once
-#include "ftnoir_protocol_base/ftnoir_protocol_base.h"
#include "ui_ftnoir_vjoy_controls.h"
-#include <QThread>
-#include <QUdpSocket>
-#include <QMessageBox>
-#include <QSettings>
-#include <math.h>
-#include "facetracknoir/global-settings.h"
-#include <windows.h>
+#include <cmath>
+#include "facetracknoir/plugin-api.hpp"
#define FT_PROGRAMID "FT_ProgramID"
@@ -42,7 +36,7 @@ class FTNoIR_Protocol : public IProtocol
{
public:
FTNoIR_Protocol();
- virtual ~FTNoIR_Protocol();
+ ~FTNoIR_Protocol() override;
bool checkServerInstallationOK() {
return true;
}
@@ -60,7 +54,7 @@ class VJoyControls: public QWidget, public IProtocolDialog
public:
explicit VJoyControls();
- void registerProtocol(IProtocol *l) {}
+ void registerProtocol(IProtocol *) {}
void unRegisterProtocol() {}
private:
@@ -72,9 +66,6 @@ private slots:
void doCancel();
};
-//*******************************************************************************************************
-// FaceTrackNoIR Protocol DLL. Functions used to get general info on the Protocol
-//*******************************************************************************************************
class FTNoIR_ProtocolDll : public Metadata
{
public:
@@ -92,6 +83,8 @@ public:
#define VJOY_AXIS_NIL 0
#define VJOY_AXIS_MAX 32767
+#include <windows.h>
+
#include <pshpack1.h>
typedef struct _JOYSTICK_STATE
@@ -109,17 +102,6 @@ typedef struct _JOYSTICK_STATE
UINT32 Buttons; // 32 Buttons
} JOYSTICK_STATE, * PJOYSTICK_STATE;
-#include <poppack.h>
-
-#undef EXTERN_C
-#if _MSC_VER
-# define EXTERN_C
-#else
-# define EXTERN_C extern "C"
-#endif
-#if _MSC_VER
-# pragma comment(linker, "/implib:vjoy.def")
-#endif
EXTERN_C BOOL __stdcall VJoy_Initialize(PCHAR name, PCHAR serial);
EXTERN_C VOID __stdcall VJoy_Shutdown();
EXTERN_C BOOL __stdcall VJoy_UpdateJoyState(int id, PJOYSTICK_STATE pJoyState);
diff --git a/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy_dialog.cpp b/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy_dialog.cpp
index febb7b18..6bd82d9a 100644
--- a/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy_dialog.cpp
+++ b/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy_dialog.cpp
@@ -1,5 +1,5 @@
#include "ftnoir_protocol_vjoy.h"
-#include "facetracknoir/global-settings.h"
+#include "facetracknoir/plugin-support.h"
VJoyControls::VJoyControls() : QWidget()
{
@@ -20,7 +20,7 @@ void VJoyControls::doCancel() {
void VJoyControls::save() {
}
-extern "C" FTNOIR_PROTOCOL_BASE_EXPORT IProtocolDialog* CALLING_CONVENTION GetDialog( )
+extern "C" OPENTRACK_EXPORT IProtocolDialog* GetDialog( )
{
return new VJoyControls;
}
diff --git a/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy_dll.cpp b/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy_dll.cpp
index 5cb5ef05..367a0df6 100644
--- a/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy_dll.cpp
+++ b/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy_dll.cpp
@@ -1,6 +1,6 @@
#include "ftnoir_protocol_vjoy.h"
#include <QDebug>
-#include "facetracknoir/global-settings.h"
+#include "facetracknoir/plugin-support.h"
FTNoIR_ProtocolDll::FTNoIR_ProtocolDll() {
}
@@ -10,7 +10,7 @@ FTNoIR_ProtocolDll::~FTNoIR_ProtocolDll()
}
-extern "C" FTNOIR_PROTOCOL_BASE_EXPORT Metadata* CALLING_CONVENTION GetMetadata()
+extern "C" OPENTRACK_EXPORT Metadata* GetMetadata()
{
return new FTNoIR_ProtocolDll;
}