UI Scale slider v1

This commit is contained in:
Matt Parker
2025-11-17 23:32:49 +10:00
parent 4263102a12
commit 7775f1100b
6 changed files with 67 additions and 20 deletions

View File

@@ -4,12 +4,12 @@ namespace SharpIDE.Godot.Features.Settings;
public partial class SettingsButton : Button
{
private Window _settingsWindow = null!;
private SettingsWindow _settingsWindow = null!;
public override void _Ready()
{
_settingsWindow = GetNode<Window>("%SettingsWindow");
_settingsWindow.CloseRequested += () => _settingsWindow.Hide();
_settingsWindow = GetNode<SettingsWindow>("%SettingsWindow");
_settingsWindow.Hide();
Pressed += OnPressed;
}

View File

@@ -1,7 +1,8 @@
[gd_scene load_steps=3 format=3 uid="uid://c6xurjdabssao"]
[gd_scene load_steps=4 format=3 uid="uid://c6xurjdabssao"]
[ext_resource type="Texture2D" uid="uid://ctwb5vyjuy5m1" path="res://Resources/settings.svg" id="1_0ups8"]
[ext_resource type="Script" uid="uid://cry5oglh3nyt1" path="res://Features/Settings/SettingsButton.cs" id="2_e87mh"]
[ext_resource type="PackedScene" uid="uid://dnh73b3speojs" path="res://Features/Settings/SettingsWindow.tscn" id="3_x07a0"]
[node name="SettingsButton" type="Button"]
size_flags_vertical = 4
@@ -9,14 +10,5 @@ icon = ExtResource("1_0ups8")
icon_alignment = 1
script = ExtResource("2_e87mh")
[node name="SettingsWindow" type="Window" parent="."]
[node name="SettingsWindow" parent="." instance=ExtResource("3_x07a0")]
unique_name_in_owner = true
oversampling_override = 1.0
title = "Settings"
initial_position = 2
size = Vector2i(845, 400)
visible = false
transient = true
exclusive = true
popup_window = true
popup_wm_hint = true

View File

@@ -0,0 +1,11 @@
using Godot;
namespace SharpIDE.Godot.Features.Settings;
public partial class SettingsWindow : Window
{
public override void _Ready()
{
CloseRequested += Hide;
}
}

View File

@@ -0,0 +1 @@
uid://b7umbl07avv6d

View File

@@ -0,0 +1,46 @@
[gd_scene load_steps=2 format=3 uid="uid://dnh73b3speojs"]
[ext_resource type="Script" uid="uid://b7umbl07avv6d" path="res://Features/Settings/SettingsWindow.cs" id="1_xkmyt"]
[node name="SettingsWindow" type="Window"]
oversampling_override = 1.0
title = "Settings"
initial_position = 2
size = Vector2i(845, 400)
transient = true
exclusive = true
popup_window = true
popup_wm_hint = true
script = ExtResource("1_xkmyt")
[node name="VBoxContainer" type="VBoxContainer" parent="."]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer"]
layout_mode = 2
[node name="Label" type="Label" parent="VBoxContainer/HBoxContainer"]
layout_mode = 2
text = "UI Scale"
[node name="HSlider" type="HSlider" parent="VBoxContainer/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 4
min_value = 0.5
max_value = 8.0
step = 0.1
value = 1.0
[node name="SpinBox" type="SpinBox" parent="VBoxContainer/HBoxContainer"]
layout_mode = 2
min_value = 0.5
max_value = 8.0
step = 0.1
value = 1.0
update_on_text_changed = true
custom_arrow_step = 0.1

View File

@@ -1,6 +1,7 @@
[gd_scene load_steps=2 format=3 uid="uid://b70jhun5a4las"]
[gd_scene load_steps=3 format=3 uid="uid://b70jhun5a4las"]
[ext_resource type="Script" uid="uid://bul4kkrg1yhqx" path="res://IdeWindow.cs" id="1_3do1e"]
[ext_resource type="PackedScene" uid="uid://dnh73b3speojs" path="res://Features/Settings/SettingsWindow.tscn" id="2_qq1cd"]
[node name="IdeWindow" type="Control"]
layout_mode = 3
@@ -11,9 +12,5 @@ grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_3do1e")
[node name="Window" type="Window" parent="."]
oversampling_override = 1.0
title = "Open Solution"
initial_position = 2
[node name="SettingsWindow" parent="." instance=ExtResource("2_qq1cd")]
visible = false
popup_window = true