Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In my code below, I think it's correctly done. But idk, the image called by _bg is does not shown up. The screen only show White. Weirdly, there is 0 error message when I run it.

(The RenderTarget2D is for default-ing my view into landscape mode)

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace GameName2
    /// <summary>
    /// This is the main type for your game
    /// </summary>
    public class Game1 : Game
        GraphicsDeviceManager _graphics;
        SpriteBatch _spriteBatch;
        Texture2D _bg;

        public Game1()
            _graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
            // TODO: Add your initialization logic here


        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
            // Create a new SpriteBatch, which can be used to draw textures.
            _spriteBatch = new SpriteBatch(GraphicsDevice);

            _bg = Content.Load<Texture2D>(@"background");
            // TODO: use this.Content to load your game content here

        /// <summary>
        /// UnloadContent will be called once per game and is the place to unload
        /// all content.
        /// </summary>
        protected override void UnloadContent()
            // TODO: Unload any non ContentManager content here

        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
            // TODO: Add your update logic here


        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)

            // TODO: Add your drawing code here
                new Rectangle(0, 0, Window.ClientBounds.Width, Window.ClientBounds.Height),



I use xnb file. And I put it in Content folder in the project. I've set 'Content' and 'Copy if newer' to the file property.

This is the .png file I use before converted into xnb:


Or maybe the problem is in my .png file?

Any idea?

share|improve this question

closed as too localized by Le Comte du Merde-fou, Anko, ClassicThunder, Byte56, msell Apr 30 '13 at 5:15

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

up vote 1 down vote accepted

You should be using GraphicsDevice.Viewport instead of Window.ClientBounds when working with your SpriteBatch.

share|improve this answer
Why I wonder? What's the difference? – Moses Aprico Apr 29 '13 at 14:52
Works perfect. Thanks – Moses Aprico Apr 29 '13 at 16:15
I can't tell you why, I just know it causes problems when you use Window.ClientBounds when drawing with SpriteBatch. It technically should work. – Jon Apr 29 '13 at 18:43
Good call Jon. Perhaps this needs to be submitted as a bug in MonoGame? – craftworkgames Apr 29 '13 at 22:58… has the answer as to what the difference is. Essentially ClientBounds.X is in screen space, not window. – Phil Apr 30 '13 at 4:10

Not the answer you're looking for? Browse other questions tagged or ask your own question.