From 172e3a89850f258b6a317c3f97f1baa00b3bc450 Mon Sep 17 00:00:00 2001 From: Misa Date: Mon, 16 Jan 2023 12:59:48 -0800 Subject: [PATCH] Add branch name to window title in brackets The branch name will be added to the window title if it is an interim version, e.g. "VVVVVV [master]". This makes it easier for developers to tell at a glance which build of the game they're running. --- desktop_version/src/Screen.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/desktop_version/src/Screen.cpp b/desktop_version/src/Screen.cpp index b26b0c0b..f159dbdb 100644 --- a/desktop_version/src/Screen.cpp +++ b/desktop_version/src/Screen.cpp @@ -8,6 +8,7 @@ #include "FileSystemUtils.h" #include "Game.h" #include "GraphicsUtil.h" +#include "InterimVersion.h" #include "Vlogging.h" void ScreenSettings_default(struct ScreenSettings* _this) @@ -52,7 +53,16 @@ void Screen::init(const struct ScreenSettings* settings) &m_window, &m_renderer ); +#ifdef INTERIM_VERSION_EXISTS + /* Branch name limits are ill-defined but on GitHub it's ~256 chars + * ( https://stackoverflow.com/a/24014513/ ). + * Really though, just don't use super long branch names. */ + char title[256]; + SDL_snprintf(title, sizeof(title), "VVVVVV [%s]", BRANCH_NAME); + SDL_SetWindowTitle(m_window, title); +#else SDL_SetWindowTitle(m_window, "VVVVVV"); +#endif LoadIcon();