From 2b0b16398ded43b45805ad48770e3a327c4f9422 Mon Sep 17 00:00:00 2001 From: Tom Wendel Date: Mon, 31 Oct 2022 11:46:09 +0100 Subject: [PATCH] Make sure debug message cache gets cleared as soon as a new round starts --- FnaPlugin/RenderWindow.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/FnaPlugin/RenderWindow.cs b/FnaPlugin/RenderWindow.cs index 7b923c9..d603768 100644 --- a/FnaPlugin/RenderWindow.cs +++ b/FnaPlugin/RenderWindow.cs @@ -177,6 +177,11 @@ protected override void UnloadContent() Content.Unload(); } + /// + /// Stores the round id of the latest render cycle + /// + private int? latestRenderedRound; + /// /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. @@ -189,6 +194,14 @@ protected override void Update(GameTime gameTime) playgroundWidth = CurrentState.PlaygroundWidth / 2; playgroundHeight = CurrentState.PlaygroundHeight / 2; camera.Resize(CurrentState.PlaygroundWidth, CurrentState.PlaygroundHeight); + + // Detect new round to reset debug messages + if (!latestRenderedRound.HasValue || latestRenderedRound > CurrentState.CurrentRound) + { + debugMessages.Clear(); + } + + latestRenderedRound = CurrentState.CurrentRound; } var ks = Keyboard.GetState();