Windows & displaysSDL 3.2

SDL_SetWindowTitle

Changes the text in the window's title bar.

Signature

bool SDL_SetWindowTitle(SDL_Window *window, const char *title);

How it works

Useful for showing the frame rate or the open file's name during development. Update it a few times per second at most: on some systems the call is slow.

Parameters

windowSDL_Window *

The window to rename.

titleconst char *

The new title, UTF-8. SDL copies it.

Return value

true on success, false on failure.

Example

example.cpp
1char title[64];
2SDL_snprintf(title, sizeof title, "Game - %.0f fps", fps);
3SDL_SetWindowTitle(window, title);
Official SDL wiki