mirror of
https://github.com/MaSzyna-EU07/StarterNG.git
synced 2026-09-01 11:29:19 +02:00
Settings design
This commit is contained in:
48
StarterNG/Views/Settings.axaml.cs
Normal file
48
StarterNG/Views/Settings.axaml.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
using System;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Primitives;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace StarterNG.Views;
|
||||
|
||||
public partial class Settings : UserControl
|
||||
{
|
||||
public Settings()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.AttachedToVisualTree += (_, _) =>
|
||||
{
|
||||
TextureResolutionSlider_OnValueChanged(null, null);
|
||||
CabTextureResolutionSlider_OnValueChanged(null, null);
|
||||
shaderResolutionSlider_OnValueChanged(null, null);
|
||||
};
|
||||
}
|
||||
|
||||
private void TextureResolutionSlider_OnValueChanged(object? sender, RangeBaseValueChangedEventArgs e)
|
||||
{
|
||||
if (texResolution is null || textureResolutionSlider is null)
|
||||
return;
|
||||
|
||||
int resolution = 1 << (int)textureResolutionSlider.Value;
|
||||
texResolution.Text = $"{resolution} px";
|
||||
}
|
||||
|
||||
private void CabTextureResolutionSlider_OnValueChanged(object? sender, RangeBaseValueChangedEventArgs e)
|
||||
{
|
||||
if (cabTexResolution is null || cabTextureResolutionSlider is null)
|
||||
return;
|
||||
|
||||
int resolution = 1 << (int)cabTextureResolutionSlider.Value;
|
||||
cabTexResolution.Text = $"{resolution} px";
|
||||
}
|
||||
|
||||
private void shaderResolutionSlider_OnValueChanged(object? sender, RangeBaseValueChangedEventArgs e)
|
||||
{
|
||||
if (shaderResolution is null || shaderResolutionSlider is null)
|
||||
return;
|
||||
|
||||
int resolution = 1 << (int)shaderResolutionSlider.Value;
|
||||
shaderResolution.Text = $"{resolution} px";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user