Inventory management focused game written in Godot / C#
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
879 B

public partial class ControlsMenu : MarginContainer
{
[Export] public Label DisplayX { get; set; }
[Export] public Label DisplayY { get; set; }
[Export] public HSlider SliderX { get; set; }
[Export] public HSlider SliderY { get; set; }
[Export] public CheckButton InvertX { get; set; }
[Export] public CheckButton InvertY { get; set; }
public override void _Ready()
{
SliderX.ValueChanged += _ => OnValueChanged();
SliderY.ValueChanged += _ => OnValueChanged();
InvertX.Toggled += _ => OnValueChanged();
InvertY.Toggled += _ => OnValueChanged();
}
void OnValueChanged()
{
DisplayX.Text = $"{SliderX.Value:0.00}";
DisplayY.Text = $"{SliderY.Value:0.00}";
Game.LocalPlayer.Camera.MouseSensitivity = new(
(float)SliderX.Value * (InvertX.ButtonPressed ? -1 : 1),
(float)SliderY.Value * (InvertY.ButtonPressed ? -1 : 1));
// TODO: Do a saving.
}
}