All pastes #620218 Raw Edit

Anonymous

public text v1 · immutable
·published 2007-07-15 09:38 UTC
rendered paste body
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            fps++;

            RenderTarget oldTarget = graphics.GraphicsDevice.GetRenderTarget(0);

            graphics.GraphicsDevice.SetRenderTarget(0, renderTarget);

            graphics.GraphicsDevice.Clear(
                ClearOptions.Target,
                Color.Black,
                0, 0);

            spriteBatch.Begin(SpriteBlendMode.AlphaBlend);

            myMap.Draw(spriteBatch, tileset2);

            if (MapEngineForm.mouseOver == MapEngineForm.MouseSelection.MAPEDITOR)
                thisSelector.Draw(spriteBatch);

            spriteBatch.End();

            graphics.GraphicsDevice.ResolveRenderTarget(0);
            Texture2D myTexture = renderTarget.GetTexture();
            
            graphics.GraphicsDevice.SetRenderTarget(0, oldTarget as RenderTarget2D);

            spriteBatch.Begin();

            spriteBatch.Draw(myTexture, new Rectangle(0, 0, graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight), Color.White);
            //spriteBatch.Draw(myTexture, new Vector2(0, 0), null, new Color(255, 255, 255, 150), 0f, new Vector2(0, 0), new Vector2(0.5f, 0.5f), SpriteEffects.None, 0.5f);

            spriteBatch.End();

            base.Draw(gameTime);
        }
    }