Exemplo n.º 1
0
        //The game loop
        private void Loop()
        {
            //If we aren't exiting, continue
            if (!_exiting)
            {
                //Advance the timer
                GameTime time = _timer.Update();

                //Check inputs
                CheckInput(time);

                //Update scene
                Update(time);

                //Draw scene
                Draw(_renderer);
                //Otherwise start the exit & cleanup resources
            }
            else
            {
                //Dismiss loaded content
                UnloadContent();

                //Notifies the application it is exiting
                _host.Exit();

                //Ensure we dismiss the services and clean up the resources they created.
                Engine.CleanUpResources();
            }
        }
Exemplo n.º 2
0
        //The "Game Loop"
        private void Loop()
        {
            //Update and render, unless if we're in the middle of exiting
            if (!_exiting)
            {
                GameTime time = _timer.Update();
                //Accumulate the update to measure FPS
                UpdateFrameRate(time);

                if (!_window.IsMinimized)
                {
                    _inputLayer.CheckTriggers(time);
                    _renderer.CurrentCamera.Update();
                }

                Update(time);
                Render(_renderer);
            }
            else
            {
                //Clean up and exit
                UnloadContent();
                _host.Exit();
                Engine.CleanUpResources();
            }
        }