示例#1
0
        public void Draw(SpriteBatch spriteBatch)
        {
            RenderTargetBinding[] temp = game.GraphicsDevice.GetRenderTargets();

            game.GraphicsDevice.SetRenderTarget(guiWindow);
            game.GraphicsDevice.Clear(Color.Black);
            spriteBatch.Begin(samplerState: SamplerState.PointClamp);
            guiText.Draw(spriteBatch);
            spriteBatch.End();

            game.GraphicsDevice.SetRenderTarget(mapWindow);
            game.GraphicsDevice.Clear(Color.Black);
            spriteBatch.Begin(samplerState: SamplerState.PointClamp, transformMatrix: Camera.Transform);
            map.Draw(spriteBatch);
            spriteBatch.End();

            game.GraphicsDevice.SetRenderTargets(temp);
            game.GraphicsDevice.Clear(Color.White);
            spriteBatch.Begin(samplerState: SamplerState.PointClamp);
            spriteBatch.Draw(guiWindow, new Rectangle(0, 0, (int)game.GetScaledResolution().X, (int)(game.GetScaledResolution().Y *guiSize)), Color.White);
            spriteBatch.Draw(mapWindow, new Rectangle(0, (int)(game.GetScaledResolution().Y *guiSize), (int)game.GetScaledResolution().X, (int)(game.GetScaledResolution().Y *(1 - guiSize))), Color.White);
            spriteBatch.End();
        }