Beispiel #1
0
    protected override void Draw(GameTime gameTime)
    {
        // Draw on the render target
        GraphicsDevice.SetRenderTarget(m_renderTarget);
        GraphicsDevice.DepthStencilState = new DepthStencilState {
            DepthBufferEnable = true
        };
        GraphicsDevice.Clear(new Color(.1f, .1f, .1f));

        base.Draw(gameTime);

        // Begin drawing stuff on the screen
        m_spriteBatch.Begin(SpriteSortMode.Deferred, null, SamplerState.PointClamp);
        // Draw the collision map
        m_level.DrawCollisionMap(m_spriteBatch);
        // Draw the player
        m_player.Draw(m_spriteBatch);
        // Draw debug info
        if (m_bDebugDraw)
        {
            DebugDraw.DrawRequests(m_spriteBatch);
        }
        m_spriteBatch.End();

        // Stop drawing on the render target
        GraphicsDevice.SetRenderTarget(null);


        m_spriteBatch.Begin(SpriteSortMode.Deferred, null, SamplerState.PointClamp);
        // Draw the render target on the screen
        m_spriteBatch.Draw(m_renderTarget, new Rectangle(0, 0, 1280, 720), Color.White);
        // Draw debug text info directly on the screen so it's clearer
        if (m_bDebugDraw)
        {
            DebugDraw.DrawTextRequests(m_spriteBatch);
        }
        m_spriteBatch.End();

        DebugDraw.ClearRequests();
        DebugDraw.ClearTextRequests();
    }
Beispiel #2
0
 protected override void UnloadContent()
 {
     DebugDraw.ClearRequests();
     DebugDraw.ClearTextRequests();
 }