예제 #1
0
            internal void Flush()
            {
                if (Active)
                {
                    PerfTime now = PerfTime.Now;

                    TotalTime += (now - StartTime);
                    StartTime  = now;
                }
            }
예제 #2
0
        internal void Resume()
        {
            if (_paused)
            {
                PerfTimeSpan pauseDelta = PerfTime.Now - _pauseStarted;

                _lastFrameTime += pauseDelta;
                _lastFpsTime += pauseDelta;
                _paused = false;
            }
        }
예제 #3
0
 internal GameTime()
 {
     _lastFrameTime = PerfTime.Now;
     _lastFpsTime = _lastFrameTime;
 }
예제 #4
0
 internal void Pause()
 {
     if (!_paused)
     {
         _paused = true;
         _pauseStarted = PerfTime.Now;
     }
 }
예제 #5
0
        internal void UpdateFrame()
        {
            PerfTime thisFrameSnapshot = PerfTime.Now;
            PerfTimeSpan timeDelta = thisFrameSnapshot - _lastFrameTime;
            PerfTimeSpan fpsTimeDelta = thisFrameSnapshot - _lastFpsTime;

            _frameCounter++;
            _fpsFrameCounter++;

            if (fpsTimeDelta.Seconds >= _fpsMeasureTimeFrame)
            {
                _fps = (_fpsFrameCounter) / (float)fpsTimeDelta.Seconds;
                _fpsFrameCounter = 0;
                _lastFpsTime = thisFrameSnapshot;
            }

            _frameTime = Math.Min((float)timeDelta.Seconds, MAX_TIME_DELTA);
            _totalGameTime += _frameTime;
            _lastFrameTime = thisFrameSnapshot;
        }