Megidolaon:
I can display "testing" just fine with this code:
| tile = new Texture2D(graphics.GraphicsDevice, 780, 180); |
| tile = this.Content.Load<Texture2D>("testing"); |
You don't need the first of those two lines. This code is creating a new texture and storing it in your "tile" field, then loading a different new texture from disk and storing that into the "tile" field instead, which replaces the texture that was created in the first line. The first line is creating an unnecessary object which you immediately discard.
Megidolaon:If I substitute the "testing" with "background1", I get the file not found error.
Most likely causes:
- Is your "background1.png" file set to build using the same options as the "testing" one? (look in the Visual Studio properties pane for each asset to compare them)
- Is the "Name" property for "background1.png" set to something other than "background1"?
- Are you sure you didn't make a typo in the name?
Megidolaon:Also, how would I go about displaying images from subdirectories
Pass whatever path your file lives at, eg. Content.Load<Type>("FolderA/FolderB/AssetName");
XNA Framework Developer -
blog -
homepage