Exemplo n.º 1
0
        /// <summary>
        /// Draw everything.
        /// Note: need to be called after clearing the device.
        /// </summary>
        /// <param name="clearBuffer">If true, will also clear buffer.</param>
        public void Draw(bool clearBuffer = true)
        {
            // get graphic device
            GraphicsDevice device = Core.Graphics.GraphicsManager.GraphicsDevice;

            // call the before-draw update function
            ActiveScene.BeforeDraw();

            // start drawing frame
            Core.Graphics.GraphicsManager.StartDrawFrame();

            // reset diagnostic drawings count
            Diagnostic.ResetDrawCounters();

            // render everything
            ActiveScene.Draw();

            // end drawing frame (will also draw all rendering queues)
            Core.Graphics.GraphicsManager.EndDrawFrame();

            // reset stencil state
            device.DepthStencilState = DepthStencilState.Default;

            // draw ui
            if (UiEnabled)
            {
                UI.UserInterface.Active.Draw(_spriteBatch);
            }
        }