Frendlier error message when font does not exist

This commit is contained in:
Stepland 2022-01-04 17:36:53 +01:00
parent ca78a8ee69
commit 03ddbc2695
2 changed files with 12 additions and 0 deletions

1
.gitignore vendored
View File

@ -5,3 +5,4 @@ CMakeFiles
cmake-default
build/**
imgui.ini

View File

@ -30,6 +30,17 @@ int main(int argc, char** argv) {
ImGui::SFML::Init(window, false);
auto font_path = assets_folder / "fonts" / "NotoSans-Medium.ttf";
if (not std::filesystem::exists(font_path)) {
tinyfd_messageBox(
"Error",
("Could not open "+font_path.string()).c_str(),
"ok",
"error",
1
);
return -1;
}
ImGuiIO& IO = ImGui::GetIO();
IO.Fonts->Clear();
IO.Fonts->AddFontFromFileTTF(