protected override void Initialize()
 {
     try
     {
         Perf.Time($"{nameof(NeedlesslyComplexMainGame)}.Initialize", () =>
         {
             CurrentGame.Init(this);
             Resources.Init();
             // @todo #1 Bug: Update the GraphicsDeviceManager in the constructor, to avoid the window being mispositioned and visibly changing size
             CurrentDisplay.Init(_graphics, _display);
             Window.Position = new Point((GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width - CurrentDisplay.GameWidth) / 2,
                                         (GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height - CurrentDisplay.GameHeight) / 2 - 40); // Delete this once the above issue is fixed
             IsMouseVisible    = true;
             _uiSpriteBatch    = new SpriteBatch(GraphicsDevice);
             _worldSpriteBatch = new SpriteBatch(GraphicsDevice);
             Input.SetController(_controller);
             World.Init(_worldSpriteBatch);
             UI.Init(_uiSpriteBatch);
             _scene.Init();
             base.Initialize();
         });
     }
     catch (Exception e)
     {
         _errorHandler.Handle(new Exception("Error while Initializing MonoDragons Core engine", e));
     }
 }
Esempio n. 2
0
 protected override void Initialize()
 {
     Perf.Time($"{nameof(NeedlesslyComplexMainGame)}.Initialize", () =>
     {
         CurrentGame.Init(this);
         Resources.Init();
         InitDisplayIfNeeded();
         // @todo #1 Bug: Update the GraphicsDeviceManager in the constructor, to avoid the window being mispositioned and visibly changing size
         CurrentDisplay.Init(_graphics, _display);
         Window.Position = new Point(0, 0); // Delete this once the above issue is fixed
         IsMouseVisible  = true;
         _sprites        = new SpriteBatch(GraphicsDevice);
         Input.SetController(_controller);
         World.Init(_sprites);
         UI.Init(_sprites);
         _scene.Init();
         base.Initialize();
     });
 }