Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I have monogame 3.0.1 (latest stable) installed on a Windows 8 Pro machine. I can create a new Windows Phone 8 project (Monogame template) and deploy to the emulator and an actual device with no problems.

However after successfully getting a screen of cornflour blue I wanted to display a simple image. I know the content pipeline is something that doesnt work but I wanted to display a simple PNG.

For this, I tried:

Adding a Content folder. Adding a simple PNG (test.png) to the content folder. Set the build to "Content" and ensure it was set to "Copy if newer". Then added the following code.

texture = Content.Load<Texture2D>("test");

And in the draw, draw it out. However , I get a NotImplementedException when I try to deploy this.

Out of the box, how do I draw a simple texture/sprite to the screen?

share|improve this question
2  
Where is the NotImplementedException being thrown? Stack trace please. –  Dominique May 25 '13 at 16:12
add comment

2 Answers

@Barry MonoGame does not currently generate *.xnb files, but it CAN actually consume them. So if you have an existing *.xnb file add it instead of the png, following the same steps you mentioned in your post and it should work.

share|improve this answer
    
I thought it was also possible to use PNG, JPG files as textures directly rather than XNB compiled files? –  Barry King May 25 '13 at 16:48
add comment

When using PNG files or other resources directly you need to specify the file extension when you load it with the content manager. So in your case, try this:

texture = Content.Load<Texture2D>("test.png");

I know this works on Android. I assume it works the same way on other platforms.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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