Ejemplo n.º 1
0
        public void Close()
        {
            if (_window != null)
            {
                _profilerRunning = false;
                _window.Close();
                _window.Dispose();
            }

            _window = null;
        }
Ejemplo n.º 2
0
        private void ProfileLoop()
        {
            using (_window = new ProfileWindow())
            {
                // Create thread for render loop
                _renderThread = new Thread(RenderLoop);
                _renderThread.Start();

                while (_profilerRunning)
                {
                    double time = (double)PerformanceCounter.ElapsedTicks / PerformanceCounter.TicksPerSecond;
                    _window.Update(new FrameEventArgs(time - _prevTime));
                    _prevTime = time;

                    // Sleep to be less taxing, update usually does very little
                    Thread.Sleep(1);
                }
            }
        }