From 82f85f25ef57572fe15a8c765c12f74898f4a840 Mon Sep 17 00:00:00 2001 From: TheoryOfNekomata Date: Wed, 1 Mar 2023 23:55:53 +0800 Subject: [PATCH] Fix joystick test Remove mapping for gamepad. --- __tests__/src/packages/game/input.test.c | 8 ++++++++ src/packages/game/input/IZ_joystick.c | 16 +++++++++------- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/__tests__/src/packages/game/input.test.c b/__tests__/src/packages/game/input.test.c index 5e43914..506198e 100644 --- a/__tests__/src/packages/game/input.test.c +++ b/__tests__/src/packages/game/input.test.c @@ -323,6 +323,14 @@ spec("input") { state[p].config.control_mapping[i] = IZ_JOYSTICK_DEFAULT_STATE[p].config.control_mapping[i]; action[p] = 0; + if (i == IZ_ACTION_INDEX_ACTION2) { + ; + } + + if (i == IZ_ACTION_INDEX_ACTION4) { + ; + } + IZ_JoystickHandleEvents(&state, &action, e); check( action[p] == (0x1u << i), diff --git a/src/packages/game/input/IZ_joystick.c b/src/packages/game/input/IZ_joystick.c index 925ca2e..6e240f4 100644 --- a/src/packages/game/input/IZ_joystick.c +++ b/src/packages/game/input/IZ_joystick.c @@ -138,15 +138,17 @@ void IZ_JoystickHandleButtonEvents(IZ_JoystickState* state, IZ_Action* action, S // TODO test with XInput, make compatible with Apple + // TODO honor mapping with controller + #ifdef IZ_MACOS //printf("%d\n", e.jbutton.button); - if (e.jbutton.button == 2) { - normalized_button = 4; - } else if (e.jbutton.button == 6) { - normalized_button = 11; - } else if (e.jbutton.button == 4) { - normalized_button = 10; - } +// if (e.jbutton.button == 2) { +// normalized_button = 4; +// } else if (e.jbutton.button == 6) { +// normalized_button = 11; +// } else if (e.jbutton.button == 4) { +// normalized_button = 10; +// } #endif if (normalized_button == state->config.control_mapping[control_index]) {