diff --git a/Backends/System/FreeBSD/Sources/kinc/backend/input/gamepad.cpp b/Backends/System/FreeBSD/Sources/kinc/backend/input/gamepad.cpp index 0204382f8..31c27275f 100644 --- a/Backends/System/FreeBSD/Sources/kinc/backend/input/gamepad.cpp +++ b/Backends/System/FreeBSD/Sources/kinc/backend/input/gamepad.cpp @@ -96,18 +96,17 @@ namespace { } } - const int gamepadCount = 12; - HIDGamepad gamepads[gamepadCount]; + HIDGamepad gamepads[KINC_GAMEPAD_MAX_COUNT]; } void Kore::initHIDGamepads() { - for (int i = 0; i < gamepadCount; ++i) { + for (int i = 0; i < KINC_GAMEPAD_MAX_COUNT; ++i) { gamepads[i].init(i); } } void Kore::updateHIDGamepads() { - for (int i = 0; i < gamepadCount; ++i) { + for (int i = 0; i < KINC_GAMEPAD_MAX_COUNT; ++i) { gamepads[i].update(); } } diff --git a/Backends/System/Linux/Sources/kinc/backend/gamepad.c.h b/Backends/System/Linux/Sources/kinc/backend/gamepad.c.h index ded95102e..03d671133 100644 --- a/Backends/System/Linux/Sources/kinc/backend/gamepad.c.h +++ b/Backends/System/Linux/Sources/kinc/backend/gamepad.c.h @@ -87,8 +87,7 @@ struct HIDGamepadUdevHelper { static struct HIDGamepadUdevHelper udev_helper; -#define gamepadCount 12 -static struct HIDGamepad gamepads[gamepadCount]; +static struct HIDGamepad gamepads[KINC_GAMEPAD_MAX_COUNT]; static void HIDGamepadUdevHelper_openOrCloseGamepad(struct HIDGamepadUdevHelper *helper, struct udev_device *dev) { const char *action = udev_device_get_action(dev); @@ -167,7 +166,7 @@ static void HIDGamepadUdevHelper_close(struct HIDGamepadUdevHelper *helper) { } void kinc_linux_initHIDGamepads() { - for (int i = 0; i < gamepadCount; ++i) { + for (int i = 0; i < KINC_GAMEPAD_MAX_COUNT; ++i) { HIDGamepad_init(&gamepads[i], i); } HIDGamepadUdevHelper_init(&udev_helper); @@ -175,7 +174,7 @@ void kinc_linux_initHIDGamepads() { void kinc_linux_updateHIDGamepads() { HIDGamepadUdevHelper_update(&udev_helper); - for (int i = 0; i < gamepadCount; ++i) { + for (int i = 0; i < KINC_GAMEPAD_MAX_COUNT; ++i) { HIDGamepad_update(&gamepads[i]); } } diff --git a/Sources/kinc/input/gamepad.h b/Sources/kinc/input/gamepad.h index 212740e4b..d2583ce7b 100644 --- a/Sources/kinc/input/gamepad.h +++ b/Sources/kinc/input/gamepad.h @@ -10,6 +10,8 @@ extern "C" { #endif +#define KINC_GAMEPAD_MAX_COUNT 12 + /// /// Sets the gamepad-connect-callback which is called when a gamepad is connected. ///