add severity to platformMessageBox

This commit is contained in:
ConfiG 2024-01-13 03:08:08 +03:00
parent f6cde6a62f
commit d81e1ba072
No known key found for this signature in database
GPG key ID: 44DA1983F524C11B
2 changed files with 17 additions and 3 deletions
loader/src
loader
platform/windows

View file

@ -170,7 +170,7 @@ namespace geode {
bool platformConsoleOpen() const;
void openPlatformConsole();
void closePlatformConsole();
void platformMessageBox(char const* title, std::string const& info);
void platformMessageBox(char const* title, std::string const& info, Severity severity = Severity::Error);
bool verifyLoaderResources();
void checkForLoaderUpdates();

View file

@ -25,8 +25,22 @@ std::string Loader::Impl::getGameVersion() {
return m_gdVersion;
}
void Loader::Impl::platformMessageBox(char const* title, std::string const& info) {
MessageBoxA(nullptr, info.c_str(), title, MB_ICONERROR);
void Loader::Impl::platformMessageBox(char const* title, std::string const& info, Severity severity) {
unsigned int icon;
switch (severity) {
case Severity::Debug:
case Severity::Info:
case Severity::Notice:
icon = MB_ICONINFORMATION;
break;
case Severity::Warning:
icon = MB_ICONWARNING;
break;
default:
icon = MB_ICONERROR;
break;
}
MessageBoxA(nullptr, info.c_str(), title, icon);
}
bool hasAnsiColorSupport = false;