Exemple #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()
        {
            // TODO: Add your initialization logic here

            base.Initialize();

            resolutionManager = new ResolutionManager(this, graphics);
            resolutionManager.Initialize();
            position = new Vector2(0, 0);
            camera   = new Camera(resolutionManager);
        }
Exemple #2
0
 protected override void Initialize()
 {
     Window.AllowUserResizing = false;
     this.Window.Title        = NAME;
     controller = Controller.GetInstance();
     controller.Initialize(this);
     ResolutionManager.Initialize();
     ApplyGraphicChanges();
     base.Initialize();
     AudioManager.Initialize();
     ScreenManager.GetInstance().AddScreen(new Screen.MainMenuScreen());
 }
        /// <summary>
        /// The Main CutlassEngine constructor
        /// </summary>
        public CutlassEngine(string windowTitle = "Cutlass Engine")
        {
            _GraphicsDeviceManager = new GraphicsDeviceManager(this);
            _ContentManager        = new ContentManager(this.Services);

            _GraphicsDeviceManager.PreparingDeviceSettings += new EventHandler <PreparingDeviceSettingsEventArgs>(GraphicsDeviceManager_PreparingDeviceSettings);
            Window.Title = _WindowTitle = windowTitle;

            GameSettingsManager.Initialize();

            //Initialize Resolution settings.
            ResolutionManager.Initialize(this, _GraphicsDeviceManager);

//#if DEBUG
            //Disable vertical retrace to get highest framerates possible for
            //testing performance.
            _GraphicsDeviceManager.SynchronizeWithVerticalRetrace = false;
//#endif
            //Demand to update as fast as possible, do not use fixed time steps.
            this.IsFixedTimeStep = false;

            //Init the Input component
            _Input = new Input(this);
            Components.Add(_Input);

            //Init the Font Manager component
            _FontManager = new FontManager(this);
            Components.Add(_FontManager);

            //Init the Texture Manager component
            _TextureManager = new TextureManager(this);
            Components.Add(_TextureManager);

            //Init the Sound Manager component
            _SoundManager = new SoundManager(this);
            Components.Add(_SoundManager);

            //Init the screen manager component.
            _ScreenManager = new ScreenManager(this);
            Components.Add(_ScreenManager);

#if DEBUG
            //Init the FpsCounter
            _FpsCounter = new FpsCounter(this);
            Components.Add(_FpsCounter);
#endif
        }