Improve game loop

Environment.TickCount was replaced with Game.RunTime that's based on
Stopwatch for increased accuracy.
This commit is contained in:
Pavlos Touboulidis
2014-07-06 22:04:31 +03:00
parent fd68c81b15
commit b88b87b899
8 changed files with 246 additions and 159 deletions

View File

@@ -185,9 +185,8 @@ namespace OpenRA.Mods.RA.Widgets.Logic
{
int fps;
Exts.TryParseIntegerInvariant(frameLimitTextfield.Text, out fps);
ds.MaxFramerate = fps.Clamp(20, 200);
ds.MaxFramerate = fps.Clamp(1, 1000);
frameLimitTextfield.Text = ds.MaxFramerate.ToString();
Game.SetIdealFrameTime(ds.MaxFramerate);
};
frameLimitTextfield.OnEnterKey = () => { frameLimitTextfield.YieldKeyboardFocus(); return true; };
frameLimitTextfield.IsDisabled = () => !ds.CapFramerate;
@@ -213,7 +212,6 @@ namespace OpenRA.Mods.RA.Widgets.Logic
gs.ShowShellmap = dgs.ShowShellmap;
ds.CapFramerate = dds.CapFramerate;
Game.SetIdealFrameTime(ds.MaxFramerate);
ds.MaxFramerate = dds.MaxFramerate;
ds.Language = dds.Language;
ds.Mode = dds.Mode;