DrawsToScreen
Introduction
Code Example
SpriteBatch spriteBatch; // This is the XNA SpriteBatch objectSpriteManager.AddSprite("redball.bmp");
SpriteManager.Camera.DrawsToScreen = false;
spriteBatch = new SpriteBatch(graphics.GraphicsDevice);protected override void Draw(GameTime gameTime)
{
FlatRedBallServices.Draw();
// now that FRB is done, let's get the texture and draw it to the screen
Texture2D texture = SpriteManager.Camera.GetRenderTexture(RenderMode.Default);
// let's clear the background to show this is working ok
graphics.GraphicsDevice.Clear(Color.Red);
spriteBatch.Begin();
// This is the top-left quarter of the screen under the default setup
Rectangle destinationRectangle = new Rectangle(0, 0, 400, 300);
spriteBatch.Draw(texture, destinationRectangle, Color.White);
spriteBatch.End();
base.Draw(gameTime);
}
Last updated
Was this helpful?