예제 #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");
     }
 }
예제 #2
0
파일: Game1.cs 프로젝트: slicedpan/nettest2
 /// <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
 }