示例#1
0
        public override void Draw(SpriteBatch CurrentBatch, Rectangle BoundingBox)
        {
            // Create the batch if this is the first time we're being drawn
            if (Batch == null)
            {
                Batch = new SpriteBatch(UIContext.Graphics.GraphicsDevice);
            }

            // Draw the game to a backbuffer
            UIContext.Graphics.GraphicsDevice.SetRenderTarget(Backbuffer);
            Batch.Begin();
            Renderer.DrawScene(Batch, UIContext.GameTime, Viewport, PlayingAnimations);
            Batch.End();
            UIContext.Graphics.GraphicsDevice.SetRenderTarget(null);

            // Then start the normal drawing cycle
            BeginDraw();

            // Draw the backbuffer to the screen
            Batch.Draw(Backbuffer, ScreenClientBounds, Color.White);

            Vector2 Offset = new Vector2(ScreenClientBounds.X, ScreenClientBounds.Y);
            Vector2 Scale  = new Vector2(
                Bounds.Width / 480f,
                Bounds.Height / 352f
                );

            Renderer.DrawSceneForeground(Batch, Offset, Scale, UIContext.GameTime, Viewport, PlayingAnimations);

            DrawBorder(Batch);
            EndDraw();
        }