Add version info to bluescreen
This commit is contained in:
parent
146fb4b549
commit
5584acd189
@ -17,6 +17,7 @@
|
|||||||
#include "gui/Style.h"
|
#include "gui/Style.h"
|
||||||
#include "gui/game/GameController.h"
|
#include "gui/game/GameController.h"
|
||||||
#include "gui/game/GameView.h"
|
#include "gui/game/GameView.h"
|
||||||
|
#include "gui/game/IntroText.h"
|
||||||
#include "gui/dialogues/ConfirmPrompt.h"
|
#include "gui/dialogues/ConfirmPrompt.h"
|
||||||
#include "gui/dialogues/ErrorMessage.h"
|
#include "gui/dialogues/ErrorMessage.h"
|
||||||
#include "gui/interface/Engine.h"
|
#include "gui/interface/Engine.h"
|
||||||
@ -102,6 +103,7 @@ void BlueScreen(String detailMessage)
|
|||||||
String errorTitle = "ERROR";
|
String errorTitle = "ERROR";
|
||||||
String errorDetails = "Details: " + detailMessage;
|
String errorDetails = "Details: " + detailMessage;
|
||||||
String errorHelp = String("An unrecoverable fault has occurred, please report the error by visiting the website below\n") + SCHEME + SERVER;
|
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
|
// 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);
|
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));
|
engine.g->BlendText(pos, errorDetails, 0xFFFFFF_rgb .WithAlpha(0xFF));
|
||||||
pos.Y += 4 + Graphics::TextSize(errorDetails).Y;
|
pos.Y += 4 + Graphics::TextSize(errorDetails).Y;
|
||||||
engine.g->BlendText(pos, errorHelp, 0xFFFFFF_rgb .WithAlpha(0xFF));
|
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
|
//Death loop
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
|
@ -2,6 +2,40 @@
|
|||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
#include "common/String.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()
|
inline ByteString IntroText()
|
||||||
{
|
{
|
||||||
ByteStringBuilder sb;
|
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 << "\bgTo use online features such as saving, you need to register at: \brhttps://powdertoy.co.uk/Register.html\n";
|
||||||
}
|
}
|
||||||
sb << "\n"
|
sb << "\n\bt" << VersionInfo();
|
||||||
<< "\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";
|
|
||||||
}
|
|
||||||
return sb.Build();
|
return sb.Build();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user