private QueryPerformanceCounter ( long &lpPerformanceCount ) : bool | ||
lpPerformanceCount | long | |
Результат | bool |
//only use this after a call to ReadyForNextFrame. public double TimeElapsed() { _lastTimeElapsed = _timeElapsed; QueryPerformanceWrapper.QueryPerformanceCounter(out _currentTime); _timeElapsed = (_currentTime - _lastTimeInTimeElapsed) * _timeScale; _lastTimeInTimeElapsed = _currentTime; if (_smoothUpdates) { if (_timeElapsed < (_lastTimeElapsed * Smoothness)) { return(_timeElapsed); } else { return(0.0); } } else { return(_timeElapsed); } }
public void Start() { _started = true; _timeElapsed = 0.0; //get the time QueryPerformanceWrapper.QueryPerformanceCounter(out _lastTime); //keep a record of when the timer was started _startTime = _lastTimeInTimeElapsed = _lastTime; //update time to render next frame _nextTime = _lastTime + _frameTime; }
public bool ReadyForNextFrame() { Debug.Assert(Math.Abs(_normalFPS) > double.MinValue, "PrecisionTimer::ReadyForNextFrame<No FPS set in timer>"); QueryPerformanceWrapper.QueryPerformanceCounter(out _currentTime); if (_currentTime > _nextTime) { _timeElapsed = (_currentTime - _lastTime) * _timeScale; _lastTime = _currentTime; //update time to render next frame _nextTime = _currentTime + _frameTime; return(true); } return(false); }