示例#1
0
        public void Run()
        {
            Stopwatch totalElapsedStopwatch = new Stopwatch();
            Stopwatch tickElapsedStopwatch  = new Stopwatch();

            var timeDiff  = TimeSpan.FromSeconds(0);
            var totalTime = TimeSpan.FromSeconds(0);

            totalElapsedStopwatch.Start();
            while (true)
            {
                tickElapsedStopwatch.Restart();
                tickElapsedStopwatch.Start();
                _engine.Tick(new GameTime(totalTime, timeDiff));
                tickElapsedStopwatch.Stop();
                timeDiff  = tickElapsedStopwatch.Elapsed;
                totalTime = totalElapsedStopwatch.Elapsed;
            }
        }
示例#2
0
 protected override void Update(GameTime gameTime)
 {
     base.Update(gameTime);
     _engine.Tick(gameTime);
 }