Debian Codegraph @

src/api/directinput/JoystickInterfaceDirectInput.h

raw symbols SCIP
1 /*
2 * Copyright (C) 2014-2021 Garrett Brown
3 * Copyright (C) 2014-2021 Team Kodi
4 *
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSE.md for more information.
7 */
8
9 #pragma once
10
11 #include "api/JoystickInterfaceCallback.h"
12
13 #define DIRECTINPUT_VERSION 0x0800
14 #include <dinput.h>
15
16 #include <vector>
17
18 namespace JOYSTICK
19 {
20 class CJoystickInterfaceDirectInput : public CJoystickInterfaceCallback
21 {
22 public:
23 CJoystickInterfaceDirectInput(void);
24 virtual ~CJoystickInterfaceDirectInput(void) { Deinitialize(); }
25
26 // implementation of IJoystickInterface
27 virtual EJoystickInterface Type(void) const override;
28 virtual bool Initialize(void) override;
29 virtual void Deinitialize(void) override;
30 virtual bool ScanForJoysticks(JoystickVector& joysticks) override;
31
32 private:
33 bool InitializeDirectInput(void);
34
35 static BOOL CALLBACK EnumJoysticksCallback(const DIDEVICEINSTANCE *pdidInstance, VOID *pContext);
36 static bool IsXInputDevice(const GUID *pGuidProductFromDirectInput);
37 static HWND GetMainWindowHandle(void);
38 static BOOL CALLBACK EnumWindowsCallback(HWND hnd, LPARAM lParam);
39
40 HWND m_hWnd; // Main window
41 LPDIRECTINPUT8 m_pDirectInput; // DirectInput handle, we hold onto it and release it when freeing resources
42 };
43 }