Beispiel #1
0
 public static BackgroundController FromMetadata(BackgroundMetadata metadata, ContentManager content)
 {
     var controller =
         new BackgroundController(
             metadata.Layers.Select<ParallaxLayerMetadata, ScrollingBackground>(
                 x => ParallaxLayer.FromMetadata(x, content)));
     return controller;
 }
        public override void Initialize()
        {
            LoadingScreen.ScreenLoaded += OnScreenLoaded;

            _camera = new Camera2D();
            _camera.Initialize(_screenManager.Game);

            _backgroundController =
                BackgroundController.FromMetadata(
                    _screenManager.Game.Content.Load<BackgroundMetadata>(@"Backgrounds\Default"),
                    _screenManager.Game.Content);
            _backgroundController.Initialize(_screenManager.Game, _screenManager.SpriteBatch, _camera);

            base.Initialize();
        }