Пример #1
0
        public static DisplaySettings LoadConfig(int minScreenWidth, int minScreenHeight, bool allowFullScreen)
        {
            DisplaySettings settings = new DisplaySettings(minScreenWidth, minScreenHeight, allowFullScreen);
            XmlElement      element  = ConfigManager.Instance.GetCategoryData(settings);

            if (element != null)
            {
                settings.ReadCategoryData(element);
            }
            return(settings);
        }
Пример #2
0
 public void CopyTo(DisplaySettings dest)
 {
     dest.displayMode      = this.displayMode;
     dest.renderSystem     = this.renderSystem;
     dest.renderSystemName = this.renderSystemName;
     dest.vSync            = this.vSync;
     dest.antiAliasing     = this.antiAliasing;
     dest.allowNVPerfHUD   = this.allowNVPerfHUD;
     dest.minScreenWidth   = minScreenWidth;
     dest.minScreenHeight  = minScreenHeight;
     dest.allowFullScreen  = allowFullScreen;
 }
        public ConfigDialog(DisplaySettings settings)
        {
            this.settings = new DisplaySettings(settings);
            InitializeComponent();
            inhibit = 0;
            this.DialogResult = DialogResult.None;
            List<RenderSystem> renderSystems = Root.Instance.RenderSystems;
            foreach (RenderSystem rs in renderSystems)
                renderSystemComboBox.Items.Add(rs.Name);
            renderSystemComboBox.SelectedIndex = 0;

            logoPicture.Load(LogoPicture);
            logoPicture.Size = logoPicture.Image.Size;
            ApplySettingsToUI();
        }
Пример #4
0
        public ConfigDialog(DisplaySettings settings)
        {
            this.settings = new DisplaySettings(settings);
            InitializeComponent();
            inhibit           = 0;
            this.DialogResult = DialogResult.None;
            List <RenderSystem> renderSystems = Root.Instance.RenderSystems;

            foreach (RenderSystem rs in renderSystems)
            {
                renderSystemComboBox.Items.Add(rs.Name);
            }
            renderSystemComboBox.SelectedIndex = 0;

            logoPicture.Load(LogoPicture);
            logoPicture.Size = logoPicture.Image.Size;
            ApplySettingsToUI();
        }
Пример #5
0
        protected bool Configurate()
        {
            DisplaySettings settings = new DisplaySettings(minScreenWidth, minScreenHeight, allowFullScreen);

            bool configureFailed = false;

            /// <summary>
            /// If this string is set, then use it to configure the display window.
            /// Using this option will bypass both the config dialog and loading
            ///   of the DisplayConfig.xml file.
            /// Format is "widthxheightxdepth".  For example "1024x768x32".
            /// </summary>
            if (manualDisplayConfigString != null)
            {
                string[] vals = manualDisplayConfigString.Split(new Char[] { 'x' });
                if (vals.Length == 3)
                {
                    int width;
                    int height;
                    int depth;
                    bool fail = false;

                    if (!int.TryParse(vals[0], out width))
                    {
                        fail = true;
                    }

                    if (!int.TryParse(vals[1], out height))
                    {
                        fail = true;
                    }

                    if (!int.TryParse(vals[2], out depth))
                    {
                        fail = true;
                    }
                    if (!fail)
                    {
                        settings.displayMode = new DisplayMode(width, height, depth, allowFullScreen && manualFullscreen);
                        settings.renderSystem = engine.RenderSystems[0];
                    }
                }
            }
            else
            {
                // attempt to load display config file first, unless the user has explicitly
                // asked for the config dialog
                settings = DisplaySettings.LoadConfig(minScreenWidth, minScreenHeight, allowFullScreen);

                if (settings.renderSystem == null || settings.displayMode == null || doDisplayConfig)
                {
                    configureFailed = true;
                    if (settings.renderSystem == null)
                    {
                        settings.renderSystem = engine.RenderSystems[0];
                        settings.renderSystemName = settings.renderSystem.Name;
                    }
                    if (settings.displayMode == null)
                        settings.displayMode = new DisplayMode(800, 600, 32, false);
                    ConfigDialog dialog = new ConfigDialog(settings);
                    System.Windows.Forms.DialogResult rv = dialog.ShowDialog();
                    if (rv == System.Windows.Forms.DialogResult.OK)
                    {
                        configureFailed = false;
                        // get render system and display mode values from the dialog
                        dialog.settings.CopyTo(settings);
                    }

                    // save the display config to a file if we got a successful configuration
                    //  from the dialog
                    if (!configureFailed)
                        DisplaySettings.SaveDisplaySettings(settings);
                }
            }

            // At this point, allowFullScreen and world specific size
            // limitations have been applied to the display modes.
            if (configureFailed || settings.renderSystem == null || settings.displayMode == null)
                // failed to configure
                return false;
            else
            {
                RenderSystem renderSystem = settings.renderSystem;
                DisplayMode displayMode = settings.displayMode;
                // set the renderSystem for axiom
                Root.Instance.RenderSystem = renderSystem;

                // set the vsync option
                renderSystem.IsVSync = settings.vSync;
                renderSystem.AllowResize = allowResize;
                renderSystem.SetConfigOption("VSync", (settings.vSync ? "Yes" : "No"));
                renderSystem.SetConfigOption("Anti Aliasing", settings.antiAliasing);

                // set whether NVPerfHUD is supported
                renderSystem.SetConfigOption("Allow NVPerfHUD", (settings.allowNVPerfHUD ? "Yes" : "No"));

                // disgusting evil mlm video stuff
                if (File.Exists("Multiverse.Movie.dll"))
                    renderSystem.SetConfigOption("Multi-Threaded", "Yes");

                int width, height;
                if (displayMode.Fullscreen)
                {
                    width = displayMode.Width;
                    height = displayMode.Height;
                }
                else
                    AdjustToFitInWorkingArea(displayMode.Width, displayMode.Height, out width, out height);

                // set the display mode for axiom to use when it creates its window
                engine.RenderSystem.ConfigOptions.SelectMode(width, height, displayMode.Depth, displayMode.Fullscreen);

                return true;
            }
        }
Пример #6
0
 public DisplaySettings(DisplaySettings other)
 {
     other.CopyTo(this);
 }
Пример #7
0
 public static void SaveDisplaySettings(DisplaySettings settings)
 {
     ConfigManager.Instance.WriteCategoryData(settings);
 }
Пример #8
0
 public static void SaveDisplaySettings(DisplaySettings settings)
 {
     ConfigManager.Instance.WriteCategoryData(settings);
 }
Пример #9
0
 public static DisplaySettings LoadConfig(int minScreenWidth, int minScreenHeight, bool allowFullScreen)
 {
     DisplaySettings settings = new DisplaySettings(minScreenWidth, minScreenHeight, allowFullScreen);
     XmlElement element = ConfigManager.Instance.GetCategoryData(settings);
     if (element != null)
         settings.ReadCategoryData(element);
     return settings;
 }
Пример #10
0
 public DisplaySettings(DisplaySettings other)
 {
     other.CopyTo(this);
 }
Пример #11
0
 public void CopyTo(DisplaySettings dest)
 {
     dest.displayMode = this.displayMode;
     dest.renderSystem = this.renderSystem;
     dest.renderSystemName = this.renderSystemName;
     dest.vSync = this.vSync;
     dest.antiAliasing = this.antiAliasing;
     dest.allowNVPerfHUD = this.allowNVPerfHUD;
     dest.minScreenWidth = minScreenWidth;
     dest.minScreenHeight = minScreenHeight;
     dest.allowFullScreen = allowFullScreen;
 }