From 0760fe011114fa440275b487eaf766b015f40e5b Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Thu, 16 Jun 2016 12:34:31 +0200 Subject: all: split "api" into "api" and "logic" Here, the "logic" module has all the stuff for building one's own graphical user interface. The "api" module has stuff used by other trackers. While at it, each of "api", "logic", and "compat" need their own export headers. This is because of preprocessor symbol clashes. This is all because a change in the "gui"-only dependency required a relink of all the trackers, protocols, and flters. It takes too long when building in the release configuration. With the split, only the "gui" module gets rebuilt. Since it has close to no static dependencies, it's fast enough. --- opentrack/win32-joystick.hpp | 100 ------------------------------------------- 1 file changed, 100 deletions(-) delete mode 100644 opentrack/win32-joystick.hpp (limited to 'opentrack/win32-joystick.hpp') diff --git a/opentrack/win32-joystick.hpp b/opentrack/win32-joystick.hpp deleted file mode 100644 index 9c888326..00000000 --- a/opentrack/win32-joystick.hpp +++ /dev/null @@ -1,100 +0,0 @@ -#pragma once - -#ifdef _WIN32 - -#include -#include -#include -#include -#include -#include -#ifndef DIRECTINPUT_VERSION -# define DIRECTINPUT_VERSION 0x800 -#endif -#include -#include -#include "opentrack-compat/timer.hpp" -#include -#include -#include -#include -#include - -namespace std { -template<> -struct hash -{ - inline std::size_t operator()(const QString& value) const - { - return qHash(value); - } -}; -} - -#ifdef BUILD_api -# include "opentrack-compat/export.hpp" -#else -# include "opentrack-compat/import.hpp" -#endif - -struct OPENTRACK_EXPORT win32_joy_ctx -{ - using fn = std::function; - - enum { joy_axis_size = 65535 }; - - struct joy_info - { - QString name, guid; - }; - - void poll(fn f); - bool poll_axis(const QString& guid, int axes[8]); - std::vector get_joy_info(); - - win32_joy_ctx(const win32_joy_ctx&) = delete; - win32_joy_ctx& operator=(const win32_joy_ctx&) = delete; - - win32_joy_ctx(); - ~win32_joy_ctx(); - void refresh(); -private: - QMutex mtx; - QMainWindow fake_main_window; - LPDIRECTINPUT8 di; - - static QString guid_to_string(const GUID guid); - void release(); - - struct joy - { - LPDIRECTINPUTDEVICE8 joy_handle; - QString guid, name; - bool pressed[128]; - Timer first_timer; - DIJOYSTATE2 js_old; - - joy(LPDIRECTINPUTDEVICE8 handle, const QString& guid, const QString& name); - ~joy(); - - void release(); - bool poll(fn f); - }; - - std::unordered_map> joys; - - class enum_state - { - std::unordered_map> joys; - QMainWindow& fake_main_window; - LPDIRECTINPUT8 di; - - std::vector all; - static BOOL CALLBACK EnumJoysticksCallback(const DIDEVICEINSTANCE* pdidInstance, VOID* pContext); - static BOOL CALLBACK EnumObjectsCallback(const DIDEVICEOBJECTINSTANCE* pdidoi, VOID* ctx); - public: - enum_state(std::unordered_map>& joys, QMainWindow& fake_main_window, LPDIRECTINPUT8 di); - }; -}; - -#endif -- cgit v1.2.3