Ejemplo n.º 1
0
        internal override void BeginRender(RenderFrame frame)
        {
            // Do this here (instead of RenderProcess) because we only want to measure/time the running game.
            if (Game.Settings.Profiling)
            {
                if ((Game.Settings.ProfilingFrameCount > 0 && ++ProfileFrames > Game.Settings.ProfilingFrameCount) || (Game.Settings.ProfilingTime > 0 && Viewer != null && Viewer.RealTime >= Game.Settings.ProfilingTime))
                {
                    Game.PopState();
                }
            }

            if (FirstFrame)
            {
                // Turn off the 10FPS fixed-time-step and return to running as fast as we can.
                Game.IsFixedTimeStep   = false;
                Game.InactiveSleepTime = TimeSpan.Zero;

                // We must create these forms on the main thread (Render) or they won't pump events correctly.

                if (MPManager.IsMultiPlayer() || Game.Settings.ViewDispatcher)
                {
                    Program.DebugViewer = new DispatchViewer(Viewer.Simulator, Viewer);
                    Program.DebugViewer.Hide();
                    Viewer.DebugViewerEnabled = false;
                }

                Program.SoundDebugForm = new SoundDebugForm(Viewer);
                Program.SoundDebugForm.Hide();
                Viewer.SoundDebugFormEnabled = false;

                FirstFrame = false;
            }
            Viewer.BeginRender(frame);
        }