예제 #1
0
        public void SetStyle(DmdStyle style, string dataPath)
        {
            _style            = style;
            _dmdShaderInvalid = true;
            _lutInvalid       = true;
            var glassTexturePath = GetAbsolutePath(_style.GlassTexture, dataPath);

            try {
                _glassToRender = glassTexturePath == null
                                        ? null
                                        : new System.Drawing.Bitmap(glassTexturePath);
            } catch (Exception e) {
                Logger.Warn(e, $"Could not load glass texture at \"{glassTexturePath}\".");
                _glassToRender = null;
            }

            var frameTexturePath = GetAbsolutePath(_style.FrameTexture, dataPath);

            try {
                if (frameTexturePath != null)
                {
                    var image = new BitmapImage(new Uri(frameTexturePath));
                    DmdFraming.Source     = image;
                    DmdFraming.Visibility = Visibility.Visible;
                }
            } catch (Exception e) {
                Logger.Warn(e, $"Could not load framing texture at \"{frameTexturePath}\".");
                DmdFraming.Source     = null;
                DmdFraming.Visibility = Visibility.Hidden;
            }

            OnSizeChanged(null, null);
        }
예제 #2
0
        private void LoadFromIniClicked(object sender, RoutedEventArgs e)
        {
            var previewStyle = _dmdConfig.GetStyle(NewStyleName);

            if (previewStyle != null)
            {
                _previewStyle = previewStyle;
                UpdateControls();
                UpdatePreview();
            }
        }
예제 #3
0
        public DmdSettings(DmdStyle style, Configuration config)
        {
            _config        = config;
            _originalStyle = style.Copy();
            _previewStyle  = _originalStyle.Copy();
            _dmdConfig     = _config?.VirtualDmd as VirtualDmdConfig;

            DataContext = this;
            InitializeComponent();

            if (_dmdConfig != null)
            {
                StyleNameComboBox.SelectedValue = _dmdConfig.StyleName;
            }

            UpdateControls();
            LoadPreview();

            // if there's no game name, don't use the split button for applying.
            if (_dmdConfig?.HasGameName == false)
            {
                ApplyButton.Visibility         = Visibility.Hidden;
                ApplyGloballyButton.Visibility = Visibility.Visible;
            }
            else
            {
                ApplyButton.Visibility         = Visibility.Visible;
                ApplyButton.Content            = $"Apply to \"{_dmdConfig.GameName}\"";
                ApplyGloballyButton.Visibility = Visibility.Hidden;
            }

            if (config == null)
            {
                SaveGroup.Visibility = Visibility.Collapsed;
            }

            DotSize.OnValueChanged.Subscribe(value => {
                _previewStyle.DotSize = value;
                UpdatePreview();
            });

            DotRounding.OnValueChanged.Subscribe(value => {
                _previewStyle.DotRounding = value;
                UpdatePreview();
            });

            DotSharpness.OnValueChanged.Subscribe(value => {
                _previewStyle.DotSharpness = value;
                UpdatePreview();
            });

            UnlitDotColor.SelectedColorChanged += (sender, e) => _previewStyle.UnlitDot = UnlitDotColor.SelectedColor.Value;
            UnlitDotColor.SelectedColorChanged += (sender, e) => UpdatePreview();

            DotGlow.OnValueChanged.Subscribe(value => {
                _previewStyle.DotGlow = value;
                UpdatePreview();
            });

            Brightness.OnValueChanged.Subscribe(value => {
                _previewStyle.Brightness = value;
                UpdatePreview();
            });

            BackLevel.OnValueChanged.Subscribe(value => {
                _previewStyle.BackGlow = value;
                UpdatePreview();
            });

            Gamma.OnValueChanged.Subscribe(value => {
                _previewStyle.Gamma = value;
                UpdatePreview();
            });

            TintAmount.OnValueChanged.Subscribe(value => {
                _previewStyle.Tint = Color.FromArgb((byte)(value * 255), TintColor.SelectedColor.Value.R, TintColor.SelectedColor.Value.G, TintColor.SelectedColor.Value.B);
                LoadPreview();
            });
            TintColor.SelectedColorChanged += (sender, e) => {
                _previewStyle.Tint = Color.FromArgb((byte)(TintAmount.Value * 255), TintColor.SelectedColor.Value.R, TintColor.SelectedColor.Value.G, TintColor.SelectedColor.Value.B);
                UpdatePreview();
            };

            GlassPath.TextChanged += (sender, e) => _previewStyle.GlassTexture = GlassPath.Text;
            GlassPath.TextChanged += (sender, e) => UpdatePreview();

            GlassDMDLightingSlider.ValueChanged += (sender, e) => GlassDMDLightingValue.Text = DoubleToString2(GlassDMDLightingSlider.Value);
            GlassDMDLightingValue.TextChanged   += (sender, e) => GlassDMDLightingSlider.Value = StringToDouble(GlassDMDLightingValue.Text, GlassDMDLightingSlider.Value);
            GlassDMDLightingSlider.ValueChanged += (sender, e) => _previewStyle.GlassLighting = GlassDMDLightingSlider.Value;
            GlassDMDLightingSlider.ValueChanged += (sender, e) => UpdatePreview();

            GlassColor.SelectedColorChanged += (sender, e) => _previewStyle.GlassColor = Color.FromArgb(255, GlassColor.SelectedColor.Value.R, GlassColor.SelectedColor.Value.G, GlassColor.SelectedColor.Value.B);
            GlassColor.SelectedColorChanged += (sender, e) => UpdatePreview();

            GlassPadding.OnPaddingChanged.Subscribe(padding => _previewStyle.GlassPadding = padding);
            GlassPadding.OnPaddingChanged.Subscribe(padding => UpdatePreview());

            FramePath.TextChanged += (sender, e) => _previewStyle.FrameTexture = FramePath.Text;
            FramePath.TextChanged += (sender, e) => UpdatePreview();
            FramePadding.OnPaddingChanged.Subscribe(padding => _previewStyle.FramePadding = padding);
            FramePadding.OnPaddingChanged.Subscribe(padding => UpdatePreview());

            PreviewMono32x8.Checked    += (sender, e) => LoadPreview();
            PreviewMono128x32.Checked  += (sender, e) => LoadPreview();
            PreviewColor128x32.Checked += (sender, e) => LoadPreview();
            PreviewMono128x16.Checked  += (sender, e) => LoadPreview();
            PreviewMono192x64.Checked  += (sender, e) => LoadPreview();
        }
예제 #4
0
 private void ResetClicked(object sender, RoutedEventArgs e)
 {
     _previewStyle = _originalStyle.Copy();
     UpdateControls();
     UpdatePreview();
 }