I\'ve been trying load a texture in MonoGame using Xamarin Studio. My code is set up as below :
#region Using Statements
using System;
using Microsoft.Xna.F
Set the 'Build action'
of the png file to 'Content'
and set 'Copy to output directory'
to 'Copy if newer'
.
You can bring up the properties window in Xamarin Studio by ctrl clicking the file and pressing properties.
You shouldn't include the file extension.
You need to add the file to the Content directory of your solution and set it to content / copy if newer in the properties window. It will then be copied to the output directory during the build process.
Note that you can either use a precompiled XNB file (usually created with XNA game studio) or you can use raw PNG image files. If you use the latter you'll need to add the file extension in your code.
Move Content folder to Assets and for each resource file set the 'Build action' to 'AndroidAsset' and set 'Copy to output directory' to 'Copy if newer'.
Just use this way
using (var stream = TitleContainer.OpenStream ("Content/charactersheet.png"))
{
characterSheetTexture = Texture2D.FromStream (this.GraphicsDevice, stream);
}
instead of
texture = Content.Load<Texture2D>("player");
To get it working just follow my instruction:
Simple 2D game with Xamarin
I know its little long but it works trust me, in case of additional questions feel free to ask :D regards Schreda