From c94283d4047448b4f73a8467fc276a56aea804b9 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 13 Jan 2021 11:01:54 -0800 Subject: [PATCH] testgamecontroller: log which controller the event came from --- test/testgamecontroller.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/test/testgamecontroller.c b/test/testgamecontroller.c index 1a6b2f325..34e9001de 100644 --- a/test/testgamecontroller.c +++ b/test/testgamecontroller.c @@ -267,7 +267,8 @@ loop(void *arg) case SDL_CONTROLLERTOUCHPADDOWN: case SDL_CONTROLLERTOUCHPADMOTION: case SDL_CONTROLLERTOUCHPADUP: - SDL_Log("Controller touchpad %d finger %d %s %.2f, %.2f, %.2f\n", + SDL_Log("Controller %d touchpad %d finger %d %s %.2f, %.2f, %.2f\n", + event.ctouchpad.which, event.ctouchpad.touchpad, event.ctouchpad.finger, (event.type == SDL_CONTROLLERTOUCHPADDOWN ? "pressed at" : @@ -279,7 +280,8 @@ loop(void *arg) break; case SDL_CONTROLLERSENSORUPDATE: - SDL_Log("Controller sensor %s: %.2f, %.2f, %.2f\n", + SDL_Log("Controller %d sensor %s: %.2f, %.2f, %.2f\n", + event.csensor.which, event.csensor.sensor == SDL_SENSOR_ACCEL ? "accelerometer" : event.csensor.sensor == SDL_SENSOR_GYRO ? "gyro" : "unknown", event.csensor.data[0], @@ -291,7 +293,7 @@ loop(void *arg) if (event.caxis.value <= (-SDL_JOYSTICK_AXIS_MAX / 2) || event.caxis.value >= (SDL_JOYSTICK_AXIS_MAX / 2)) { SetController(event.caxis.which); } - SDL_Log("Controller axis %s changed to %d\n", SDL_GameControllerGetStringForAxis((SDL_GameControllerAxis)event.caxis.axis), event.caxis.value); + SDL_Log("Controller %d axis %s changed to %d\n", event.caxis.which, SDL_GameControllerGetStringForAxis((SDL_GameControllerAxis)event.caxis.axis), event.caxis.value); break; case SDL_CONTROLLERBUTTONDOWN: @@ -299,7 +301,7 @@ loop(void *arg) if (event.type == SDL_CONTROLLERBUTTONDOWN) { SetController(event.cbutton.which); } - SDL_Log("Controller button %s %s\n", SDL_GameControllerGetStringForButton((SDL_GameControllerButton)event.cbutton.button), event.cbutton.state ? "pressed" : "released"); + SDL_Log("Controller %d button %s %s\n", event.cbutton.which, SDL_GameControllerGetStringForButton((SDL_GameControllerButton)event.cbutton.button), event.cbutton.state ? "pressed" : "released"); break; case SDL_KEYDOWN: