Пример #1
0
        public override void Initialize()
        {
            base.Initialize();

            _spriteBatch = Game.Services.GetService<SpriteBatch>();
            _input = Game.Services.GetService<InputState>();
            _particleRenderer = Game.Services.GetService<SpriteBatchRenderer>();
        }
Пример #2
0
        protected override void Initialize()
        {
            _screenCenter = new Vector2(GraphicsDevice.PresentationParameters.BackBufferWidth / 2, GraphicsDevice.PresentationParameters.BackBufferHeight / 2);

            _particleRenderer = new SpriteBatchRenderer {GraphicsDeviceService = _graphics};
            _particleRenderer.LoadContent(Content);

            _spriteBatch = new SpriteBatch(GraphicsDevice);
            _input = new InputState();

            Services.AddService(typeof(SpriteBatch), _spriteBatch);
            Services.AddService(typeof(InputState), _input);
            Services.AddService(typeof(SpriteBatchRenderer), _particleRenderer);

            _ship = new Ship(this) {Position = new Vector2(900, 360)};
            Components.Add(_ship);
            IsMouseVisible = true;
            base.Initialize();
        }