Skip to content

Instantly share code, notes, and snippets.

@KyleGobel
Created May 29, 2016 19:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KyleGobel/0d42d121c4ec4a7fbb9712912e4ac585 to your computer and use it in GitHub Desktop.
Save KyleGobel/0d42d121c4ec4a7fbb9712912e4ac585 to your computer and use it in GitHub Desktop.
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.CornflowerBlue);
if (_testRenderTarget)
{
_spriteBatch.Begin(SpriteSortMode.Immediate);
GraphicsDevice.SetRenderTarget(_renderTarget);
_spriteBatch.Draw(_guiTexture, new Rectangle(0, 0, 64, 64), new Rectangle(0, 0, 64, 64), Color.White);
_spriteBatch.End();
_spriteBatch.Begin();
GraphicsDevice.SetRenderTarget(null);
_spriteBatch.Draw(_renderTarget, Vector2.Zero, Color.White);
_spriteBatch.End();
}
else
{
_spriteBatch.Begin();
GraphicsDevice.SetRenderTarget(null);
_spriteBatch.Draw(_guiTexture, new Rectangle(0, 0, 64, 64), new Rectangle(0, 0, 64, 64), Color.White);
_spriteBatch.End();
}
base.Draw(gameTime);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment