コード例 #1
0
        public SampleViewModel(SampleBase sample)
        {
            _sample     = sample;
            _clock      = new SampleClock();
            _fpsCounter = new FpsCounter(_clock);

            DisplayName = sample.Name;

            _timer       = new DispatcherTimer();
            _timer.Tick += (sender, e) =>
            {
                if (_isPaused)
                {
                    return;
                }

                var realTime = _clock.TotalTime;
                while (_totalTime < realTime)
                {
                    _totalTime += TimeStep;
                }

                _fpsCounter.Update();
                FramePerSecond = _fpsCounter.FramesPerSecond;

                Render();
            };
        }
コード例 #2
0
		public SampleViewModel(SampleBase sample)
		{
		    _sample = sample;
		    _clock = new SampleClock();
		    _fpsCounter = new FpsCounter(_clock);

		    DisplayName = sample.Name;

			_timer = new DispatcherTimer();
			_timer.Tick += (sender, e) =>
			{
			    if (_isPaused)
			        return;

			    var realTime = _clock.TotalTime;
			    while (_totalTime < realTime)
			        _totalTime += TimeStep;
                
                _fpsCounter.Update();
                FramePerSecond = _fpsCounter.FramesPerSecond;

                Render();
			};
		}