Sfoglia il codice sorgente

Fix joystick test

Remove mapping for gamepad.
master
parent
commit
82f85f25ef
2 ha cambiato i file con 17 aggiunte e 7 eliminazioni
  1. +8
    -0
      __tests__/src/packages/game/input.test.c
  2. +9
    -7
      src/packages/game/input/IZ_joystick.c

+ 8
- 0
__tests__/src/packages/game/input.test.c Vedi File

@@ -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),


+ 9
- 7
src/packages/game/input/IZ_joystick.c Vedi File

@@ -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]) {


Caricamento…
Annulla
Salva