Ejemplo n.º 1
0
        protected virtual void InitAllResolutions()
        {
            ResolutionsKey.Clear();
            Resolutions.Clear();
            foreach (var item in Screen.resolutions)
            {
                string customKey = string.Format($"{item.width}x{item.height}");
                if (!ResolutionsKey.Contains(customKey))
                {
                    ResolutionsKey.Add(customKey);
                    Resolutions.Add(item);
                }
            }

            Resolutions.Sort((x, y) =>
            {
                if (x.width > y.width)
                {
                    return(-1);
                }
                else
                {
                    return(1);
                }
            });
        }
        /// <summary>
        ///  Updates the Resolutions list, and sets the heighest Resolution as the SelectedResolution
        /// </summary>
        private void UpdateResolutions(IReadOnlyList <IMediaEncodingProperties> videoEncodingProperties)
        {
            Resolutions.Clear();
            SelectedResolution = null;

            uint maxPixelheight = 0;

            foreach (VideoEncodingProperties videoProperties in videoEncodingProperties)
            {
                ResolutionWrapper resolutionWrapper = new ResolutionWrapper {
                    Text = videoProperties.Height + " x " + videoProperties.Width, VideoProperties = videoProperties
                };
                Resolutions.Add(resolutionWrapper);

                // select the heighest resolution
                if (maxPixelheight < videoProperties.Height)
                {
                    maxPixelheight     = videoProperties.Height;
                    SelectedResolution = resolutionWrapper;
                }
            }
        }
Ejemplo n.º 3
0
        public void FillData()
        {
            //engine setting
            uint width, height;

            Engine.Instance.Driver.GetDisplayMode(out width, out height);
            SVideoSetting videoSetting = Engine.Instance.VideoSetting;

            //
            DisplayModes.Clear();
            DisplayModes.Add(new DisplayMode()
            {
                WindowMode = true
            });
            _cbDisplayModes.SelectedIndex     = 0;
            _cbDisplayModes.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged);

            //
            Resolutions.Clear();
            Resolutions.Add(new Resolution()
            {
                Width = width, Height = height
            });

            _cbResolutions.SelectedIndex     = 0;
            _cbResolutions.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged);

            //

            RefreshRates.Default();
            _cbRefreshRates.SelectedIndex     = 0;
            _cbRefreshRates.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged);

            //
            VideoDevices.Clear();
            VideoDevices.Add(new VideoDevice()
            {
                Index = 0
            });

            _cbVideoDevices.SelectedIndex     = 0;
            _cbVideoDevices.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged);

            //
            MultiSamples.Default();
            _cbMultisamples.SelectedItem      = (from x in MultiSamples where x.Sample == videoSetting.antialias select x).ToArray()[0];
            _cbMultisamples.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged);

            //
            _cbVsyncs.SelectedItem      = (from x in VSyncs where x.On == videoSetting.vsync select x).ToArray()[0];
            _cbVsyncs.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged);

            //
            MatResolutions.Clear();
            MatResolutions.Add(new OptionLevel()
            {
                Level = E_LEVEL.EL_LOW
            });
            MatResolutions.Add(new OptionLevel()
            {
                Level = E_LEVEL.EL_FAIR
            });
            MatResolutions.Add(new OptionLevel()
            {
                Level = E_LEVEL.EL_GOOD
            });
            MatResolutions.Add(new OptionLevel()
            {
                Level = E_LEVEL.EL_HIGH
            });

            _cbMatResolutions.SelectedItem      = (from x in MatResolutions where x.Level == videoSetting.textureResolution select x).ToArray()[0];
            _cbMatResolutions.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged);

            //
            _cbMatTextureFilters.SelectedItem      = (from x in MatTextureFilters where x.Filter == videoSetting.textureFiltering select x).ToArray()[0];
            _cbMatTextureFilters.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged);

            //
            _cbMatProjections.SelectedItem      = (from x in MatProjections where x.On == false select x).ToArray()[0];
            _cbMatProjections.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged);

            //
            ViewDistances.Default();
            _cbViewDistances.SelectedItem      = (from x in ViewDistances where x.Level == videoSetting.viewDistance select x).ToArray()[0];
            _cbViewDistances.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged);

            EnvDetails.Default();
            _cbEnvDetails.SelectedItem      = (from x in EnvDetails where x.Level == videoSetting.envDetail select x).ToArray()[0];
            _cbEnvDetails.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged);

            GroundScenes.Default();
            _cbGroundScenes.SelectedItem      = (from x in GroundScenes where x.Level == videoSetting.groundClutter select x).ToArray()[0];
            _cbGroundScenes.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged);

            ShadowQualities.Default();
            _cbShadowQuality.SelectedItem      = (from x in ShadowQualities where x.Level == videoSetting.shadowQuality select x).ToArray()[0];
            _cbShadowQuality.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged);

            LiquidDetails.Clear();
            LiquidDetails.Add(new OptionLevel()
            {
                Level = E_LEVEL.EL_LOW
            });
            LiquidDetails.Add(new OptionLevel()
            {
                Level = E_LEVEL.EL_FAIR
            });
            LiquidDetails.Add(new OptionLevel()
            {
                Level = E_LEVEL.EL_GOOD
            });
            LiquidDetails.Add(new OptionLevel()
            {
                Level = E_LEVEL.EL_ULTRA
            });
            _cbLiquidDetail.SelectedItem      = (from x in LiquidDetails where x.Level == videoSetting.liquidDetail select x).ToArray()[0];
            _cbLiquidDetail.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged);

            SunLightEffects.Clear();
            SunLightEffects.Add(new OptionLevel()
            {
                Level = E_LEVEL.EL_DISABLE
            });
            SunLightEffects.Add(new OptionLevel()
            {
                Level = E_LEVEL.EL_LOW
            });
            SunLightEffects.Add(new OptionLevel()
            {
                Level = E_LEVEL.EL_HIGH
            });
            _cbSunLightEffect.SelectedItem      = (from x in SunLightEffects where x.Level == videoSetting.sunshafts select x).ToArray()[0];
            _cbSunLightEffect.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged);

            ParticleDensities.Default();
            _cbParticleDensity.SelectedItem      = (from x in ParticleDensities where x.Level == videoSetting.particleDensity select x).ToArray()[0];
            _cbParticleDensity.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged);

            SSAOLevels.Clear();
            SSAOLevels.Add(new OptionLevel()
            {
                Level = E_LEVEL.EL_DISABLE
            });
            SSAOLevels.Add(new OptionLevel()
            {
                Level = E_LEVEL.EL_LOW
            });
            SSAOLevels.Add(new OptionLevel()
            {
                Level = E_LEVEL.EL_HIGH
            });
            _cbSSAO.SelectedItem      = (from x in SSAOLevels where x.Level == videoSetting.SSAO select x).ToArray()[0];
            _cbSSAO.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged);
        }