Skip to content

Commit

Permalink
Add branch name to window title in brackets
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
InfoTeddy committed Jan 16, 2023
1 parent 19a8385 commit 172e3a8
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions desktop_version/src/Screen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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();

Expand Down

0 comments on commit 172e3a8

Please sign in to comment.