diff --git a/src/PowderToy.cpp b/src/PowderToy.cpp index 92d46b99f..515b2b38c 100644 --- a/src/PowderToy.cpp +++ b/src/PowderToy.cpp @@ -17,6 +17,7 @@ #include "gui/Style.h" #include "gui/game/GameController.h" #include "gui/game/GameView.h" +#include "gui/game/IntroText.h" #include "gui/dialogues/ConfirmPrompt.h" #include "gui/dialogues/ErrorMessage.h" #include "gui/interface/Engine.h" @@ -102,6 +103,7 @@ void BlueScreen(String detailMessage) String errorTitle = "ERROR"; String errorDetails = "Details: " + detailMessage; String errorHelp = String("An unrecoverable fault has occurred, please report the error by visiting the website below\n") + SCHEME + SERVER; + auto versionInfo = ByteString::Build("Version: ", VersionInfo(), "\nTag: ", VCS_TAG).FromUtf8(); // We use the width of errorHelp to center, but heights of the individual texts for vertical spacing auto pos = engine.g->Size() / 2 - Vec2(Graphics::TextSize(errorHelp).X / 2, 100); @@ -110,6 +112,8 @@ void BlueScreen(String detailMessage) engine.g->BlendText(pos, errorDetails, 0xFFFFFF_rgb .WithAlpha(0xFF)); pos.Y += 4 + Graphics::TextSize(errorDetails).Y; engine.g->BlendText(pos, errorHelp, 0xFFFFFF_rgb .WithAlpha(0xFF)); + pos.Y += 4 + Graphics::TextSize(errorHelp).Y; + engine.g->BlendText(pos, versionInfo, 0xFFFFFF_rgb .WithAlpha(0xFF)); //Death loop SDL_Event event; diff --git a/src/gui/game/IntroText.h b/src/gui/game/IntroText.h index 83d77c6a0..9ab482324 100644 --- a/src/gui/game/IntroText.h +++ b/src/gui/game/IntroText.h @@ -2,6 +2,40 @@ #include "Config.h" #include "common/String.h" +inline ByteString VersionInfo() +{ + ByteStringBuilder sb; + sb << SAVE_VERSION << "." << MINOR_VERSION << "." << BUILD_NUM << " " << IDENT; + if constexpr (SNAPSHOT) + { + sb << " SNAPSHOT " << SNAPSHOT_ID; + } + else if constexpr (MOD) + { + sb << " MODVER " << SNAPSHOT_ID; + } + if constexpr (LUACONSOLE) + { + sb << " LUACONSOLE"; + } +#ifdef REALISTIC + sb << " REALISTIC"; +#endif + if constexpr (NOHTTP) + { + sb << " NOHTTP"; + } + else if constexpr (ENFORCE_HTTPS) + { + sb << " HTTPS"; + } + if constexpr (DEBUG) + { + sb << " DEBUG"; + } + return sb.Build(); +} + inline ByteString IntroText() { ByteStringBuilder sb; @@ -37,34 +71,6 @@ inline ByteString IntroText() { sb << "\bgTo use online features such as saving, you need to register at: \brhttps://powdertoy.co.uk/Register.html\n"; } - sb << "\n" - << "\bt" << SAVE_VERSION << "." << MINOR_VERSION << "." << BUILD_NUM << " " << IDENT; - if constexpr (SNAPSHOT) - { - sb << " SNAPSHOT " << SNAPSHOT_ID; - } - else if constexpr (MOD) - { - sb << " MODVER " << SNAPSHOT_ID; - } - if constexpr (LUACONSOLE) - { - sb << " LUACONSOLE"; - } -#ifdef REALISTIC - sb << " REALISTIC"; -#endif - if constexpr (NOHTTP) - { - sb << " NOHTTP"; - } - else if constexpr (ENFORCE_HTTPS) - { - sb << " HTTPS"; - } - if constexpr (DEBUG) - { - sb << " DEBUG"; - } + sb << "\n\bt" << VersionInfo(); return sb.Build(); }