summaryrefslogtreecommitdiffhomepage
path: root/opentrack/win32-joystick-shortcuts.cpp
blob: 44659b7e55207cb63a28c533ab2fe37b2bc58b0e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include "win32-joystick-shortcuts.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;
}