diff --git a/source/graphics/MiniMapTexture.cpp b/source/graphics/MiniMapTexture.cpp index 8779a57e5d..c248aa0297 100644 --- a/source/graphics/MiniMapTexture.cpp +++ b/source/graphics/MiniMapTexture.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2025 Wildfire Games. +/* Copyright (C) 2026 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -354,6 +354,11 @@ CMiniMapTexture::~CMiniMapTexture() DestroyTextures(); } +void CMiniMapTexture::RequestRendering() +{ + m_RenderingRequested = true; +} + void CMiniMapTexture::Update(const float /*deltaRealTime*/) { if (m_WaterHeight != g_Renderer.GetSceneRenderer().GetWaterManager().m_WaterHeight) @@ -367,6 +372,9 @@ void CMiniMapTexture::Render( Renderer::Backend::IDeviceCommandContext* deviceCommandContext, CLOSTexture& losTexture, CTerritoryTexture& territoryTexture) { + if (!std::exchange(m_RenderingRequested, false)) + return; + const CTerrain& terrain = g_Game->GetWorld()->GetTerrain(); if (!m_TerrainTexture) CreateTextures(deviceCommandContext, terrain); diff --git a/source/graphics/MiniMapTexture.h b/source/graphics/MiniMapTexture.h index 085ef4dfc2..183d12b25f 100644 --- a/source/graphics/MiniMapTexture.h +++ b/source/graphics/MiniMapTexture.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2025 Wildfire Games. +/* Copyright (C) 2026 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -50,6 +50,8 @@ public: CMiniMapTexture(Renderer::Backend::IDevice* device, CSimulation2& simulation); ~CMiniMapTexture(); + void RequestRendering(); + /** * Marks the texture as dirty if it's old enough to redraw it on Render. */ @@ -101,6 +103,8 @@ private: CSimulation2& m_Simulation; + bool m_RenderingRequested = false; + bool m_TerrainTextureDirty = true; bool m_FinalTextureDirty = true; double m_LastFinalTextureUpdate = 0.0; diff --git a/source/gui/ObjectTypes/CMiniMap.cpp b/source/gui/ObjectTypes/CMiniMap.cpp index f45981f98a..132c4a9c70 100644 --- a/source/gui/ObjectTypes/CMiniMap.cpp +++ b/source/gui/ObjectTypes/CMiniMap.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2025 Wildfire Games. +/* Copyright (C) 2026 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -119,6 +119,11 @@ CMiniMap::CMiniMap(CGUI& pGUI) : m_MouseHovering = false; } +void CMiniMap::Tick() +{ + g_Game->GetView()->GetMiniMapTexture().RequestRendering(); +} + void CMiniMap::HandleMessage(SGUIMessage& Message) { IGUIObject::HandleMessage(Message); diff --git a/source/gui/ObjectTypes/CMiniMap.h b/source/gui/ObjectTypes/CMiniMap.h index b9e96ab63d..2805cbe0c6 100644 --- a/source/gui/ObjectTypes/CMiniMap.h +++ b/source/gui/ObjectTypes/CMiniMap.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2025 Wildfire Games. +/* Copyright (C) 2026 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -52,6 +52,8 @@ protected: double time; }; + virtual void Tick(); + virtual void Draw(CCanvas2D& canvas); virtual void CreateJSObject();