Browse Source

Fix joystick test

Remove mapping for gamepad.
master
TheoryOfNekomata 1 year ago
parent
commit
82f85f25ef
2 changed files with 17 additions and 7 deletions
  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 View 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 View 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]) {


Loading…
Cancel
Save