Skip to content

Instantly share code, notes, and snippets.

@KyleGobel
Created May 29, 2016 17:12
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/4e7a9791da4a618ed08ea328fc5181f5 to your computer and use it in GitHub Desktop.
Save KyleGobel/4e7a9791da4a618ed08ea328fc5181f5 to your computer and use it in GitHub Desktop.
// _guiTexture is a texture of a bunch of gui images (buttons, scrollbars panels ect)
// srcRectangle in this case is the source rectange of a 64x64 button
// create render target
// if I set this to the same size of the backbuffer it draws how i expect it, but for some reason
// changing the width/height of this is changing the look when drawn to the screen...
// this doesn't make sense to me because i'm only using 64x64 pixels of this big area...changing it's size
// shouldn't have any effect in my mind
Canvas = new RenderTarget2D(Graphics, 800, 600)
_spriteBatch.Begin(SpriteSortMode.Immediate)
Graphics.SetRenderTarget(Canvas)
_spriteBatch.Draw(_guiTexture, new Rectangle(0,0, 64, 64), srcRectangle, Color.White);
Graphics.SetRenderTarget(null)
_spriteBatch.Draw(Canvas, Vector2.Zero, Color.White);
_spriteBatch.End();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment