testgamepad works for joysticks as well as gamepads

This commit is contained in:
Sam Lantinga
2023-07-16 04:32:12 -07:00
parent eda2824e6f
commit 34876c390f
2 changed files with 290 additions and 283 deletions
+7 -1
View File
@@ -408,6 +408,12 @@ void UpdateGamepadImageFromGamepad(GamepadImage *ctx, SDL_Gamepad *gamepad)
SDL_GetGamepadTouchpadFinger(gamepad, 0, i, &finger->state, &finger->x, &finger->y, &finger->pressure);
}
} else {
if (ctx->fingers) {
SDL_free(ctx->fingers);
ctx->fingers = NULL;
ctx->num_fingers = 0;
}
}
}
@@ -613,7 +619,7 @@ void RenderGamepadDisplay(GamepadDisplay *ctx, SDL_Gamepad *gamepad)
SDL_bool has_accel;
SDL_bool has_gyro;
if (!ctx) {
if (!ctx || !gamepad) {
return;
}
+283 -282
View File
File diff suppressed because it is too large Load Diff