diff --git a/extern/imgui_patched/backends/imgui_impl_sdlrenderer.cpp b/extern/imgui_patched/backends/imgui_impl_sdlrenderer.cpp index 8125b119a..8cc79f7e9 100644 --- a/extern/imgui_patched/backends/imgui_impl_sdlrenderer.cpp +++ b/extern/imgui_patched/backends/imgui_impl_sdlrenderer.cpp @@ -94,13 +94,14 @@ static void ImGui_ImplSDLRenderer_SetupRenderState() SDL_RenderSetClipRect(bd->SDLRenderer, NULL); } -void ImGui_ImplSDLRenderer_NewFrame() +bool ImGui_ImplSDLRenderer_NewFrame() { ImGui_ImplSDLRenderer_Data* bd = ImGui_ImplSDLRenderer_GetBackendData(); IM_ASSERT(bd != NULL && "Did you call ImGui_ImplSDLRenderer_Init()?"); if (!bd->FontTexture) - ImGui_ImplSDLRenderer_CreateDeviceObjects(); + return ImGui_ImplSDLRenderer_CreateDeviceObjects(); + return true; } void ImGui_ImplSDLRenderer_RenderDrawData(ImDrawData* draw_data) diff --git a/extern/imgui_patched/backends/imgui_impl_sdlrenderer.h b/extern/imgui_patched/backends/imgui_impl_sdlrenderer.h index 78d9bcbe1..3281a7586 100644 --- a/extern/imgui_patched/backends/imgui_impl_sdlrenderer.h +++ b/extern/imgui_patched/backends/imgui_impl_sdlrenderer.h @@ -21,7 +21,7 @@ struct SDL_Renderer; IMGUI_IMPL_API bool ImGui_ImplSDLRenderer_Init(SDL_Renderer* renderer); IMGUI_IMPL_API void ImGui_ImplSDLRenderer_Shutdown(); -IMGUI_IMPL_API void ImGui_ImplSDLRenderer_NewFrame(); +IMGUI_IMPL_API bool ImGui_ImplSDLRenderer_NewFrame(); IMGUI_IMPL_API void ImGui_ImplSDLRenderer_RenderDrawData(ImDrawData* draw_data); // Called by Init/NewFrame/Shutdown diff --git a/extern/imgui_patched/imgui_impl_sdlrenderer.cpp b/extern/imgui_patched/imgui_impl_sdlrenderer.cpp index 89c87f62b..9da0d488d 100644 --- a/extern/imgui_patched/imgui_impl_sdlrenderer.cpp +++ b/extern/imgui_patched/imgui_impl_sdlrenderer.cpp @@ -95,13 +95,15 @@ static void ImGui_ImplSDLRenderer_SetupRenderState() SDL_RenderSetClipRect(bd->SDLRenderer, NULL); } -void ImGui_ImplSDLRenderer_NewFrame() +bool ImGui_ImplSDLRenderer_NewFrame() { ImGui_ImplSDLRenderer_Data* bd = ImGui_ImplSDLRenderer_GetBackendData(); IM_ASSERT(bd != NULL && "Did you call ImGui_ImplSDLRenderer_Init()?"); if (!bd->FontTexture) - ImGui_ImplSDLRenderer_CreateDeviceObjects(); + return ImGui_ImplSDLRenderer_CreateDeviceObjects(); + + return true; } void ImGui_ImplSDLRenderer_RenderDrawData(ImDrawData* draw_data) diff --git a/extern/imgui_patched/imgui_impl_sdlrenderer.h b/extern/imgui_patched/imgui_impl_sdlrenderer.h index 37adce66a..379265de0 100644 --- a/extern/imgui_patched/imgui_impl_sdlrenderer.h +++ b/extern/imgui_patched/imgui_impl_sdlrenderer.h @@ -21,7 +21,7 @@ struct SDL_Renderer; IMGUI_IMPL_API bool ImGui_ImplSDLRenderer_Init(SDL_Renderer* renderer); IMGUI_IMPL_API void ImGui_ImplSDLRenderer_Shutdown(); -IMGUI_IMPL_API void ImGui_ImplSDLRenderer_NewFrame(); +IMGUI_IMPL_API bool ImGui_ImplSDLRenderer_NewFrame(); IMGUI_IMPL_API void ImGui_ImplSDLRenderer_RenderDrawData(ImDrawData* draw_data); // Called by Init/NewFrame/Shutdown diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 64be68ebb..0f255513e 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -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;