From c11e02d10efeaf6c81b8c0b52fccb06121eae2da Mon Sep 17 00:00:00 2001 From: "nathan@daedalus" Date: Wed, 21 Mar 2012 00:12:11 -0500 Subject: [PATCH] - Fixing bug with last screen not exiting if it is a background screen --- axios/Axios_settings.cs | 7 +++++++ axios/ScreenSystem/GameScreen.cs | 2 +- axios/ScreenSystem/MenuScreen.cs | 13 ++++++++----- axios/ScreenSystem/ScreenManagerComponent.cs | 2 +- 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/axios/Axios_settings.cs b/axios/Axios_settings.cs index 9e9f22b..47b9d2c 100644 --- a/axios/Axios_settings.cs +++ b/axios/Axios_settings.cs @@ -41,6 +41,13 @@ * * 1.0.0.9 - 3/16/2012 * - Changeing the complex objects alot - now they are more like "chained" objects + * - Adding checks for if objects are getting deleted too fast + * + * 1.0.1.0 - 3/20/2012 + * - Taking out hard coded debug statements for the screen system + * - Adding field to allow/disallow automated mouse joints per object + * - Fixing bug with last screen not exiting if it is a background screen + * * */ diff --git a/axios/ScreenSystem/GameScreen.cs b/axios/ScreenSystem/GameScreen.cs index 54e4ae3..68281cc 100644 --- a/axios/ScreenSystem/GameScreen.cs +++ b/axios/ScreenSystem/GameScreen.cs @@ -270,7 +270,7 @@ namespace FarseerPhysics.SamplesFramework /// public virtual void ExitScreen() { - if (TransitionOffTime == TimeSpan.Zero) + if (TransitionOffTime == TimeSpan.Zero && this.TransitionPosition == 0 && this.TransitionAlpha == 1) { // If the screen has a zero transition time, remove it immediately. ScreenManager.RemoveScreen(this); diff --git a/axios/ScreenSystem/MenuScreen.cs b/axios/ScreenSystem/MenuScreen.cs index 6cf1bc5..2b649d6 100644 --- a/axios/ScreenSystem/MenuScreen.cs +++ b/axios/ScreenSystem/MenuScreen.cs @@ -189,12 +189,15 @@ namespace FarseerPhysics.SamplesFramework } else if (input.IsMenuCancel()) { - if (this.ScreenState == SamplesFramework.ScreenState.Active) + if (this.ScreenState == SamplesFramework.ScreenState.Active && this.TransitionPosition == 0 && this.TransitionAlpha == 1) { - if (ScreenManager.GetScreens().Length == 2) - ScreenManager.Game.Exit(); - else - this.ExitScreen(); + //GameScreen[] screens = ScreenManager.GetScreens(); + //if (screens[screens.Length - 1] is BackgroundScreen ||| screens.Length ) + // ScreenManager.Game.Exit(); + //if (ScreenManager.GetScreens().Length == 2) + // ScreenManager.Game.Exit(); + //else + this.ExitScreen(); } //ScreenManager.Game.Exit(); } diff --git a/axios/ScreenSystem/ScreenManagerComponent.cs b/axios/ScreenSystem/ScreenManagerComponent.cs index 0218aba..2705ce0 100644 --- a/axios/ScreenSystem/ScreenManagerComponent.cs +++ b/axios/ScreenSystem/ScreenManagerComponent.cs @@ -139,7 +139,7 @@ namespace FarseerPhysics.SamplesFramework // the process of updating one screen adds or removes others. _screensToUpdate.Clear(); - if (_screens.Count == 0) + if (_screens.Count == 0 || (_screens.Count == 1 && _screens[0] is BackgroundScreen)) //I'm done, exit this.Game.Exit();