diff options
Diffstat (limited to 'FTNoIR_Protocol_PPJOY')
-rw-r--r-- | FTNoIR_Protocol_PPJOY/FTNoIR_Protocol_PPJOY.cpp | 22 | ||||
-rw-r--r-- | FTNoIR_Protocol_PPJOY/FTNoIR_Protocol_PPJOY.h | 13 | ||||
-rw-r--r-- | FTNoIR_Protocol_PPJOY/ftnoir_protocol_PPJOY_dialog.cpp | 2 |
3 files changed, 23 insertions, 14 deletions
diff --git a/FTNoIR_Protocol_PPJOY/FTNoIR_Protocol_PPJOY.cpp b/FTNoIR_Protocol_PPJOY/FTNoIR_Protocol_PPJOY.cpp index 4689c92f..d586f0c0 100644 --- a/FTNoIR_Protocol_PPJOY/FTNoIR_Protocol_PPJOY.cpp +++ b/FTNoIR_Protocol_PPJOY/FTNoIR_Protocol_PPJOY.cpp @@ -35,7 +35,7 @@ static const char* DevName = "\\\\.\\PPJoyIOCTL";
/** constructor **/
-FTNoIR_Protocol_PPJOY::FTNoIR_Protocol_PPJOY()
+FTNoIR_Protocol::FTNoIR_Protocol()
{
char strDevName[100];
@@ -61,7 +61,7 @@ char strDevName[100]; }
/** destructor **/
-FTNoIR_Protocol_PPJOY::~FTNoIR_Protocol_PPJOY()
+FTNoIR_Protocol::~FTNoIR_Protocol()
{
/* Make sure we could open the device! */
if (h == INVALID_HANDLE_VALUE) {
@@ -75,12 +75,12 @@ FTNoIR_Protocol_PPJOY::~FTNoIR_Protocol_PPJOY() }
/** helper to Auto-destruct **/
-void FTNoIR_Protocol_PPJOY::Release()
+void FTNoIR_Protocol::Release()
{
delete this;
}
-void FTNoIR_Protocol_PPJOY::Initialize()
+void FTNoIR_Protocol::Initialize()
{
return;
}
@@ -88,7 +88,7 @@ void FTNoIR_Protocol_PPJOY::Initialize() //
// Limit the Joystick values
//
-void FTNoIR_Protocol_PPJOY::checkAnalogLimits() {
+void FTNoIR_Protocol::checkAnalogLimits() {
for (int i = 0;i < NUM_ANALOG;i++) {
if (Analog[i]>PPJOY_AXIS_MAX) {
Analog[i]=PPJOY_AXIS_MAX;
@@ -102,7 +102,7 @@ void FTNoIR_Protocol_PPJOY::checkAnalogLimits() { //
// Scale the measured value to the Joystick values
//
-long FTNoIR_Protocol_PPJOY::scale2AnalogLimits( float x, float min_x, float max_x ) {
+long FTNoIR_Protocol::scale2AnalogLimits( float x, float min_x, float max_x ) {
double y;
y = ((PPJOY_AXIS_MAX - PPJOY_AXIS_MIN)/(max_x - min_x)) * x + ((PPJOY_AXIS_MAX - PPJOY_AXIS_MIN)/2) + PPJOY_AXIS_MIN;
@@ -114,7 +114,7 @@ double y; //
// Load the current Settings from the currently 'active' INI-file.
//
-void FTNoIR_Protocol_PPJOY::loadSettings() {
+void FTNoIR_Protocol::loadSettings() {
QSettings settings("Abbequerque Inc.", "FaceTrackNoIR"); // Registry settings (in HK_USER)
QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString();
@@ -128,7 +128,7 @@ void FTNoIR_Protocol_PPJOY::loadSettings() { //
// Update Headpose in Game.
//
-void FTNoIR_Protocol_PPJOY::sendHeadposeToGame( THeadPoseData *headpose, THeadPoseData *rawheadpose ) {
+void FTNoIR_Protocol::sendHeadposeToGame( THeadPoseData *headpose, THeadPoseData *rawheadpose ) {
float virtPosX;
float virtPosY;
float virtPosZ;
@@ -186,7 +186,7 @@ float virtRotZ; //
// Returns 'true' if all seems OK.
//
-bool FTNoIR_Protocol_PPJOY::checkServerInstallationOK( HANDLE handle )
+bool FTNoIR_Protocol::checkServerInstallationOK( HANDLE handle )
{
/* Make sure we could open the device! */
if (h == INVALID_HANDLE_VALUE) {
@@ -198,7 +198,7 @@ bool FTNoIR_Protocol_PPJOY::checkServerInstallationOK( HANDLE handle ) //
// Return a name, if present the name from the Game, that is connected...
//
-void FTNoIR_Protocol_PPJOY::getNameFromGame( char *dest )
+void FTNoIR_Protocol::getNameFromGame( char *dest )
{
sprintf_s(dest, 99, "Virtual PPJoy joystick");
return;
@@ -215,5 +215,5 @@ void FTNoIR_Protocol_PPJOY::getNameFromGame( char *dest ) FTNOIR_PROTOCOL_BASE_EXPORT IProtocolPtr __stdcall GetProtocol()
{
- return new FTNoIR_Protocol_PPJOY;
+ return new FTNoIR_Protocol;
}
diff --git a/FTNoIR_Protocol_PPJOY/FTNoIR_Protocol_PPJOY.h b/FTNoIR_Protocol_PPJOY/FTNoIR_Protocol_PPJOY.h index b9220916..4ae9b161 100644 --- a/FTNoIR_Protocol_PPJOY/FTNoIR_Protocol_PPJOY.h +++ b/FTNoIR_Protocol_PPJOY/FTNoIR_Protocol_PPJOY.h @@ -59,11 +59,11 @@ typedef struct #pragma pack(pop)
-class FTNoIR_Protocol_PPJOY : public IProtocol
+class FTNoIR_Protocol : public IProtocol
{
public:
- FTNoIR_Protocol_PPJOY();
- ~FTNoIR_Protocol_PPJOY();
+ FTNoIR_Protocol();
+ ~FTNoIR_Protocol();
void Release();
void Initialize();
@@ -102,6 +102,12 @@ public: void Release(); // Member functions which are accessible from outside the DLL
void Initialize(QWidget *parent);
+ void registerProtocol(IProtocol *protocol) {
+ theProtocol = (FTNoIR_Protocol *) protocol; // Accept the pointer to the Protocol
+ };
+ void unRegisterProtocol() {
+ theProtocol = NULL; // Reset the pointer
+ };
private:
Ui::UICPPJOYControls ui;
@@ -110,6 +116,7 @@ private: /** helper **/
bool settingsDirty;
+ FTNoIR_Protocol *theProtocol;
private slots:
void doOK();
diff --git a/FTNoIR_Protocol_PPJOY/ftnoir_protocol_PPJOY_dialog.cpp b/FTNoIR_Protocol_PPJOY/ftnoir_protocol_PPJOY_dialog.cpp index fb9e1bd5..910e2ae4 100644 --- a/FTNoIR_Protocol_PPJOY/ftnoir_protocol_PPJOY_dialog.cpp +++ b/FTNoIR_Protocol_PPJOY/ftnoir_protocol_PPJOY_dialog.cpp @@ -55,6 +55,8 @@ QWidget() QString cbxText = QString("Virtual Joystick %1").arg(i);
ui.cbxSelectPPJoyNumber->addItem(QIcon("images/PPJoy.ico"), cbxText);
}
+ theProtocol = NULL;
+
// Load the settings from the current .INI-file
loadSettings();
}
|