diff options
author | Sam Lantinga <slouken@libsdl.org> | 2020-11-16 17:36:47 -0800 |
---|---|---|
committer | Sam Lantinga <slouken@libsdl.org> | 2020-11-16 17:36:47 -0800 |
commit | a7ee52a4f3e231cb5ddfb562691ca67223d30e49 (patch) | |
tree | d655387deeddef43cba8b5f3e31ba3ab50ff11cf /test | |
parent | ed38b0386a5e74484bd63a7faa3ad349007b72b7 (diff) | |
download | sdl-a7ee52a4f3e231cb5ddfb562691ca67223d30e49.tar.gz |
Added SDL_JoystickGetSerial() and SDL_GameControllerGetSerial()
Diffstat (limited to 'test')
-rw-r--r-- | test/testgamecontroller.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/test/testgamecontroller.c b/test/testgamecontroller.c index 6b0f512ff..bc1f66dd5 100644 --- a/test/testgamecontroller.c +++ b/test/testgamecontroller.c @@ -101,8 +101,9 @@ static void UpdateWindowTitle() { const char *name = SDL_GameControllerName(gamecontroller); + const char *serial = SDL_GameControllerGetSerial(gamecontroller); const char *basetitle = "Game Controller Test: "; - const size_t titlelen = SDL_strlen(basetitle) + SDL_strlen(name) + 1; + const size_t titlelen = SDL_strlen(basetitle) + SDL_strlen(name) + (serial ? 3 + SDL_strlen(serial) : 0) + 1; char *title = (char *)SDL_malloc(titlelen); retval = SDL_FALSE; @@ -110,6 +111,11 @@ UpdateWindowTitle() if (title) { SDL_snprintf(title, titlelen, "%s%s", basetitle, name); + if (serial) { + SDL_strlcat(title, " (", titlelen); + SDL_strlcat(title, serial, titlelen); + SDL_strlcat(title, ")", titlelen); + } SDL_SetWindowTitle(window, title); SDL_free(title); } |