示例#1
0
 public GameScreen(Game game, SpriteBatch spriteBatch)
     : base(game)
 {
     this.game = game;
     this.spriteBatch = spriteBatch;
     var gs = game.Services;
     screenManager = (ScreenManager)game.Services.GetService(typeof(ScreenManager));
 }
示例#2
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);

            ScreenManager screenManager = new ScreenManager(this, spriteBatch);
            Components.Add(screenManager);
            Services.AddService(typeof(ScreenManager), screenManager);

            Components.Add(new FrameRateCounter(this));

            base.Initialize();
        }