use .net's Stopwatch instead of sdl's broken timer
This commit is contained in:
@@ -18,25 +18,24 @@
|
|||||||
*/
|
*/
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using Tao.Sdl;
|
|
||||||
namespace OpenRA.Support
|
namespace OpenRA.Support
|
||||||
{
|
{
|
||||||
public class Stopwatch
|
public class Stopwatch
|
||||||
{
|
{
|
||||||
int start;
|
System.Diagnostics.Stopwatch sw;
|
||||||
public Stopwatch()
|
public Stopwatch ()
|
||||||
{
|
{
|
||||||
Reset();
|
Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
public double ElapsedTime()
|
public double ElapsedTime()
|
||||||
{
|
{
|
||||||
return (1.0/1000.0) * (double)(Sdl.SDL_GetTicks() - start);
|
return sw.Elapsed.TotalMilliseconds / 1000.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Reset()
|
public void Reset()
|
||||||
{
|
{
|
||||||
start = Sdl.SDL_GetTicks();
|
sw = System.Diagnostics.Stopwatch.StartNew();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user