Reputation: 7923
I am writing my own game engine in XNA and started to port it into MonoGame so that I can put it on Android/iOS/Windows 8. For some reason I am getting a null reference exception when the main create a new game object. So the code that allocates the object is:
static void Main(string[] args)
{
//game g = new game();
using (game game = new game())
{
game.Run();
}
}
and the error is as
public lesaEngine()
which is the base constructor for the game object.
the inheritance is just as always
class lesaEngine : Microsoft.Xna.Framework.Game
class game : lesaEngine
Not sure whats going on here. It works normally under normal XNA. I am using Visual Studio 2012 for the port.
Upvotes: 4
Views: 717
Reputation: 17805
Did you create a new Win8 monogame project? if so the entry point should look more like this
#if !NETFX_CORE
using (MyGame game = new MyGame())
{
game.Run();
}
#endif
#if NETFX_CORE
var factory = newMonoGame.Framework.GameFrameworkViewSource<MyGame>();
Windows.ApplicationModel.Core.CoreApplication.Run(factory);
#endif }
Upvotes: 1