From 192e1131873e66d2118afd7a6e13e5701053a4d0 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 27 Oct 2015 08:57:04 +0100 Subject: rename "clientfiles/" to "contrib/" as customary --- .../very-important-source-code/ft_tester/main.cpp | 211 --------------------- 1 file changed, 211 deletions(-) delete mode 100644 clientfiles/very-important-source-code/ft_tester/main.cpp (limited to 'clientfiles/very-important-source-code/ft_tester/main.cpp') diff --git a/clientfiles/very-important-source-code/ft_tester/main.cpp b/clientfiles/very-important-source-code/ft_tester/main.cpp deleted file mode 100644 index a737f88f..00000000 --- a/clientfiles/very-important-source-code/ft_tester/main.cpp +++ /dev/null @@ -1,211 +0,0 @@ -#define WIN32_LEAN_AND_MEAN - -#include -#include -#include -#include -#include -#include - -#include "resource.h" - -HINSTANCE hInst; -UINT_PTR timer = 0; - -HMODULE ftclient; - -typedef struct -{ - unsigned int dataID; - int res_x; int res_y; - float yaw; // positive yaw to the left - float pitch;// positive pitch up - float roll;// positive roll to the left - float x; - float y; - float z; - // raw pose with no smoothing, sensitivity, response curve etc. - float ryaw; - float rpitch; - float rroll; - float rx; - float ry; - float rz; - // raw points, sorted by Y, origin top left corner - float x0, y0; - float x1, y1; - float x2, y2; - float x3, y3; -}FreeTrackData; - - -typedef bool (WINAPI *importGetData)(FreeTrackData * data); -typedef char *(WINAPI *importGetDllVersion)(void); -typedef void (WINAPI *importReportName)(char *name); -typedef char *(WINAPI *importProvider)(void); - -importGetData getData; -importGetDllVersion getDllVersion; -importReportName reportName; -importProvider provider; - - -char *client_path() -{ - HKEY hkey = 0; - RegOpenKeyEx(HKEY_CURRENT_USER, "Software\\Freetrack\\FreetrackClient", 0, - KEY_QUERY_VALUE, &hkey); - if(!hkey){ - printf("Can't open registry key\n"); - return NULL; - } - - BYTE path[1024]; - DWORD buf_len = 1024; - LONG result = RegQueryValueEx(hkey, "Path", NULL, NULL, path, &buf_len); - char *full_path = (char *)malloc(2048); - if(result == ERROR_SUCCESS && buf_len > 0){ - sprintf(full_path, "%s\\FreeTrackClient.dll", path); - } - RegCloseKey(hkey); - return full_path; -} - - -bool start(HWND hwnd) -{ - char *libname = client_path(); - if(libname == NULL){ - printf("Freetrack client not found!\n"); - return false; - } - ftclient = LoadLibrary(libname); - if(ftclient == NULL){ - printf("Couldn't load Freetrack client library '%s'!\n", libname); - return false; - } - printf("Freetrack client library %s loaded.\n", client_path()); - - - getData = (importGetData)GetProcAddress(ftclient, "FTGetData"); - getDllVersion = (importGetDllVersion)GetProcAddress(ftclient, "FTGetDllVersion"); - reportName = (importReportName)GetProcAddress(ftclient, "FTReportName"); - provider = (importProvider)GetProcAddress(ftclient, "FTProvider"); - - if((getData == NULL) || (getDllVersion == NULL) || (reportName == NULL) || (provider == NULL)){ - printf("Couldn't load Freetrack client functions!\n"); - FreeLibrary(ftclient); - return false; - } - - printf("Dll version: %s\n", getDllVersion()); - printf("Provider: %s\n", provider()); - char title[1024]; - GetDlgItemText(hwnd, IDC_TITLE, title, 1020); - reportName(title); - return true; -} - -void reportError(std::string msg) -{ - MessageBoxA(0, "FreeTrack client test", msg.c_str(), 0); -} -VOID CALLBACK TimerProcedure(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime) -{ - (void) uMsg; - (void) idEvent; - (void) dwTime; - FreeTrackData d; - getData(&d); - SetDlgItemInt(hwnd, IDC_PITCH, d.pitch, true); - SetDlgItemInt(hwnd, IDC_ROLL, d.roll, true); - SetDlgItemInt(hwnd, IDC_YAW, d.yaw, true); - - SetDlgItemInt(hwnd, IDC_X, d.x, true); - SetDlgItemInt(hwnd, IDC_Y, d.y, true); - SetDlgItemInt(hwnd, IDC_Z, d.z, true); - - SetDlgItemInt(hwnd, IDC_RPITCH, d.rpitch, true); - SetDlgItemInt(hwnd, IDC_RROLL, d.rroll, true); - SetDlgItemInt(hwnd, IDC_RYAW, d.ryaw, true); - - SetDlgItemInt(hwnd, IDC_RX, d.rx, true); - SetDlgItemInt(hwnd, IDC_RY, d.ry, true); - SetDlgItemInt(hwnd, IDC_RZ, d.rz, true); - - std::ostringstream s; - s.str(std::string()); - s<<"("<