Example #1
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()
        {
            this.IsMouseVisible = true;

            // init the asset manager.
            var assetManager = new AssetManager(this);
            this.Components.Add(assetManager);

            // init the audio manager.
            var audioManager = new AudioManager(this);
            this.Components.Add(audioManager);

            // create the screen manager
            this._screenManager = new ScreenManager(this);
            Components.Add(_screenManager);

            // add the background screen to the screen manager
            this._screenManager.AddScreen(new BackgroundScreen(this));
            this._screenManager.AddScreen(new GamePlayScreen(this));

            base.Initialize();
        }
Example #2
0
        private static AssetManager _instance; // the instance.

        #endregion Fields

        #region Constructors

        public AssetManager(Game game)
            : base(game)
        {
            this.Game.Services.AddService(typeof(IAssetManager), this); // export service.
            _instance = this;
        }