GUI: no more rectangles

when font fails to load
This commit is contained in:
tildearrow 2023-05-03 01:22:54 -05:00
parent c98f21f1e2
commit 05b10bb50a
5 changed files with 26 additions and 7 deletions

View file

@ -3750,9 +3750,13 @@ bool FurnaceGUI::loop() {
});
}
bool fontsFailed=false;
layoutTimeBegin=SDL_GetPerformanceCounter();
ImGui_ImplSDLRenderer_NewFrame();
if (!ImGui_ImplSDLRenderer_NewFrame()) {
fontsFailed=true;
}
ImGui_ImplSDL2_NewFrame(sdlWin);
ImGui::NewFrame();
@ -5792,6 +5796,18 @@ bool FurnaceGUI::loop() {
willCommit=false;
}
if (fontsFailed) {
showError("it appears I couldn't load these fonts. any setting you can check?");
logE("couldn't load fonts");
ImGui::GetIO().Fonts->Clear();
mainFont=ImGui::GetIO().Fonts->AddFontDefault();
patFont=mainFont;
ImGui_ImplSDLRenderer_DestroyFontsTexture();
if (!ImGui::GetIO().Fonts->Build()) {
logE("error again while building font atlas!");
}
}
if (!editOptsVisible) {
latchTarget=0;
latchNibble=false;