- minor updates in ModelSample - added new media file: ANX Logo mesh (vertex colors, FBX-Format)
85 lines
1.8 KiB
C#
85 lines
1.8 KiB
C#
#region Using Statements
|
|
using System;
|
|
using ANX.Framework.NonXNA.PlatformSystem;
|
|
using System.Diagnostics;
|
|
using ANX.Framework.NonXNA;
|
|
|
|
#endregion
|
|
|
|
// This file is part of the ANX.Framework created by the
|
|
// "ANX.Framework developer group" and released under the Ms-PL license.
|
|
// For details see: http://anxframework.codeplex.com/license
|
|
|
|
namespace ANX.PlatformSystem.Linux
|
|
{
|
|
public class LinuxGameTimer : INativeGameTimer
|
|
{
|
|
#region Using Statements
|
|
private Stopwatch stopwatch;
|
|
private TimeSpan lastElapsed;
|
|
|
|
#endregion
|
|
|
|
public LinuxGameTimer()
|
|
{
|
|
if (!Stopwatch.IsHighResolution)
|
|
{
|
|
Logger.Warning("Created " + this.GetType().FullName + ", but it is not high resolution. Maybe the underlying platform doesn't support high resolution timers?");
|
|
}
|
|
stopwatch = Stopwatch.StartNew();
|
|
Reset();
|
|
}
|
|
|
|
public void Update()
|
|
{
|
|
TimeSpan elapsed = stopwatch.Elapsed;
|
|
ElapsedTime = elapsed - lastElapsed;
|
|
lastElapsed = elapsed;
|
|
}
|
|
|
|
public void Reset()
|
|
{
|
|
stopwatch.Restart();
|
|
lastElapsed = stopwatch.Elapsed;
|
|
}
|
|
|
|
public void Suspend()
|
|
{
|
|
stopwatch.Stop();
|
|
}
|
|
|
|
public void Resume()
|
|
{
|
|
stopwatch.Start();
|
|
}
|
|
|
|
public TimeSpan ElapsedTime
|
|
{
|
|
get;
|
|
internal set;
|
|
}
|
|
|
|
public TimeSpan CurrentTime
|
|
{
|
|
get;
|
|
internal set;
|
|
}
|
|
|
|
public long Frequency
|
|
{
|
|
get
|
|
{
|
|
return Stopwatch.Frequency;
|
|
}
|
|
}
|
|
|
|
public long Timestamp
|
|
{
|
|
get
|
|
{
|
|
return Stopwatch.GetTimestamp();
|
|
}
|
|
}
|
|
}
|
|
}
|