Esempio n. 1
0
 public ScreenManager(GraphicsDevice graphicsDevice, ContentManager cm)
 {
     if (currentInstance == null)
     {
         ContentManager = cm;
         GraphicsDevice = graphicsDevice;
         SpriteBatch = new SpriteBatch(graphicsDevice);
         currentInstance = this;
     }
     else
     {
         throw new Exception("only one instance of ScreenManager can be instantiated");
     }
 }
Esempio n. 2
0
 /// <summary>
 /// LoadContent will be called once per game and is the place to load
 /// all of your content.
 /// </summary>
 protected override void LoadContent()
 {
     // Create a new SpriteBatch, which can be used to draw textures.
     spriteBatch = new SpriteBatch(GraphicsDevice);
     ScreenManager sm = new ScreenManager(GraphicsDevice, Content);
     sm.currentScreen = new TestScreen();
     sm.currentScreen.LoadContent(Content);
     sf = Content.Load<SpriteFont>("font");
     graphics.PreferredBackBufferHeight = height;
     graphics.PreferredBackBufferWidth = width;
     // TODO: use this.Content to load your game content here
 }