0
\$\begingroup\$

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?

\$\endgroup\$
1
  • 2
    \$\begingroup\$ Where is the NotImplementedException being thrown? Stack trace please. \$\endgroup\$
    – Dominique
    May 25, 2013 at 16:12

2 Answers 2

1
\$\begingroup\$

@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.

\$\endgroup\$
1
  • \$\begingroup\$ I thought it was also possible to use PNG, JPG files as textures directly rather than XNB compiled files? \$\endgroup\$
    – Barry King
    May 25, 2013 at 16:48
0
\$\begingroup\$

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.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .