summaryrefslogtreecommitdiffhomepage
path: root/dinput/win32-joystick.hpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2022-01-13 14:14:20 +0100
committerStanislaw Halik <sthalik@misaki.pl>2022-01-13 14:24:05 +0100
commite0f0353dd5314d7836a7d3030e4895865f2e62ff (patch)
tree66a53ed743f36c1840c035841c80c42e55534f7f /dinput/win32-joystick.hpp
parentc6cdf9cfc701b5c9f02f37178b8364abd0bf4d93 (diff)
dinput: don't include <windows.h> in headers
Issue: #583
Diffstat (limited to 'dinput/win32-joystick.hpp')
-rw-r--r--dinput/win32-joystick.hpp17
1 files changed, 7 insertions, 10 deletions
diff --git a/dinput/win32-joystick.hpp b/dinput/win32-joystick.hpp
index ff52ad1d..8e5344d6 100644
--- a/dinput/win32-joystick.hpp
+++ b/dinput/win32-joystick.hpp
@@ -10,6 +10,7 @@
#include "dinput.hpp"
#include "compat/timer.hpp"
#include "export.hpp"
+#include "compat/qhash.hpp"
#include <memory>
#include <vector>
@@ -17,15 +18,13 @@
#include <unordered_map>
#include <iterator>
-#include "compat/qhash.hpp"
#include <QString>
#include <QMutex>
namespace win32_joy_impl {
-static constexpr unsigned max_buttons = std::size(DIJOYSTATE2().rgbButtons);
-static constexpr unsigned max_pov_hats = std::size(DIJOYSTATE2().rgdwPOV);
-
+static constexpr unsigned max_buttons = 128;
+static constexpr unsigned max_pov_hats = 4;
static constexpr unsigned pov_hat_directions = 8;
// cf. https://docs.microsoft.com/en-us/previous-versions/windows/desktop/ee416628(v=vs.85)
@@ -48,13 +47,11 @@ struct OTR_DINPUT_EXPORT win32_joy_ctx final
struct joy final
{
- LPDIRECTINPUTDEVICE8 joy_handle;
+ IDirectInputDevice8A* joy_handle;
QString guid, name;
bool last_state[max_buttons_and_pov_hats] {};
- static DIDEVICEOBJECTDATA keystate_buffers[num_buffers];
-
- joy(LPDIRECTINPUTDEVICE8 handle, const QString& guid, const QString& name);
+ joy(IDirectInputDevice8A* handle, const QString& guid, const QString& name);
~joy();
void release();
@@ -89,8 +86,8 @@ private:
joys_t joys;
di_t di;
- static BOOL CALLBACK EnumJoysticksCallback(const DIDEVICEINSTANCE* pdidInstance, VOID* pContext);
- static BOOL CALLBACK EnumObjectsCallback(const DIDEVICEOBJECTINSTANCE* pdidoi, VOID* ctx);
+ static BOOL __stdcall EnumJoysticksCallback(const DIDEVICEINSTANCEA* pdidInstance, void* pContext);
+ static BOOL __stdcall EnumObjectsCallback(const DIDEVICEOBJECTINSTANCEA* pdidoi, void* ctx);
public:
static QMutex mtx;