Input event and device enums (#17514)

* Switch deviceID from int to enum InputDeviceID, globally

* Switch axisId to enum InputAxis

* Change int keycodes to InputKeyCode where it makes sense.

* SDL input buildfix

* SDL keycode buildfix

* Switch on enum warning fixes

* Qt keycode buildfix

* iOS keycode buildfix

* UWP keycode buildfix

* More iOS buildfix

* More iOS buildfix

* Update DinputDevice.cpp
This commit is contained in:
Henrik Rydgård authored and GitHub committed 2023-05-26 18:40:13 +02:00
1 parent 6f380a7a0a
commit 2675d6ea43
32 files changed
+129 -133

No files matched your search

+3 -3
View File
@@ -39,7 +39,7 @@ std::vector<DIDEVICEINSTANCE> DinputDevice::devices;
bool DinputDevice::needsCheck_ = true;
// In order from 0. There can be 128, but most controllers do not have that many.
static const int dinput_buttons[] = {
static const InputKeyCode dinput_buttons[] = {
NKCODE_BUTTON_1,
NKCODE_BUTTON_2,
NKCODE_BUTTON_3,
@@ -203,11 +203,11 @@ DinputDevice::~DinputDevice() {
}
}
void SendNativeAxis(int deviceId, int value, int &lastValue, int axisId) {
void SendNativeAxis(InputDeviceID deviceId, int value, int &lastValue, InputAxis axisId) {
AxisInput axis;
axis.deviceId = deviceId;
axis.axisId = axisId;
axis.value = (float)value / 10000.0f; // Convert axis to normalised float
axis.value = (float)value * (1.0f / 10000.0f); // Convert axis to normalised float
NativeAxis(axis);
lastValue = value;