- Adding a check in the AxiosTimer update to only tick if the game is active
This commit is contained in:
parent
b3183d6f04
commit
6e86581e13
@ -59,6 +59,9 @@
|
|||||||
* 1.0.1.2 - 4/1/2012
|
* 1.0.1.2 - 4/1/2012
|
||||||
* - Making AxiosTimer inheirt from AxiosGameObject for it to be casted properly
|
* - 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;
|
using System.Reflection;
|
||||||
|
@ -37,25 +37,27 @@ 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 (_enabled)
|
|
||||||
{
|
{
|
||||||
if (gameTime.TotalGameTime - lastTick >= interval)
|
if (_enabled)
|
||||||
{
|
{
|
||||||
if (Tick != null)
|
if (gameTime.TotalGameTime - lastTick >= interval)
|
||||||
{
|
{
|
||||||
//EventArgs e = new EventArgs();
|
if (Tick != null)
|
||||||
|
{
|
||||||
|
//EventArgs e = new EventArgs();
|
||||||
|
|
||||||
Tick(this, null);
|
Tick(this, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
lastTick = gameTime.TotalGameTime;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
lastTick = gameTime.TotalGameTime;
|
lastTick = gameTime.TotalGameTime;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
lastTick = gameTime.TotalGameTime;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void LoadContent(AxiosGameScreen gameScreen)
|
public override void LoadContent(AxiosGameScreen gameScreen)
|
||||||
|
Loading…
Reference in New Issue
Block a user