From e2479261c56c8d1a64b51ad4f084ad3c18505359 Mon Sep 17 00:00:00 2001 From: LaG1924 <12997935+LaG1924@users.noreply.github.com> Date: Sun, 27 Jan 2019 10:10:33 +0500 Subject: GameState double-buffering --- src/Render.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/Render.cpp') diff --git a/src/Render.cpp b/src/Render.cpp index 5432979..0268bee 100644 --- a/src/Render.cpp +++ b/src/Render.cpp @@ -348,6 +348,9 @@ void Render::SetMouseCapture(bool IsCaptured) { } void Render::Update() { + if (world) + world->UpdateGameState(GlobalState::GetGameState()); + HandleEvents(); if (HasFocus && GlobalState::GetState() == State::Playing) UpdateKeyboard(); if (isMouseCaptured) HandleMouseCapture(); @@ -384,8 +387,7 @@ void Render::RenderGui() { if (world) { Entity *playerPtr = world->GameStatePtr()->GetPlayer(); SelectionStatus selectionStatus = world->GameStatePtr()->GetSelectionStatus(); - World worldObj = world->GameStatePtr()->GetWorld(); - World *worldPtr = &worldObj; + World *worldPtr = &world->GameStatePtr()->GetWorld(); ImGui::Text("TPS: %.1f (%.2fms)", 1000.0f / gameTime, gameTime); ImGui::Text("Sections loaded: %d", (int) DebugInfo::totalSections); -- cgit v1.2.3