Skip to content

Commit

Permalink
Added the ability to hide the settings panel
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitriySalnikov committed Apr 1, 2024
1 parent 26ff684 commit 46afa42
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 40 deletions.
87 changes: 50 additions & 37 deletions examples_dd3d/DebugDrawDemoScene.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ _data = {
code = "shader_type spatial;
render_mode unshaded;

uniform sampler2D albedo_texture;
uniform sampler2D albedo_texture : source_color;

void fragment() {
ALBEDO = texture(albedo_texture,UV).rgb;
Expand Down Expand Up @@ -780,30 +780,42 @@ text = "GDScript example"
horizontal_alignment = 2
metadata/_edit_use_anchors_ = true

[node name="PanelContainer" type="PanelContainer" parent="Settings/HBox"]
[node name="VBox" type="VBoxContainer" parent="Settings/HBox"]
layout_mode = 2
alignment = 2

[node name="HideShowPanelButton" type="Button" parent="Settings/HBox/VBox"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 4
theme_override_font_sizes/font_size = 13
text = "Hide panel"

[node name="SettingsPanel" type="PanelContainer" parent="Settings/HBox/VBox"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 8
theme_override_styles/panel = SubResource("StyleBoxFlat_boyhr")

[node name="VBox" type="VBoxContainer" parent="Settings/HBox/PanelContainer"]
[node name="VBox" type="VBoxContainer" parent="Settings/HBox/VBox/SettingsPanel"]
layout_mode = 2
size_flags_horizontal = 3
alignment = 2

[node name="Label" type="Label" parent="Settings/HBox/PanelContainer/VBox"]
[node name="Label" type="Label" parent="Settings/HBox/VBox/SettingsPanel/VBox"]
layout_mode = 2
theme_override_colors/font_color = Color(0.792157, 0.792157, 0.792157, 1)
text = "Common:"

[node name="HBox3" type="HBoxContainer" parent="Settings/HBox/PanelContainer/VBox"]
[node name="HBox3" type="HBoxContainer" parent="Settings/HBox/VBox/SettingsPanel/VBox"]
layout_mode = 2

[node name="Label" type="Label" parent="Settings/HBox/PanelContainer/VBox/HBox3"]
[node name="Label" type="Label" parent="Settings/HBox/VBox/SettingsPanel/VBox/HBox3"]
layout_mode = 2
text = "Thickness "

[node name="ThicknessSlider" type="HSlider" parent="Settings/HBox/PanelContainer/VBox/HBox3"]
[node name="ThicknessSlider" type="HSlider" parent="Settings/HBox/VBox/SettingsPanel/VBox/HBox3"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
Expand All @@ -812,14 +824,14 @@ max_value = 0.5
step = 0.001
value = 0.05

[node name="HBox5" type="HBoxContainer" parent="Settings/HBox/PanelContainer/VBox"]
[node name="HBox5" type="HBoxContainer" parent="Settings/HBox/VBox/SettingsPanel/VBox"]
layout_mode = 2

[node name="Label" type="Label" parent="Settings/HBox/PanelContainer/VBox/HBox5"]
[node name="Label" type="Label" parent="Settings/HBox/VBox/SettingsPanel/VBox/HBox5"]
layout_mode = 2
text = "Frustum Scale"

[node name="FrustumScaleSlider" type="HSlider" parent="Settings/HBox/PanelContainer/VBox/HBox5"]
[node name="FrustumScaleSlider" type="HSlider" parent="Settings/HBox/VBox/SettingsPanel/VBox/HBox5"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
Expand All @@ -828,37 +840,37 @@ max_value = 1.0
step = 0.001
value = 0.5

[node name="UpdateInPhysics" type="CheckBox" parent="Settings/HBox/PanelContainer/VBox"]
[node name="UpdateInPhysics" type="CheckBox" parent="Settings/HBox/VBox/SettingsPanel/VBox"]
unique_name_in_owner = true
layout_mode = 2
text = "Update in physics (15 Ticks) *"

[node name="Label2" type="Label" parent="Settings/HBox/PanelContainer/VBox"]
[node name="Label2" type="Label" parent="Settings/HBox/VBox/SettingsPanel/VBox"]
layout_mode = 2
theme_override_colors/font_color = Color(0.792157, 0.792157, 0.792157, 1)
text = "FPS Graph:"

[node name="FPSEnabled" type="CheckBox" parent="Settings/HBox/PanelContainer/VBox"]
[node name="FPSEnabled" type="CheckBox" parent="Settings/HBox/VBox/SettingsPanel/VBox"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
button_pressed = true
text = "FPS Graph enabled"

[node name="FPSMS" type="CheckBox" parent="Settings/HBox/PanelContainer/VBox"]
[node name="FPSMS" type="CheckBox" parent="Settings/HBox/VBox/SettingsPanel/VBox"]
unique_name_in_owner = true
layout_mode = 2
button_pressed = true
text = "FPS Graph ms or FPS"

[node name="HBox" type="HBoxContainer" parent="Settings/HBox/PanelContainer/VBox"]
[node name="HBox" type="HBoxContainer" parent="Settings/HBox/VBox/SettingsPanel/VBox"]
layout_mode = 2

[node name="Label" type="Label" parent="Settings/HBox/PanelContainer/VBox/HBox"]
[node name="Label" type="Label" parent="Settings/HBox/VBox/SettingsPanel/VBox/HBox"]
layout_mode = 2
text = "Width "

[node name="WidthSlider" type="HSlider" parent="Settings/HBox/PanelContainer/VBox/HBox"]
[node name="WidthSlider" type="HSlider" parent="Settings/HBox/VBox/SettingsPanel/VBox/HBox"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
Expand All @@ -867,14 +879,14 @@ min_value = 50.0
max_value = 1000.0
value = 200.0

[node name="HBox2" type="HBoxContainer" parent="Settings/HBox/PanelContainer/VBox"]
[node name="HBox2" type="HBoxContainer" parent="Settings/HBox/VBox/SettingsPanel/VBox"]
layout_mode = 2

[node name="Label" type="Label" parent="Settings/HBox/PanelContainer/VBox/HBox2"]
[node name="Label" type="Label" parent="Settings/HBox/VBox/SettingsPanel/VBox/HBox2"]
layout_mode = 2
text = "BufferSize"

[node name="BufferSlider" type="HSlider" parent="Settings/HBox/PanelContainer/VBox/HBox2"]
[node name="BufferSlider" type="HSlider" parent="Settings/HBox/VBox/SettingsPanel/VBox/HBox2"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
Expand All @@ -883,46 +895,47 @@ min_value = 50.0
max_value = 1000.0
value = 128.0

[node name="Label3" type="Label" parent="Settings/HBox/PanelContainer/VBox"]
[node name="Label3" type="Label" parent="Settings/HBox/VBox/SettingsPanel/VBox"]
layout_mode = 2
theme_override_colors/font_color = Color(0.792157, 0.792157, 0.792157, 1)
text = "Misc:"

[node name="ShowStats" type="CheckBox" parent="Settings/HBox/PanelContainer/VBox"]
[node name="ShowStats" type="CheckBox" parent="Settings/HBox/VBox/SettingsPanel/VBox"]
unique_name_in_owner = true
layout_mode = 2
text = "Show debug stats"

[node name="HBox4" type="HBoxContainer" parent="Settings/HBox/PanelContainer/VBox"]
[node name="HBox4" type="HBoxContainer" parent="Settings/HBox/VBox/SettingsPanel/VBox"]
layout_mode = 2

[node name="DrawBoxes" type="CheckBox" parent="Settings/HBox/PanelContainer/VBox/HBox4"]
[node name="DrawBoxes" type="CheckBox" parent="Settings/HBox/VBox/SettingsPanel/VBox/HBox4"]
unique_name_in_owner = true
layout_mode = 2
text = "Draw an array of boxes"

[node name="Draw1MBoxes" type="CheckBox" parent="Settings/HBox/PanelContainer/VBox/HBox4"]
[node name="Draw1MBoxes" type="CheckBox" parent="Settings/HBox/VBox/SettingsPanel/VBox/HBox4"]
unique_name_in_owner = true
layout_mode = 2
tooltip_text = "Draw 1 Million boxes, otherwise 7500pcs."
text = "1M"

[node name="SwitchLang" type="Button" parent="Settings/HBox/PanelContainer/VBox"]
[node name="SwitchLang" type="Button" parent="Settings/HBox/VBox/SettingsPanel/VBox"]
unique_name_in_owner = true
layout_mode = 2
text = "Switch to C#"

[connection signal="pressed" from="MusicVisualizer/OpenFile" to="MusicVisualizer" method="_pressed"]
[connection signal="value_changed" from="MusicVisualizer/VBox/HBoxContainer/VolumeSlider" to="MusicVisualizer" method="_on_volume_slider_value_changed"]
[connection signal="toggled" from="MusicVisualizer/VBox/HBoxContainer/MuteMaster" to="MusicVisualizer" method="_on_mute_master_toggled"]
[connection signal="value_changed" from="Settings/HBox/PanelContainer/VBox/HBox3/ThicknessSlider" to="Settings" method="_on_thickness_slider_value_changed"]
[connection signal="value_changed" from="Settings/HBox/PanelContainer/VBox/HBox5/FrustumScaleSlider" to="Settings" method="_on_frustum_scale_slider_value_changed"]
[connection signal="toggled" from="Settings/HBox/PanelContainer/VBox/UpdateInPhysics" to="Settings" method="_on_update_in_physics_toggled"]
[connection signal="toggled" from="Settings/HBox/PanelContainer/VBox/FPSEnabled" to="Settings" method="_on_CheckBox_toggled"]
[connection signal="toggled" from="Settings/HBox/PanelContainer/VBox/FPSMS" to="Settings" method="_on_FPSMS_toggled"]
[connection signal="value_changed" from="Settings/HBox/PanelContainer/VBox/HBox/WidthSlider" to="Settings" method="_on_width_slider_value_changed"]
[connection signal="value_changed" from="Settings/HBox/PanelContainer/VBox/HBox2/BufferSlider" to="Settings" method="_on_buffer_slider_value_changed"]
[connection signal="toggled" from="Settings/HBox/PanelContainer/VBox/ShowStats" to="Settings" method="_on_show_stats_toggled"]
[connection signal="toggled" from="Settings/HBox/PanelContainer/VBox/HBox4/DrawBoxes" to="Settings" method="_on_draw_boxes_toggled"]
[connection signal="toggled" from="Settings/HBox/PanelContainer/VBox/HBox4/Draw1MBoxes" to="Settings" method="_on_draw_1m_boxes_toggled"]
[connection signal="pressed" from="Settings/HBox/PanelContainer/VBox/SwitchLang" to="Settings" method="_on_Button_pressed"]
[connection signal="pressed" from="Settings/HBox/VBox/HideShowPanelButton" to="Settings" method="_on_hide_show_panel_pressed"]
[connection signal="value_changed" from="Settings/HBox/VBox/SettingsPanel/VBox/HBox3/ThicknessSlider" to="Settings" method="_on_thickness_slider_value_changed"]
[connection signal="value_changed" from="Settings/HBox/VBox/SettingsPanel/VBox/HBox5/FrustumScaleSlider" to="Settings" method="_on_frustum_scale_slider_value_changed"]
[connection signal="toggled" from="Settings/HBox/VBox/SettingsPanel/VBox/UpdateInPhysics" to="Settings" method="_on_update_in_physics_toggled"]
[connection signal="toggled" from="Settings/HBox/VBox/SettingsPanel/VBox/FPSEnabled" to="Settings" method="_on_CheckBox_toggled"]
[connection signal="toggled" from="Settings/HBox/VBox/SettingsPanel/VBox/FPSMS" to="Settings" method="_on_FPSMS_toggled"]
[connection signal="value_changed" from="Settings/HBox/VBox/SettingsPanel/VBox/HBox/WidthSlider" to="Settings" method="_on_width_slider_value_changed"]
[connection signal="value_changed" from="Settings/HBox/VBox/SettingsPanel/VBox/HBox2/BufferSlider" to="Settings" method="_on_buffer_slider_value_changed"]
[connection signal="toggled" from="Settings/HBox/VBox/SettingsPanel/VBox/ShowStats" to="Settings" method="_on_show_stats_toggled"]
[connection signal="toggled" from="Settings/HBox/VBox/SettingsPanel/VBox/HBox4/DrawBoxes" to="Settings" method="_on_draw_boxes_toggled"]
[connection signal="toggled" from="Settings/HBox/VBox/SettingsPanel/VBox/HBox4/Draw1MBoxes" to="Settings" method="_on_draw_1m_boxes_toggled"]
[connection signal="pressed" from="Settings/HBox/VBox/SettingsPanel/VBox/SwitchLang" to="Settings" method="_on_Button_pressed"]
8 changes: 6 additions & 2 deletions examples_dd3d/demo_camera_movement.gd
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,19 @@ var rot_y := 0.0


func _ready():
rot_x = rotation.y
rot_y = rotation.x
reset_input_rotation()


func _unhandled_input(event) -> void:
if event is InputEventMouseButton:
btn_clicked = event.pressed


func reset_input_rotation():
rot_x = rotation.y
rot_y = rotation.x


func _input(event) -> void:
if btn_clicked:
if event is InputEventMouseMotion:
Expand Down
10 changes: 9 additions & 1 deletion examples_dd3d/demo_settings_panel.gd
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,15 @@ func _on_Button_pressed() -> void:
get_tree().call_deferred("change_scene_to_file", switch_to_scene)


func _on_hide_show_panel_pressed():
if %SettingsPanel.visible:
%SettingsPanel.hide()
%HideShowPanelButton.text = "Show panel"
else:
%SettingsPanel.show()
%HideShowPanelButton.text = "Hide panel"


func _on_width_slider_value_changed(value):
if not is_ready: return

Expand Down Expand Up @@ -101,4 +110,3 @@ func _on_draw_1m_boxes_toggled(toggled_on):
if get_parent().draw_array_of_boxes:
DebugDraw3D.clear_all()
get_parent().timer_cubes = 0

0 comments on commit 46afa42

Please sign in to comment.