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;             // show mouse

            // Setup main viewport for camera use
            _graphics.GraphicsDevice.Viewport = new Viewport
            {
                X      = 0,
                Y      = 0,
                Width  = _graphics.PreferredBackBufferWidth,
                Height = _graphics.PreferredBackBufferHeight,
            };

            // Initialize camera at viewport location
            _camera = new Camera2D(Graphics);
            _camera.LookAt(new Vector2(0, 0));

            base.Initialize();             // MonoGame setup

            _bgColor     = Color.Black;
            Window.Title = "MB2D Engine";

            SetUpDebugVals();
            RegisterSystems();

            _scenes.ResetTo((Scene)Activator.CreateInstance(_initScene, _gameObjects, Content));
        }