예제 #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()
        {
#if DEBUG
            this.Window.Title = "Asteroids-dev-debug";
#else
            this.Window.Title = "Asteroids-dev-release";
#endif
            this.Window.Title += " - Version: " + this.GetVersionString();
            System.Diagnostics.Trace.WriteLine(DateTime.Now + " " + this.Window.Title);

            UserConfig.Instance = UserConfig.Load();

            WindowSettings.Initialize(this, this.graphics);
            WindowSettings.SetWindowResolution(new Point(UserConfig.Instance.ScreenWidth, UserConfig.Instance.ScreenHeight));
            WindowSettings.SetBorderless(UserConfig.Instance.Borderless);
            WindowSettings.MinWindowResolution = GameConfig.MinWindowSize;
            WindowSettings.UnitsVisible        = new Vector2(1280, 720);

            this.renderTarget = new RenderTarget2D(this.GraphicsDevice, WindowSettings.RenderArea.Width, WindowSettings.RenderArea.Height);

            this.sceneManager = new GUISceneManager(this);

            this.Components.Add(new Kadro.Input.KeyboardInput(this));
            this.Components.Add(new MouseInput(this));
            this.Components.Add(new GamepadInput(this));
            this.Components.Add(new TouchpanelInput(this));
            this.performanceCounter = new PerformanceMetrics();

            Assets.Initialize(Content);

            this.networkManager = new NetworkManager(UserConfig.Instance.NetworkName);
            this.connectionInfo = new BaseConnection();

            base.Initialize();
        }
예제 #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()
        {
            // TODO: Add your initialization logic here
#if DEBUG
            this.Window.Title = "EightBall-dev-debug";
#else
            this.Window.Title = "EightBall-dev-release";
#endif

            //this.windowManager = new WindowManager(this, this.graphics, new Point(1280, 720)/*GameConfig.DesignResolution*/);
            WindowSettings.Initialize(this, this.graphics);
            //WindowManager.SetWindowResolution(new Point(UserConfig.Instance.ScreenWidth, UserConfig.Instance.ScreenHeight));
            WindowSettings.SetWindowResolution(new Point(1280, 720) /*new Point(UserConfig.Instance.ScreenWidth, UserConfig.Instance.ScreenHeight)*/);
            //WindowManager.SetBorderless(UserConfig.Instance.Borderless);
            //WindowManager.MinWindowSize = GameConfig.MinWindowSize;
            WindowSettings.UnitsVisible   = new Vector2(3.2f * 10, 1.8f * 10); // units in m
            this.Window.AllowUserResizing = false;

            this.guiSceneManager = new GUISceneManager(this);

            this.Components.Add(new Kadro.Input.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();  //initialize components
        }
예제 #3
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();
        }
 public override void OnEnable()
 {
     base.OnEnable();
     WindowSettings.Initialize();
     InitWindow();
 }