Adding a check to only tick a timer if the window is active

This commit is contained in:
nathan@daedalus 2012-04-12 22:19:41 -05:00
parent 40b67fb6e8
commit 7b3442661e
2 changed files with 3 additions and 2 deletions

BIN
axios.suo

Binary file not shown.

View File

@ -37,7 +37,8 @@ namespace Axios.Engine
public override void Update(AxiosGameScreen gameScreen, GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen) public override void Update(AxiosGameScreen gameScreen, GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen)
{ {
if (gameScreen.IsActive) //only "tick" if the window has focus - otherwise the Timer will play catchup
if (gameScreen.ScreenManager.Game.IsActive) //only "tick" if the window has focus - otherwise the Timer will play catchup
{ {
if (_enabled) if (_enabled)
{ {
@ -46,7 +47,7 @@ namespace Axios.Engine
if (Tick != null) if (Tick != null)
{ {
//EventArgs e = new EventArgs(); //EventArgs e = new EventArgs();
//System.Diagnostics.Debugger.Break();
Tick(this, null); Tick(this, null);
} }