summaryrefslogtreecommitdiffhomepage
path: root/opentrack/win32-joystick.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'opentrack/win32-joystick.cpp')
-rw-r--r--opentrack/win32-joystick.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/opentrack/win32-joystick.cpp b/opentrack/win32-joystick.cpp
new file mode 100644
index 00000000..b4a1f9cd
--- /dev/null
+++ b/opentrack/win32-joystick.cpp
@@ -0,0 +1,30 @@
+#include "win32-joystick.hpp"
+
+LPDIRECTINPUT8& win32_joy_ctx::dinput_handle()
+{
+ (void) CoInitialize(nullptr);
+
+ static LPDIRECTINPUT8 dinput_handle_ = nullptr;
+
+ if (dinput_handle_ == nullptr)
+ (void) DirectInput8Create(GetModuleHandle(nullptr),
+ DIRECTINPUT_VERSION,
+ IID_IDirectInput8,
+ (void**) &dinput_handle_,
+ nullptr);
+
+ return dinput_handle_;
+}
+
+std::unordered_map<QString, std::shared_ptr<win32_joy_ctx::joy>>& win32_joy_ctx::joys()
+{
+ static std::unordered_map<QString, std::shared_ptr<joy>> js;
+
+ return js;
+}
+
+win32_joy_ctx& win32_joy_ctx::make()
+{
+ static win32_joy_ctx ret;
+ return ret;
+}