diff --git a/BenMakesGames.PlayPlayMini/BenMakesGames.PlayPlayMini.csproj b/BenMakesGames.PlayPlayMini/BenMakesGames.PlayPlayMini.csproj index e0e4dde..476843a 100644 --- a/BenMakesGames.PlayPlayMini/BenMakesGames.PlayPlayMini.csproj +++ b/BenMakesGames.PlayPlayMini/BenMakesGames.PlayPlayMini.csproj @@ -5,7 +5,7 @@ Ben Hendel-Doying An opinionated framework for making smallish games with MonoGame. 2021-2024 Ben Hendel-Doying - 4.6.1 + 4.6.2 true monogame game engine framework di state diff --git a/BenMakesGames.PlayPlayMini/GameStateManager.cs b/BenMakesGames.PlayPlayMini/GameStateManager.cs index 5989964..bda8c13 100644 --- a/BenMakesGames.PlayPlayMini/GameStateManager.cs +++ b/BenMakesGames.PlayPlayMini/GameStateManager.cs @@ -91,10 +91,15 @@ protected override void Update(GameTime gameTime) { SwitchState(); - if(!IsActive && LostFocusGameState is not null && CurrentState.GetType() != LostFocusGameState) + if(!IsActive && LostFocusGameState is not null) { - ChangeState(LostFocusGameState, new LostFocusConfig(CurrentState)); - SwitchState(); + var currentStateType = CurrentState.GetType(); + + if (currentStateType != LostFocusGameState && currentStateType != Config.InitialGameState && currentStateType != typeof(NoState)) + { + ChangeState(LostFocusGameState, new LostFocusConfig(CurrentState)); + SwitchState(); + } } Input(gameTime);