コード例 #1
0
ファイル: GameMain.cs プロジェクト: rossmas/zomination
        /// <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()
        {
            // Applying graphics settings

            #if WINDOWS
            // ini settings file
            FAZEngine.IniFile settingsIni = new FAZEngine.IniFile(@".\configs\settings.ini");

            // fullscreen
            graphics.IsFullScreen = bool.Parse(settingsIni.IniReadValue("Options", "Fullscreen"));

            // resolution settings
            int sWidth = 0, sHeight = 0;
            if (int.TryParse(settingsIni.IniReadValue("Resolution", "Width"), out sWidth) &&
                int.TryParse(settingsIni.IniReadValue("Resolution", "Height"), out sHeight))
            {
                GlobalHelper.WindowWidth = sWidth;
                GlobalHelper.WindowHeight = sHeight;
            }
            else
            {
                GlobalHelper.WindowWidth = graphics.GraphicsDevice.Adapter.CurrentDisplayMode.Width;
                GlobalHelper.WindowHeight = graphics.GraphicsDevice.Adapter.CurrentDisplayMode.Height;
            }

            // use gamepad settings
            GlobalHelper.UseGamePad = bool.Parse(settingsIni.IniReadValue("Options", "UseGamePad"));
            IsMouseVisible = !GlobalHelper.UseGamePad;
            #else
            // START UP SETTINGS FOR XBOX
            GlobalHelper.UseGamePad = true;
            GlobalHelper.WindowWidth = GraphicsDevice.DisplayMode.Width;
            GlobalHelper.WindowHeight = GraphicsDevice.DisplayMode.Height;
            // if it's in 4:3 but "widescreen" at the same time, just use a fake 16:9 resolution
            if (GraphicsDevice.DisplayMode.AspectRatio == (float)4 / 3 && GraphicsDevice.Adapter.IsWideScreen)
            {
                GlobalHelper.WindowWidth = 1280;
                GlobalHelper.WindowHeight = 720;
            }
            #endif
            // msaa settings is done when preparing
            graphics.PreparingDeviceSettings += new EventHandler<PreparingDeviceSettingsEventArgs>(graphics_PreparingDeviceSettings);

            graphics.PreferredBackBufferWidth = GlobalHelper.WindowWidth;
            graphics.PreferredBackBufferHeight = GlobalHelper.WindowHeight;
            //graphics.PreferMultiSampling = true;
            //GraphicsDevice.PresentationParameters.MultiSampleCount = 8;
            //graphics.SynchronizeWithVerticalRetrace = true;
            graphics.ApplyChanges();

            // After loading graphics settings, load audio engine manager
            audioEM = new AudioEM(this);

            base.Initialize();
        }
コード例 #2
0
ファイル: GameMain.cs プロジェクト: rossmas/zomination
 void SignedInGamer_SignedOut(object sender, SignedOutEventArgs e)
 {
     LoadingScreen.Load(screenManager, false, null, new PressStartScreen(null));
     // reload audioEM = new AudioEM(this);
     audioEM = new AudioEM(this);
 }