3

I am new to XNA programming and I loaded the background image using ContentManager as a Texture2D object.

The background image which I have is of size 480*320. I have kept the minimum game window size as 640*480. My question is how would i resize the background image to the size of the game window.

Thanks in advance!

Gamer
  • 85
  • 1
  • 7

1 Answers1

4

Whatever size the destination rectangle is for any of the top 3 SpriteBatch.Draw functions is how large your image will appear on screen.

So try the below to automatically draw an image full screen.

SpriteBatch.Draw(background_texture, GraphicsDevice.Viewport.Bounds, Color.White);

Note this doesn't actually change the size of you image it just scales it to the specified size when rendered.

ClassicThunder
  • 8,383
  • 35
  • 49