From 8303597a865400a363ae574ccde819302495f498 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 2 Apr 2013 18:41:01 +0200 Subject: Just put everything new in. Conflict resolution will be later --- ftnoir_protocol_mouse/ftnoir_mousecontrols.ui | 2 +- ftnoir_protocol_mouse/ftnoir_protocol_mouse.cpp | 50 ++++----------------- ftnoir_protocol_mouse/ftnoir_protocol_mouse.h | 16 +++---- .../ftnoir_protocol_mouse_dialog.cpp | 9 ++-- .../ftnoir_protocol_mouse_dll.cpp | 7 +-- ftnoir_protocol_mouse/images/mouse.ico | Bin 0 -> 17542 bytes 6 files changed, 27 insertions(+), 57 deletions(-) create mode 100644 ftnoir_protocol_mouse/images/mouse.ico (limited to 'ftnoir_protocol_mouse') diff --git a/ftnoir_protocol_mouse/ftnoir_mousecontrols.ui b/ftnoir_protocol_mouse/ftnoir_mousecontrols.ui index 4a6cc3b9..1a7712f2 100644 --- a/ftnoir_protocol_mouse/ftnoir_mousecontrols.ui +++ b/ftnoir_protocol_mouse/ftnoir_mousecontrols.ui @@ -15,7 +15,7 @@ - :/images/Mouse.ico:/images/Mouse.ico + :/images/Mouse.png:/images/Mouse.png Qt::LeftToRight diff --git a/ftnoir_protocol_mouse/ftnoir_protocol_mouse.cpp b/ftnoir_protocol_mouse/ftnoir_protocol_mouse.cpp index f81a38f7..953482a5 100644 --- a/ftnoir_protocol_mouse/ftnoir_protocol_mouse.cpp +++ b/ftnoir_protocol_mouse/ftnoir_protocol_mouse.cpp @@ -33,6 +33,7 @@ is called from run() of Tracker.cpp */ #include "ftnoir_protocol_mouse.h" +#include "facetracknoir/global-settings.h" /** constructor **/ FTNoIR_Protocol::FTNoIR_Protocol() @@ -106,9 +107,9 @@ void FTNoIR_Protocol::loadSettings() { // Update Headpose in Game. // void FTNoIR_Protocol::sendHeadposeToGame( THeadPoseData *headpose, THeadPoseData *rawheadpose ) { -float fMouse_X; // The actual value -float fMouse_Y; -float fMouse_Wheel; +float fMouse_X = 0; // The actual value +float fMouse_Y = 0; +float fMouse_Wheel = 0; // @@ -213,39 +214,6 @@ float fMouse_Wheel; break; } - // - // Determine which style is used. - // - SecureZeroMemory(&MouseStruct, sizeof(MouseStruct)); - MouseStruct.type = INPUT_MOUSE; - switch (Mouse_Style) { - case FTN_ABSOLUTE: - MouseStruct.mi.dwFlags = MOUSEEVENTF_MOVE | MOUSEEVENTF_WHEEL | MOUSEEVENTF_ABSOLUTE; - if (useVirtualDesk) { - MouseStruct.mi.dwFlags |= MOUSEEVENTF_VIRTUALDESK; - } - MouseStruct.mi.dx = scale2AnalogLimits(-1.0f * fMouse_X * mouse_X_factor, -150, 150); - MouseStruct.mi.dy = scale2AnalogLimits(fMouse_Y * mouse_Y_factor, -150, 150); - MouseStruct.mi.mouseData = mouse_Wheel_factor * (fMouse_Wheel - prev_fMouse_Wheel); - - frame_delay = 9999; // Seems no problem with Absolute positioning - break; - - case FTN_RELATIVE: - MouseStruct.mi.dwFlags = MOUSEEVENTF_MOVE | MOUSEEVENTF_WHEEL; - MouseStruct.mi.dx = -1.0f * mouse_X_factor * (fMouse_X - prev_fMouse_X); - MouseStruct.mi.dy = mouse_Y_factor * (fMouse_Y - prev_fMouse_Y); - MouseStruct.mi.mouseData = - 1.0f * mouse_Wheel_factor * (fMouse_Wheel - prev_fMouse_Wheel); - - frame_delay += 1; // Add 1 to the counter - qDebug() << "sendHeadposeToGame(): FTN_RELATIVE x = " << MouseStruct.mi.dx << ", y = " << MouseStruct.mi.dy; - break; - - default: - Mouse_Style = FTN_ABSOLUTE; // Force to a valid value... - break; - } - // // Only send Input, when it has changed. // This releases the Mouse, when tracking is stopped (for a while). @@ -264,7 +232,7 @@ float fMouse_Wheel; // // Returns 'true' if all seems OK. // -bool FTNoIR_Protocol::checkServerInstallationOK( HANDLE handle ) +bool FTNoIR_Protocol::checkServerInstallationOK() { return true; @@ -275,7 +243,7 @@ bool FTNoIR_Protocol::checkServerInstallationOK( HANDLE handle ) // void FTNoIR_Protocol::getNameFromGame( char *dest ) { - sprintf_s(dest, 99, "Mouse"); + sprintf(dest, "Mouse"); return; } @@ -286,9 +254,9 @@ void FTNoIR_Protocol::getNameFromGame( char *dest ) // GetProtocol - Undecorated name, which can be easily used with GetProcAddress // Win32 API function. // _GetProtocol@0 - Common name decoration for __stdcall functions in C language. -#pragma comment(linker, "/export:GetProtocol=_GetProtocol@0") +//#pragma comment(linker, "/export:GetProtocol=_GetProtocol@0") -FTNOIR_PROTOCOL_BASE_EXPORT IProtocolPtr __stdcall GetProtocol() +extern "C" FTNOIR_PROTOCOL_BASE_EXPORT void* CALLING_CONVENTION GetConstructor() { - return new FTNoIR_Protocol; + return (IProtocol*) new FTNoIR_Protocol; } diff --git a/ftnoir_protocol_mouse/ftnoir_protocol_mouse.h b/ftnoir_protocol_mouse/ftnoir_protocol_mouse.h index b7765b96..e4bc6256 100644 --- a/ftnoir_protocol_mouse/ftnoir_protocol_mouse.h +++ b/ftnoir_protocol_mouse/ftnoir_protocol_mouse.h @@ -30,17 +30,17 @@ #ifndef INCLUDED_MOUSESERVER_H #define INCLUDED_MOUSESERVER_H -//#include -#include "..\ftnoir_protocol_base\ftnoir_protocol_base.h" -#include "ui_FTNoIR_MOUSEcontrols.h" +#include "ftnoir_protocol_base/ftnoir_protocol_base.h" +#include "ui_ftnoir_mousecontrols.h" #include #include #include #include #include #include - -#include "winable.h" +#include +#include +#include "facetracknoir/global-settings.h" #define MOUSE_AXIS_MIN 0 #define MOUSE_AXIS_MAX 65535 @@ -69,7 +69,7 @@ public: void Release(); void Initialize(); - bool checkServerInstallationOK( HANDLE handle ); + bool checkServerInstallationOK(); void sendHeadposeToGame( THeadPoseData *headpose, THeadPoseData *rawheadpose ); void getNameFromGame( char *dest ); // Take care dest can handle up to 100 chars... @@ -133,7 +133,7 @@ private slots: //******************************************************************************************************* // FaceTrackNoIR Protocol DLL. Functions used to get general info on the Protocol //******************************************************************************************************* -class FTNoIR_ProtocolDll : public IProtocolDll +class FTNoIR_ProtocolDll : public Metadata { public: FTNoIR_ProtocolDll(); @@ -143,7 +143,7 @@ public: void getShortName(QString *strToBeFilled) { *strToBeFilled = QString("Mouse Look"); }; void getDescription(QString *strToBeFilled) { *strToBeFilled = QString("Mouse Look protocol"); }; - void getIcon(QIcon *icon) { *icon = QIcon(":/images/Mouse.ico"); }; + void getIcon(QIcon *icon) { *icon = QIcon(":/images/mouse.png"); }; }; diff --git a/ftnoir_protocol_mouse/ftnoir_protocol_mouse_dialog.cpp b/ftnoir_protocol_mouse/ftnoir_protocol_mouse_dialog.cpp index b8d7d7ee..263be205 100644 --- a/ftnoir_protocol_mouse/ftnoir_protocol_mouse_dialog.cpp +++ b/ftnoir_protocol_mouse/ftnoir_protocol_mouse_dialog.cpp @@ -30,8 +30,9 @@ The ProtocolDll class solves this. The functions to get the name(s) and icon were removed from the two other classes. */ -#include "ftnoir_protocol_MOUSE.h" +#include "ftnoir_protocol_mouse.h" #include +#include "facetracknoir/global-settings.h" //******************************************************************************************************* // FaceTrackNoIR Client Settings-dialog. @@ -227,9 +228,9 @@ void MOUSEControls::save() { // GetProtocolDialog - Undecorated name, which can be easily used with GetProcAddress // Win32 API function. // _GetProtocolDialog@0 - Common name decoration for __stdcall functions in C language. -#pragma comment(linker, "/export:GetProtocolDialog=_GetProtocolDialog@0") +//#pragma comment(linker, "/export:GetProtocolDialog=_GetProtocolDialog@0") -FTNOIR_PROTOCOL_BASE_EXPORT IProtocolDialogPtr __stdcall GetProtocolDialog( ) +extern "C" FTNOIR_PROTOCOL_BASE_EXPORT void* CALLING_CONVENTION GetDialog( ) { - return new MOUSEControls; + return (IProtocolDialog*) new MOUSEControls; } diff --git a/ftnoir_protocol_mouse/ftnoir_protocol_mouse_dll.cpp b/ftnoir_protocol_mouse/ftnoir_protocol_mouse_dll.cpp index cc6ddc17..219f62af 100644 --- a/ftnoir_protocol_mouse/ftnoir_protocol_mouse_dll.cpp +++ b/ftnoir_protocol_mouse/ftnoir_protocol_mouse_dll.cpp @@ -30,8 +30,9 @@ The ProtocolDll class solves this. The functions to get the name(s) and icon were removed from the two other classes. */ -#include "ftnoir_protocol_MOUSE.h" +#include "ftnoir_protocol_mouse.h" #include +#include "facetracknoir/global-settings.h" FTNoIR_ProtocolDll::FTNoIR_ProtocolDll() { } @@ -48,9 +49,9 @@ FTNoIR_ProtocolDll::~FTNoIR_ProtocolDll() // GetProtocolDll - Undecorated name, which can be easily used with GetProcAddress // Win32 API function. // _GetProtocolDll@0 - Common name decoration for __stdcall functions in C language. -#pragma comment(linker, "/export:GetProtocolDll=_GetProtocolDll@0") +//#pragma comment(linker, "/export:GetProtocolDll=_GetProtocolDll@0") -FTNOIR_PROTOCOL_BASE_EXPORT IProtocolDllPtr __stdcall GetProtocolDll() +extern "C" FTNOIR_PROTOCOL_BASE_EXPORT Metadata* CALLING_CONVENTION GetMetadata() { return new FTNoIR_ProtocolDll; } diff --git a/ftnoir_protocol_mouse/images/mouse.ico b/ftnoir_protocol_mouse/images/mouse.ico new file mode 100644 index 00000000..1151ab2b Binary files /dev/null and b/ftnoir_protocol_mouse/images/mouse.ico differ -- cgit v1.2.3