Example #1
0
        /// <inheritdoc/>
        public void Load(ContentManager content)
        {
            Logger.Log("Applying GUI scale...");

            float renderScale = _config.GetValue <float>("renderScale", 0);

            if (renderScale == 0)
            {
                renderScale = (_plexgate.GetRenderScreenSize().Y / _plexgate.BackBufferHeight);
                _config.SetValue("renderScale", renderScale);
                _plexgate.RenderScale = renderScale;

                var screenScaleSetter = new Applications.ScreenScaleSetter(_winsys, (scale) =>
                {
                    _config.SetValue("renderScale", scale);
                    _config.SaveToDisk();
                    _plexgate.RenderScale = scale;
                    splash = (_plexgate.New <SplashEntity>());
                    MakeVisible();
                });
                screenScaleSetter.Show();
            }
            else
            {
                _plexgate.RenderScale = renderScale;
                splash = (_plexgate.New <SplashEntity>());
                MakeVisible();
            }
        }
Example #2
0
        /// <inheritdoc/>
        public GameSettings(WindowSystem _winsys) : base(_winsys)
        {
            Width  = 800;
            Height = 600;
            SetWindowStyle(WindowStyle.Dialog);
            Title               = "System settings";
            _resolutions        = new ListView();
            _resolutionScroller = new ScrollView();
            _resolutionScroller.AddChild(_resolutions);
            AddChild(_resolutionScroller);
            AddChild(_apply);
            AddChild(_cancel);
            _apply.Text    = "Apply";
            _cancel.Text   = "Cancel";
            _cancel.Click += (o, a) =>
            {
                Close();
            };
            _apply.Click += (o, a) =>
            {
                _config.SetValue("screenResolution", _resolutions.SelectedItem.Value.ToString());
                _config.SetValue("uiFullscreen", _gfxFullscreen.Checked);
                _config.SetValue("audioSfxVolume", _audioVolumeSlider.Value);
                _config.SetValue("uiIgnoreControlOpacity", _ignoreOpacity.Checked);
                _config.SetValue("windowManagerTranslucentWindowsWhileDragging", _fadingWindows.Checked);
                _config.SetValue("theme.fontsize", (PeacenetFontSize)_fontSizeList.SelectedItem.Tag);
                _config.Apply();
                Close();
            };

            AddChild(_configView);
            _configView.AddChild(_configPanel);

            _configPanel.AddChild(_graphics);
            _configPanel.AddChild(_audio);
            _configPanel.AddChild(_aboutHeader);

            _configPanel.AddChild(_audioVolumeSlider);
            _configPanel.AddChild(_audioVolume);

            _configPanel.AddChild(_ux);
            _configPanel.AddChild(_ignoreOpacity);
            _configPanel.AddChild(_fadingWindows);

            _configPanel.AddChild(_gfxFullscreen);
            _configPanel.AddChild(_gfxSetGuiScale);
            _configPanel.AddChild(_gfxGuiScale);

            _gfxGuiScale.AutoSize  = true;
            _gfxSetGuiScale.Text   = "Change GUI Scale";
            _gfxSetGuiScale.Click += (o, a) =>
            {
                var scalesettings = new ScreenScaleSetter(WindowSystem);
                scalesettings.Show();
            };

            if (_needsPopulate)
            {
                PopulateResolutions();
                _needsPopulate = false;
            }
            _configPanel.AddChild(_aboutText);

            var peacenetVersion = this.GetType().Assembly.GetName().Version;
            var engineVersion   = typeof(Plexgate).Assembly.GetName().Version;

            if (peacenetVersion != null)
            {
                _aboutText.Text += $"Peacenet - Version {peacenetVersion.Major}.{peacenetVersion.Minor} - Milestone {peacenetVersion.Build} build {peacenetVersion.Revision}.";
            }
            if (engineVersion != null)
            {
                _aboutText.Text += $"\nPeace Engine - Version {engineVersion.Major}.{engineVersion.Minor} - Milestone {engineVersion.Build} build {engineVersion.Revision}.";
            }
            _license.Text = "License";

            _configPanel.AddChild(_license);

            _license.Click += (o, a) =>
            {
                var gpl = new GPLInfo(WindowSystem);
                gpl.Show();
            };

            _fontSizeLabel.Text     = "Font size";
            _fontSizeLabel.AutoSize = true;

            _configPanel.AddChild(_fontSizeLabel);
            _configPanel.AddChild(_fontSizeList);
        }