diff --git a/axios.suo b/axios.suo index 3e6dab3..c551a9a 100644 Binary files a/axios.suo and b/axios.suo differ diff --git a/axios/Axios_settings.cs b/axios/Axios_settings.cs index c291a56..1b826a0 100644 --- a/axios/Axios_settings.cs +++ b/axios/Axios_settings.cs @@ -59,6 +59,9 @@ * 1.0.1.2 - 4/1/2012 * - Making AxiosTimer inheirt from AxiosGameObject for it to be casted properly * + * 1.0.1.3 - 4/7/2012 + * - Adding a check in the AxiosTimer update to only tick if the game is active + * */ using System.Reflection; diff --git a/axios/Engine/AxiosTimer.cs b/axios/Engine/AxiosTimer.cs index d5e4302..582f1c7 100644 --- a/axios/Engine/AxiosTimer.cs +++ b/axios/Engine/AxiosTimer.cs @@ -37,25 +37,27 @@ namespace Axios.Engine public override void Update(AxiosGameScreen gameScreen, GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen) { - - if (_enabled) + if (gameScreen.IsActive) //only "tick" if the window has focus - otherwise the Timer will play catchup { - if (gameTime.TotalGameTime - lastTick >= interval) + if (_enabled) { - if (Tick != null) + if (gameTime.TotalGameTime - lastTick >= interval) { - //EventArgs e = new EventArgs(); - - Tick(this, null); - } + if (Tick != null) + { + //EventArgs e = new EventArgs(); + Tick(this, null); + } + + lastTick = gameTime.TotalGameTime; + } + } + else + { lastTick = gameTime.TotalGameTime; } } - else - { - lastTick = gameTime.TotalGameTime; - } } public override void LoadContent(AxiosGameScreen gameScreen)