From 8010fb3d87a9628e4c7a2382bf65df3d02ecd026 Mon Sep 17 00:00:00 2001 From: Martin Felis Date: Fri, 7 Jul 2023 17:20:07 +0200 Subject: [PATCH] Generation Textures now shown optionally. --- scenes/Game.tscn | 29 +++++++++++++++++++---------- ui/WorldGeneratorUI.gd | 7 +++++++ 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/scenes/Game.tscn b/scenes/Game.tscn index 30daee2..e214092 100644 --- a/scenes/Game.tscn +++ b/scenes/Game.tscn @@ -248,11 +248,11 @@ margin_bottom = 258.0 script = ExtResource( 12 ) [node name="HBoxContainer" type="HBoxContainer" parent="Generator Container/WorldGeneratorContainer"] -margin_right = 100.0 +margin_right = 135.0 margin_bottom = 16.0 [node name="WorldSizeSlider" type="HSlider" parent="Generator Container/WorldGeneratorContainer/HBoxContainer"] -margin_right = 88.0 +margin_right = 123.0 margin_bottom = 16.0 size_flags_horizontal = 3 min_value = 1.0 @@ -260,9 +260,9 @@ max_value = 512.0 value = 1.0 [node name="WorldSizeLabel" type="Label" parent="Generator Container/WorldGeneratorContainer/HBoxContainer"] -margin_left = 92.0 +margin_left = 127.0 margin_top = 1.0 -margin_right = 100.0 +margin_right = 135.0 margin_bottom = 15.0 text = "4" @@ -272,18 +272,26 @@ margin_right = 100.0 margin_bottom = 40.0 text = "Generate" -[node name="WorldTextureRect" type="TextureRect" parent="Generator Container/WorldGeneratorContainer"] +[node name="ShowTexturesCheckButton" type="CheckButton" parent="Generator Container/WorldGeneratorContainer"] margin_top = 44.0 -margin_right = 100.0 -margin_bottom = 144.0 +margin_right = 135.0 +margin_bottom = 84.0 +text = "Textures" + +[node name="WorldTextureRect" type="TextureRect" parent="Generator Container/WorldGeneratorContainer"] +visible = false +margin_top = 88.0 +margin_right = 135.0 +margin_bottom = 188.0 rect_min_size = Vector2( 100, 100 ) stretch_mode = 1 flip_v = true [node name="HeightTextureRect" type="TextureRect" parent="Generator Container/WorldGeneratorContainer"] -margin_top = 148.0 -margin_right = 100.0 -margin_bottom = 248.0 +visible = false +margin_top = 88.0 +margin_right = 135.0 +margin_bottom = 188.0 rect_min_size = Vector2( 100, 100 ) stretch_mode = 1 flip_v = true @@ -372,5 +380,6 @@ transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 1.79762, 0, 0 ) input_ray_pickable = false [connection signal="value_changed" from="Generator Container/WorldGeneratorContainer/HBoxContainer/WorldSizeSlider" to="Generator Container/WorldGeneratorContainer" method="_on_HSlider_value_changed"] +[connection signal="toggled" from="Generator Container/WorldGeneratorContainer/ShowTexturesCheckButton" to="Generator Container/WorldGeneratorContainer" method="_on_ShowTexturesCheckButton_toggled"] [editable path="Entities/Chest"] diff --git a/ui/WorldGeneratorUI.gd b/ui/WorldGeneratorUI.gd index faa2c86..2c2da67 100644 --- a/ui/WorldGeneratorUI.gd +++ b/ui/WorldGeneratorUI.gd @@ -3,6 +3,9 @@ extends VBoxContainer var world_size_label = null var world_size_slider = null +onready var WorldTextureRect = $WorldTextureRect +onready var HeightTextureRect = $HeightTextureRect + # Called when the node enters the scene tree for the first time. func _ready(): world_size_label = find_node("WorldSizeLabel") @@ -12,3 +15,7 @@ func _ready(): func _on_HSlider_value_changed(value): world_size_label.text = str(value) + +func _on_ShowTexturesCheckButton_toggled(button_pressed): + WorldTextureRect.visible = button_pressed + HeightTextureRect.visible = button_pressed