Ive googled it and all the answers where all over the place, and none of them about the graphicsdevicemanager, which is apparently causing my error. Can someone point me in the right direction? Here is the code thats causing the problem:
SceneManager class where the error occours:
class SceneManager : GameWorld
{
// Makes this class a singleton class
public static readonly SceneManager instance = new SceneManager();
GraphicsDeviceManager graphics;
SpriteBatch spriteBatch;
public enum MyScenes
{
Login,
Register,
MainMenu,
Options,
AboutTheGame,
Credits,
Characters,
Appearance,
DesignPlaystyle,
Talents,
Rankings,
Playing,
PauseMenu,
Closing,
}
public MyScenes myScenes;
private TalentsScene myTalentsScene;
private DesignPlayStyleScene myDesignPlaystyleScene;
private CharacterScene myCharacterScene;
private MenuScene myMenuScene;
private Player ourPlayer;
public SceneManager()
{
graphics = new GraphicsDeviceManager(this); // <---- Error here
}
protected override void Initialize()
{
myScenes = MyScenes.DesignPlaystyle;
myTalentsScene = new TalentsScene(graphics);
myDesignPlaystyleScene = new DesignPlayStyleScene(graphics);
myCharacterScene = new CharacterScene(graphics);
myMenuScene = new MenuScene(graphics);
base.Initialize();
}
GameWorld:
public class GameWorld : Game
{
// Makes this class a singleton class
public static readonly GameWorld instance = new GameWorld();
public enum ClassBtnToggled
{
None,
Amazonian,
Magus,
ShadowSpawn,
Blackguard,
SenjuMonk,
Deadeye,
Gladiator,
Templar,
}
public ClassBtnToggled classBtnToggled;
GraphicsDeviceManager graphics;
SpriteBatch spriteBatch;
private SceneManager mySceneManager;
public int screenWidth = 1360;
public int screenHeight = 768;
public string chosenClass;
SpriteFont myFont;
private const float messageDelay = 2;
private float remainingDelay = messageDelay;
private string designPlaystyleMessages;
public GameWorld()
{
graphics = new GraphicsDeviceManager(this);
Content.RootDirectory = "Content";
graphics.PreferredBackBufferWidth = screenWidth;
graphics.PreferredBackBufferHeight = screenHeight;
graphics.ApplyChanges();
IsMouseVisible = true;
}
protected override void Initialize()
{
mySceneManager = SceneManager.instance;
classBtnToggled = ClassBtnToggled.None;
base.Initialize();
}
protected override void LoadContent()
{
spriteBatch = new SpriteBatch(GraphicsDevice);
mySceneManager.LoadContent();
//myFont = Content.Load<SpriteFont>("myFont"); /*asdadasd*/
}
protected override void UnloadContent()
{
}
protected override void Update(GameTime gameTime)
{
mySceneManager.Update(gameTime);
base.Update(gameTime);
}
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.White);
spriteBatch.Begin();
mySceneManager.Draw(gameTime);
spriteBatch.End();
base.Draw(gameTime);
}