axiosengine 

axiosengine Commit Details


Date:2012-12-28 16:57:08 (11 years 11 months ago)
Author:Natalie Adams
Branch:master
Commit:e8698d7c6ec6c1a7c699efd7f80f21383c62ec65
Parents: 69363d83ce20a8b0cf7cb0fa8df7b192642b1ae2
Message:Fixing bug with Axios Timer

Changes:

File differences

axios/Engine/AxiosTimer.cs
1616
1717
1818
19
1920
2021
2122
......
3839
3940
4041
41
42
43
44
45
46
4247
4348
49
50
51
52
53
4454
4555
46
56
4757
4858
4959
TimeSpan interval = new TimeSpan(0, 0, 1);
TimeSpan lastTick = new TimeSpan();
private bool _enabled = false;
public TimeSpan? offset = null;
public event EventHandler Tick;
public override void Update(AxiosGameScreen gameScreen, GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen)
{
// Issue here: if you add a timer later on and use the algorithm of
// gameTime.TotalGameTime - lastTick >= interval
// The timer will always run
// What we should do is have an offset of the time it was added like this:
// ((gameTime.TotalGameTime - offset) - lastTick) >= interval
if (gameScreen.ScreenManager.Game.IsActive) //only "tick" if the window has focus - otherwise the Timer will play catchup
{
if (offset == null)
{
offset = gameTime.TotalGameTime;
return;
}
if (_enabled)
{
if (gameTime.TotalGameTime - lastTick >= interval)
if (((gameTime.TotalGameTime - offset) - lastTick) >= interval)
{
if (Tick != null)
{

Archive Download the corresponding diff file

Branches

Number of commits:
Page rendered in 0.06143s using 14 queries.