コード例 #1
0
        /// <summary>
        ///		Query the display modes and deal with any other config options.
        /// </summary>
        public override void AddConfig()
        {
            ConfigOption optFullScreen       = new ConfigOption("Full Screen", "No", false);
            ConfigOption optVideoMode        = new ConfigOption("Video Mode", "800 x 600", false);
            ConfigOption optDisplayFrequency = new ConfigOption("Display Frequency", "", false);
            ConfigOption optColorDepth       = new ConfigOption("Color Depth", "", false);
            ConfigOption optFSAA             = new ConfigOption("FSAA", "0", false);
            ConfigOption optVSync            = new ConfigOption("VSync", "No", false);
            ConfigOption optRTTMode          = new ConfigOption("RTT Preferred Mode", "FBO", false);

            // Full Screen
            optFullScreen.PossibleValues.Add(0, "Yes");
            optFullScreen.PossibleValues.Add(1, "No");

            // Video Mode

            #region Video Mode

            Gdi.DEVMODE setting;
            int         i = 0;
            int         width, height, bpp, freq;
            // get the available OpenGL resolutions
            bool more = User.EnumDisplaySettings(null, i++, out setting);
            // add the resolutions to the config
            while (more)
            {
                _deviceModes.Add(setting);

                width  = setting.dmPelsWidth;
                height = setting.dmPelsHeight;
                bpp    = setting.dmBitsPerPel;

                // filter out the lower resolutions and dupe frequencies
                if (bpp >= 16 && height >= 480)
                {
                    string query = string.Format("{0} x {1}", width, height);

                    if (!optVideoMode.PossibleValues.Values.Contains(query))
                    {
                        // add a new row to the display settings table
                        optVideoMode.PossibleValues.Add(i, query);
                    }
                    if (optVideoMode.PossibleValues.Count == 1 && String.IsNullOrEmpty(optVideoMode.Value))
                    {
                        optVideoMode.Value = query;
                    }
                }
                // grab the current display settings
                more = User.EnumDisplaySettings(null, i++, out setting);
            }

            #endregion Video Mode

            // FSAA
            foreach (int level in _fsaaLevels)
            {
                optFSAA.PossibleValues.Add(level, level.ToString());
            }

            // VSync
            optVSync.PossibleValues.Add(0, "Yes");
            optVSync.PossibleValues.Add(1, "No");

            // RTTMode
            optRTTMode.PossibleValues.Add(0, "FBO");
            optRTTMode.PossibleValues.Add(1, "PBuffer");
            optRTTMode.PossibleValues.Add(2, "Copy");

            optFullScreen.ConfigValueChanged += new ConfigOption <string> .ValueChanged(_configOptionChanged);

            optVideoMode.ConfigValueChanged += new ConfigOption <string> .ValueChanged(_configOptionChanged);

            optDisplayFrequency.ConfigValueChanged += new ConfigOption <string> .ValueChanged(_configOptionChanged);

            optFSAA.ConfigValueChanged += new ConfigOption <string> .ValueChanged(_configOptionChanged);

            optVSync.ConfigValueChanged += new ConfigOption <string> .ValueChanged(_configOptionChanged);

            optColorDepth.ConfigValueChanged += new ConfigOption <string> .ValueChanged(_configOptionChanged);

            optRTTMode.ConfigValueChanged += new ConfigOption <string> .ValueChanged(_configOptionChanged);

            ConfigOptions.Add(optVideoMode);
            ConfigOptions.Add(optColorDepth);
            ConfigOptions.Add(optDisplayFrequency);
            ConfigOptions.Add(optFullScreen);
            ConfigOptions.Add(optFSAA);
            ConfigOptions.Add(optVSync);
            ConfigOptions.Add(optRTTMode);

            _refreshConfig();
        }
コード例 #2
0
        /// <summary>
        ///
        /// </summary>
        public override void AddConfig()
        {
            var optFullScreen       = new ConfigOption("Full Screen", "No", false);
            var optVideoMode        = new ConfigOption("Video Mode", "800 x 600", false);
            var optDisplayFrequency = new ConfigOption("Display Frequency", "", false);
            var optColorDepth       = new ConfigOption("Color Depth", "", false);
            var optFSAA             = new ConfigOption("FSAA", "0", false);
            var optVSync            = new ConfigOption("VSync", "No", false);
            var optRTTMode          = new ConfigOption("RTT Preferred Mode", "FBO", false);

            // Full Screen
            optFullScreen.PossibleValues.Add(0, "Yes");
            optFullScreen.PossibleValues.Add(1, "No");

            // Video Mode

            #region Video Modes

            // get the available OpenGL resolutions
            DisplayDevice dev = DisplayDevice.Default;

            // add the resolutions to the config
            for (int q = 0; q < dev.AvailableResolutions.Count; q++)
            {
                if (dev.AvailableResolutions[q].BitsPerPixel >= 16)
                {
                    int width  = dev.AvailableResolutions[q].Width;
                    int height = dev.AvailableResolutions[q].Height;

                    // filter out the lower resolutions and dupe frequencies
                    if (width >= 640 && height >= 480)
                    {
                        string query = string.Format("{0} x {1}", width, height);

                        if (!optVideoMode.PossibleValues.Values.Contains(query))
                        {
                            // add a new row to the display settings table
                            optVideoMode.PossibleValues.Add(optVideoMode.PossibleValues.Count, query);
                        }
                        if (optVideoMode.PossibleValues.Count == 1 && String.IsNullOrEmpty(optVideoMode.Value))
                        {
                            optVideoMode.Value = query;
                        }
                    }
                }
            }

            #endregion Video Modes

            // FSAA
            GetFSAALevels();
            foreach (int level in this._fsaaLevels)
            {
                optFSAA.PossibleValues.Add(level, level.ToString());
            }

            // VSync
            optVSync.PossibleValues.Add(0, "Yes");
            optVSync.PossibleValues.Add(1, "No");

            // RTTMode
            optRTTMode.PossibleValues.Add(0, "FBO");
            optRTTMode.PossibleValues.Add(1, "PBuffer");
            optRTTMode.PossibleValues.Add(2, "Copy");

            optFullScreen.ConfigValueChanged += new ConfigOption <string> .ValueChanged(_configOptionChanged);

            optVideoMode.ConfigValueChanged += new ConfigOption <string> .ValueChanged(_configOptionChanged);

            optDisplayFrequency.ConfigValueChanged += new ConfigOption <string> .ValueChanged(_configOptionChanged);

            optFSAA.ConfigValueChanged += new ConfigOption <string> .ValueChanged(_configOptionChanged);

            optVSync.ConfigValueChanged += new ConfigOption <string> .ValueChanged(_configOptionChanged);

            optColorDepth.ConfigValueChanged += new ConfigOption <string> .ValueChanged(_configOptionChanged);

            optRTTMode.ConfigValueChanged += new ConfigOption <string> .ValueChanged(_configOptionChanged);

            ConfigOptions.Add(optVideoMode);
            ConfigOptions.Add(optColorDepth);
            ConfigOptions.Add(optDisplayFrequency);
            ConfigOptions.Add(optFullScreen);
            ConfigOptions.Add(optFSAA);
            ConfigOptions.Add(optVSync);
            ConfigOptions.Add(optRTTMode);

            _refreshConfig();
        }