provides frame timing information
Exemplo n.º 1
0
 /// <summary>
 /// Called after a Scene ends, before the next Scene begins
 /// </summary>
 void onSceneChanged()
 {
     emitter.emit(CoreEvents.SceneChanged);
     Time.sceneChanged();
     GC.Collect();
 }
Exemplo n.º 2
0
        protected override void Update(GameTime gameTime)
        {
            if (pauseOnFocusLost && !IsActive)
            {
                SuppressDraw();
                return;
            }

                        #if DEBUG
            TimeRuler.instance.startFrame();
            TimeRuler.instance.beginMark("update", Color.Green);
                        #endif

            // update all our systems and global managers
            Time.update((float)gameTime.ElapsedGameTime.TotalSeconds);
            Input.update();

            for (var i = _globalManagers.length - 1; i >= 0; i--)
            {
                _globalManagers.buffer[i].update();
            }

            if (exitOnEscapeKeypress && (Input.isKeyDown(Keys.Escape) || Input.gamePads[0].isButtonReleased(Buttons.Back)))
            {
                Exit();
                return;
            }

            if (_scene != null)
            {
                _scene.Update();
            }

            if (_scene != _nextScene)
            {
                if (_scene != null)
                {
                    _scene.End();
                }

                _scene = _nextScene;
                onSceneChanged();

                if (_scene != null)
                {
                    _scene.Begin();
                }
            }

                        #if DEBUG
            TimeRuler.instance.endMark("update");
            DebugConsole.instance.update();
            drawCalls = 0;
                        #endif

                        #if FNA
            // MonoGame only updates old-school XNA Components in Update which we dont care about. FNA's core FrameworkDispatcher needs
            // Update called though so we do so here.
            FrameworkDispatcher.Update();
                        #endif
        }