mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-06-01 06:44:27 +08:00
testcontroller: use the correct label for face buttons
This commit is contained in:
+3
-1
@@ -369,6 +369,7 @@ struct GamepadImage
|
|||||||
bool showing_front;
|
bool showing_front;
|
||||||
bool showing_touchpad;
|
bool showing_touchpad;
|
||||||
SDL_GamepadType type;
|
SDL_GamepadType type;
|
||||||
|
SDL_GamepadButtonLabel east_label;
|
||||||
ControllerDisplayMode display_mode;
|
ControllerDisplayMode display_mode;
|
||||||
|
|
||||||
bool elements[SDL_GAMEPAD_ELEMENT_MAX];
|
bool elements[SDL_GAMEPAD_ELEMENT_MAX];
|
||||||
@@ -674,6 +675,7 @@ void UpdateGamepadImageFromGamepad(GamepadImage *ctx, SDL_Gamepad *gamepad)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ctx->type = SDL_GetGamepadType(gamepad);
|
ctx->type = SDL_GetGamepadType(gamepad);
|
||||||
|
ctx->east_label = SDL_GetGamepadButtonLabel(gamepad, SDL_GAMEPAD_BUTTON_EAST);
|
||||||
char *mapping = SDL_GetGamepadMapping(gamepad);
|
char *mapping = SDL_GetGamepadMapping(gamepad);
|
||||||
if (mapping) {
|
if (mapping) {
|
||||||
if (SDL_strstr(mapping, "SDL_GAMECONTROLLER_USE_BUTTON_LABELS")) {
|
if (SDL_strstr(mapping, "SDL_GAMECONTROLLER_USE_BUTTON_LABELS")) {
|
||||||
@@ -795,7 +797,7 @@ void RenderGamepadImage(GamepadImage *ctx)
|
|||||||
dst.w = ctx->face_width;
|
dst.w = ctx->face_width;
|
||||||
dst.h = ctx->face_height;
|
dst.h = ctx->face_height;
|
||||||
|
|
||||||
switch (SDL_GetGamepadButtonLabelForType(ctx->type, SDL_GAMEPAD_BUTTON_EAST)) {
|
switch (ctx->east_label) {
|
||||||
case SDL_GAMEPAD_BUTTON_LABEL_B:
|
case SDL_GAMEPAD_BUTTON_LABEL_B:
|
||||||
SDL_RenderTexture(ctx->renderer, ctx->face_abxy_texture, NULL, &dst);
|
SDL_RenderTexture(ctx->renderer, ctx->face_abxy_texture, NULL, &dst);
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user