示例#1
0
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.Black);

            if (Game1.World != null && Game1.World.Map != null && Game1.World.GroundRender == null)
            {
                Game1.World.GroundRender = new RenderTarget2D(GraphicsDevice, Game1.World.Map.Width * 16, Game1.World.Map.Height * 16);
                GraphicsDevice.SetRenderTarget(Game1.World.GroundRender);
                spriteBatch.Begin();
                Game1.World.DrawGround(spriteBatch);
                spriteBatch.End();
            }

            GraphicsDevice.SetRenderTarget(gameRender);
            GraphicsDevice.Clear(Color.Black);
            spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, RasterizerState.CullCounterClockwise);
            if (Game1.World != null && Game1.World.GroundRender != null)
            {
                spriteBatch.Draw(Game1.World.GroundRender, Vector2.Zero.DrawPos(), null, Color.White, 0, Vector2.Zero, Game1.PixelZoom, SpriteEffects.None, 1);
                Game1.World.Draw(spriteBatch);
            }
            Texture2D blank = new Texture2D(GraphicsDevice, 1, 1);

            blank.SetData(new Color[] { Color.White });
            spriteBatch.Draw(blank, new Rectangle(0, 0, Game1.GameWidth, Game1.GameHeight), Color.Black * Fade);
            Thyme.Draw(spriteBatch);
            spriteBatch.End();

            GraphicsDevice.SetRenderTarget(null);
            spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, RasterizerState.CullCounterClockwise);
            spriteBatch.Draw(gameRender, Vector2.Zero, null, Thyme.light, 0, Vector2.Zero, 1, SpriteEffects.None, 1);
            if (Game1.CurrentMenu != null)
            {
                Game1.CurrentMenu.Draw(spriteBatch);
            }
            Buffs.Draw(spriteBatch);
            spriteBatch.Draw(ContentLibrary.Sprites["ui:cursorPict"], new Vector2(Mouse.GetState().X, Mouse.GetState().Y), null, Color.White, 0, Vector2.Zero, 1, SpriteEffects.None, Layer.Mouse);
            spriteBatch.End();

            base.Draw(gameTime);
        }