I'm trying to insert a PNG image in my game, but I'm not getting it, the image is in Content/alien.png
, with the code below:
Texture2D alien;
.
.
.
protected override void LoadContent ()
{
spriteBatch = new SpriteBatch (GraphicsDevice);
Content.RootDirectory = "Content";
alien = Content.Load<Texture2D>(@"alien");
}
When I run the game, the error message appears:
Microsoft.Xna.Framework.Content.ContentLoadException: Could not load alien asset as a non-content file! ---> Microsoft.Xna.Framework.Content.ContentLoadException: The directory was not found. --- > System.IO.DirectoryNotFoundException: Could not find a part of the path "/home/leonardo/Documentos/Mono/MaisUM/MaisUM/bin/Debug/Content/alien.xnb". at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) [0x001cf] in : 0 at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share) [0x00000] in : 0 at at (wrapper remoting-invoke-with-check) System.IO.FileStream: .ctor (String, System.IO.FileMode, System.IO.FileAccess, System.IO.FileShare)
at System.IO.File.OpenRead (System.String path) [0x00000] in : 0 at Microsoft.Xna.Framework.TitleContainer.OpenStream (System.String name) [0x00029] in: 0 at Microsoft.Xna.Framework.Content.ContentManager.OpenStream (System.String assetName) [0x0002e] in : 0 --- End of inner exception stack trace --- at Microsoft.Xna.Framework.Content.ContentManager.OpenStream (System.String assetName) [0x00053] in : 0 at Microsoft.Xna.Framework.Content.ContentManager.ReadAsset [T] (System.String assetName, System.Action1[T] recordDisposableObject) [0x00073] in <c33f6c525d914593acc9b590397e7c2b>:0 --- End of inner exception stack trace --- at Microsoft.Xna.Framework.Content.ContentManager.ReadAsset[T] (System.String assetName, System.Action
1 [T] recordDisposableObject) [0x0012b] in: 0 at Microsoft.Xna.Framework.Content.ContentManager.Load [T] (System.String assetName) [0x00068] in: 0 at MoreUM.Game1.LoadContent () [0x0002e] in /home/leonardo/Documentos/Mono/MaisUM/MaisUM/Game1.cs:46 at Microsoft.Xna.Framework.Game.Initialize () [0x0004d] in : 0 at MaisUM.Game1.Initialize () [0x00002] in /home/leonardo/Documentos/Mono/MaisUM/MaisUM/Game1.cs:35 at Microsoft.Xna.Framework.Game.DoInitialize () [0x00011] in : 0 at Microsoft.Xna.Framework.Game.Run (Microsoft.Xna.Framework.GameRunBehavior runBehavior) [0x00033] in : 0 at Microsoft.Xna.Framework.Game.Run () [0x0000c] in : 0 at MaisUM.Program.RunGame () [0x00010] in /home/leonardo/Documentos/Mono/MaisUM/MaisUM/Program.cs:31 at Most. Program.Main (System.String [] args) [0x00001] in /home/leonardo/Documentos/Mono/MaisUM/MaisUM/Program.cs:55
Probably and error is because it expects an .xnb file, but I only have one .png, because in Linux I did not find a way to convert. Could someone help me?
Information: Linux Elementary OS Freya MonoDevelop 5.10 MonoGame 3.5