Add loading screen to online mode, fix ImGui frame conflict, truncate log on start

Online world entry now shows a progress bar during character model,
terrain, and tile streaming. Fixed loading screen crash from calling
ImGui::NewFrame while a frame was already in progress. Log file is
now truncated on each launch instead of appending.
This commit is contained in:
Kelsi 2026-02-06 14:49:53 -08:00
parent 6f33392155
commit 81d712121e
3 changed files with 138 additions and 29 deletions

View file

@ -1,6 +1,7 @@
#include "rendering/loading_screen.hpp"
#include "core/logger.hpp"
#include <imgui.h>
#include <imgui_internal.h>
#include <imgui_impl_opengl3.h>
#include <imgui_impl_sdl2.h>
#include <random>
@ -352,6 +353,13 @@ void LoadingScreen::render() {
// Draw status text and percentage with ImGui overlay
{
// If a frame is already in progress (e.g. called from a UI callback),
// end it before starting our own
ImGuiContext* ctx = ImGui::GetCurrentContext();
if (ctx && ctx->FrameCount >= 0 && ctx->WithinFrameScope) {
ImGui::EndFrame();
}
ImGuiIO& io = ImGui::GetIO();
float screenW = io.DisplaySize.x;
float screenH = io.DisplaySize.y;