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()
        {
            Log.Initialize();
            Globals.TheGame = this;

            if (_graphics.GraphicsDevice.Adapter.IsProfileSupported(GraphicsProfile.HiDef))
            {
                _graphics.GraphicsProfile = GraphicsProfile.HiDef;
                _graphics.ApplyChanges();
            }
            else
            {
                Log.LogMessage("您的显卡不支持高配模式,最大只支持2048x2048的图片,如果TMX地图中存在大于2048x2048的图片,将会显示不正确。");
            }

            Globals.LoadSetting();
            TalkTextList.Initialize();

            Log.LogMessage("Game is running...");

            if (IsInEditMode)
            {
                //Can't full screen in edit mode
                _graphics.IsFullScreen = false;
            }
            else
            {
                _graphics.IsFullScreen = Globals.IsFullScreen;
            }

            _graphics.PreferredBackBufferWidth  = Globals.WindowWidth;
            _graphics.PreferredBackBufferHeight = Globals.WindowHeight;
            _graphics.ApplyChanges();

            //Set back in case of width height not work
            Globals.WindowWidth  = _graphics.PreferredBackBufferWidth;
            Globals.WindowHeight = _graphics.PreferredBackBufferHeight;

            Globals.TheCarmera.ViewWidth  = _graphics.PreferredBackBufferWidth;
            Globals.TheCarmera.ViewHeight = _graphics.PreferredBackBufferHeight;
            MapBase.ViewWidth             = _graphics.PreferredBackBufferWidth;
            MapBase.ViewHeight            = _graphics.PreferredBackBufferHeight;

            //Game run in editor
            if (_parentForm != null)
            {
                //Make draw size correct
                AdjustDrawSizeToDrawSurfaceSize();
            }

            base.Initialize();
        }
Example #2
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()
        {
            Globals.TheGame = this;
            Globals.LoadSetting();
            TalkTextList.Initialize();
            Log.Initialize();

            Log.LogMessageToFile("Game is running...");

            if (IsInEditMode)
            {
                //Can't full screen in edit mode
                _graphics.IsFullScreen = false;
            }
            else
            {
                _graphics.IsFullScreen = Globals.IsFullScreen;
            }

            _graphics.PreferredBackBufferWidth  = Globals.WindowWidth;
            _graphics.PreferredBackBufferHeight = Globals.WindowHeight;
            _graphics.ApplyChanges();

            //Set back in case of width height not work
            Globals.WindowWidth  = _graphics.PreferredBackBufferWidth;
            Globals.WindowHeight = _graphics.PreferredBackBufferHeight;

            Globals.TheCarmera.ViewWidth  = _graphics.PreferredBackBufferWidth;
            Globals.TheCarmera.ViewHeight = _graphics.PreferredBackBufferHeight;
            Globals.TheMap.ViewWidth      = _graphics.PreferredBackBufferWidth;
            Globals.TheMap.ViewHeight     = _graphics.PreferredBackBufferHeight;

            //Game run in editor
            if (_parentForm != null)
            {
                //Make draw size correct
                AdjustDrawSizeToDrawSurfaceSize();
            }

            base.Initialize();
        }