# Monogame render between constraints

I have, in MonoGame, a project for which I require the game to not use the full screen depending on the resolution. The game elements etc all behave as they should (So they bounce off for example between 25% and 75% of the screen, instead of the edges). Yet I'm trying to draw a background between these two constraints, and it doesn't work.

To draw the background I am using the following code

spriteBatch.Draw(Background, new Rectangle(leftEdge,0,rightEdge,top),Color.White);


Yet when running the game, the image starts at "LeftEdge" but goes beyond "rightEdge". How would I go about scaling the image appropriately in this scenario?

• The last two argument's in Rectangle's constructor are "width" and "height", not "right" and "top". So basically, put "rightEdge - leftEdge" as the third argument and it should work fine. – user9790 Jun 30 '14 at 18:05
• @Jaakko You should make that an actual answer. – Anko Jun 30 '14 at 21:01