The GraphicsDevice must not be null

Oct 11, 2011 at 6:31 AM

i am trying to add a menu to my game. so I used the gamestatemanager example.

i started getting this error when i try to do State.InitGoblin(graphics, Content, "");

The GraphicsDevice must not be null when creating new resources.Parameter name: graphicsDevice

Oct 14, 2011 at 2:04 AM

I've successfully integrated GameStateManager example into GoblinXNA, so I can confirm that it's possible.  I have

graphics = new GraphicsDeviceManager(this)
                           {
                               PreferredBackBufferWidth = 1280,
                               PreferredBackBufferHeight = 720,
                               PreferMultiSampling = true,
                           };

// Create the screen manager component.
ScreenManager = new ScreenManager.ScreenManager(this)
                                {
                                    TraceEnabled = false
                                };

 

inside my constructor, and then

 

 State.InitGoblin(graphics, Content, "settings.xml");
// Activate the first screens.
ScreenManager.AddScreen(new Background(), null);
ScreenManager.AddScreen(new MainMenu(), null);

base.Initialize();

inside my Initialize() function.  Is this the order you've initialized your objects, too?

Nov 27, 2012 at 3:35 AM

How did u exactly integrate the GameStateManagementState example into GoblinXNA? I have a lot of problems with this. I think concepts problems maybe. Can u post the logic of the changes please or some type of explanation? Thank you very much!