use SDL for timer.

This commit is contained in:
Bob
2010-02-20 21:26:41 +13:00
parent 7e28f28fae
commit 556ff7f83d
2 changed files with 6 additions and 4 deletions

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5"> <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -50,6 +50,7 @@
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\thirdparty\Tao\Tao.Glfw.dll</HintPath> <HintPath>..\thirdparty\Tao\Tao.Glfw.dll</HintPath>
</Reference> </Reference>
<Reference Include="Tao.Sdl, Version=1.2.13.0, Culture=neutral, PublicKeyToken=9c7a200e36c0094e, processorArchitecture=MSIL" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="AudLoader.cs" /> <Compile Include="AudLoader.cs" />

View File

@@ -20,12 +20,13 @@
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using Tao.Glfw; using Tao.Glfw;
using Tao.Sdl;
namespace OpenRa.Support namespace OpenRa.Support
{ {
public class Stopwatch public class Stopwatch
{ {
double start; int start;
public Stopwatch() public Stopwatch()
{ {
Reset(); Reset();
@@ -33,12 +34,12 @@ namespace OpenRa.Support
public double ElapsedTime() public double ElapsedTime()
{ {
return (Glfw.glfwGetTime() - start); return (1.0/1000.0) * (double)(Sdl.SDL_GetTicks() - start);
} }
public void Reset() public void Reset()
{ {
start = Glfw.glfwGetTime(); start = Sdl.SDL_GetTicks();
} }
} }
} }