AxiosEngine-old 

AxiosEngine-old Commit Details


Date:2012-12-28 16:57:00 (11 years 11 months ago)
Author:Natalie Adams
Branch:default
Commit:de6cfca9566b
Parents: 6acdce85db3c
Message:Fixing bug with Axios Timer

Changes:
Maxios/Engine/AxiosTimer.cs (2 diffs)

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

Page rendered in 0.44859s using 14 queries.