testcontroller: use the correct label for face buttons

This commit is contained in:
Sam Lantinga
2025-07-15 15:52:40 -07:00
parent 08e3758e3f
commit 1b65f25465

View File

@@ -369,6 +369,7 @@ struct GamepadImage
bool showing_front;
bool showing_touchpad;
SDL_GamepadType type;
SDL_GamepadButtonLabel east_label;
ControllerDisplayMode display_mode;
bool elements[SDL_GAMEPAD_ELEMENT_MAX];
@@ -674,6 +675,7 @@ void UpdateGamepadImageFromGamepad(GamepadImage *ctx, SDL_Gamepad *gamepad)
}
ctx->type = SDL_GetGamepadType(gamepad);
ctx->east_label = SDL_GetGamepadButtonLabel(gamepad, SDL_GAMEPAD_BUTTON_EAST);
char *mapping = SDL_GetGamepadMapping(gamepad);
if (mapping) {
if (SDL_strstr(mapping, "SDL_GAMECONTROLLER_USE_BUTTON_LABELS")) {
@@ -795,7 +797,7 @@ void RenderGamepadImage(GamepadImage *ctx)
dst.w = ctx->face_width;
dst.h = ctx->face_height;
switch (SDL_GetGamepadButtonLabelForType(ctx->type, SDL_GAMEPAD_BUTTON_EAST)) {
switch (ctx->east_label) {
case SDL_GAMEPAD_BUTTON_LABEL_B:
SDL_RenderTexture(ctx->renderer, ctx->face_abxy_texture, NULL, &dst);
break;