예제 #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

#if DEBUG
            this.Window.Title = "StackItUp-dev-debug";
#else
            this.Window.Title = "StackItUp-dev-release";
#endif

            this.Window.AllowUserResizing = false;

            if (MonoGame.Framework.Utilities.PlatformInfo.MonoGamePlatform != MonoGame.Framework.Utilities.MonoGamePlatform.Android)
            {
                Logger.Start();
                WindowSettings.Initialize(this, this.graphics);
                WindowSettings.SetWindowResolution(new Point(540, 960));
                WindowSettings.UnitsVisible = new Vector2(10.8f, 19.2f); //new Vector2(5.4f, 9.6f);
                WindowSettings.SetAspectRatio(new Vector2(9f, 16f));
                //WindowManager.UnitsVisible = new Vector2(540, 960);
            }
            else
            {
                WindowSettings.Initialize(this, this.graphics);
                WindowSettings.UnitsVisible = new Vector2(10.8f, 19.2f); //new Vector2(5.4f, 9.6f);
                WindowSettings.SetAspectRatio(new Vector2(9f, 16f));
                WindowSettings.SetFullscreen(true);
                WindowSettings.SetOrientations(DisplayOrientation.Portrait);
            }

//#if ANDROID
//            graphics.IsFullScreen = true;
//            graphics.PreferredBackBufferWidth = 800;
//            graphics.PreferredBackBufferHeight = 480;
//            graphics.SupportedOrientations = DisplayOrientation.LandscapeLeft | DisplayOrientation.LandscapeRight;
//#endif

            this.sceneManager = new GUISceneManager(this);

            this.Components.Add(new KeyboardInput(this));
            this.Components.Add(new MouseInput(this));
            this.Components.Add(new GamepadInput(this));
            this.Components.Add(new TouchpanelInput(this));

            Assets.Initialize(Content);

            base.Initialize();
        }