From 1f74244acc64137949a763694ea81d1d78f3ff3e Mon Sep 17 00:00:00 2001 From: hobbesjaap Date: Sat, 19 Apr 2025 13:21:42 +0800 Subject: [PATCH] added an info screen and a settings screen --- godot/main_screen.gd | 21 ++++++++++++ godot/main_screen.tscn | 78 ++++++++++++++++++++++++++++++++++++++++-- godot/project.godot | 10 ++++++ 3 files changed, 107 insertions(+), 2 deletions(-) diff --git a/godot/main_screen.gd b/godot/main_screen.gd index 3d9d6ef..b1294d6 100644 --- a/godot/main_screen.gd +++ b/godot/main_screen.gd @@ -138,6 +138,8 @@ func _ready() -> void: $"Results".hide() $"EditScreen".hide() $"%UpdatePanel".hide() + $"SettingsMenu".hide() + $"AboutMenu".hide() state_changed_check() update_date() # set_language() @@ -324,8 +326,27 @@ func _on_test_menu_id_pressed(id: int) -> void: var _ignore = get_tree().reload_current_scene() if id == 1: get_tree().quit() + if id == 2: + $AboutMenu.show() + if id == 3: + $SettingsMenu.show() func _on_test_sound_pressed() -> void: $StartScreen/AudioPlay.stream = test_sound $StartScreen/AudioPlay.play() + + +func _input(event) -> void: + if event.is_action_pressed("Settings"): + $SettingsMenu.show() + if event.is_action_pressed("About"): + $AboutMenu.show() + + +func _on_close_about_menu_pressed() -> void: + $AboutMenu.hide() + + +func _on_close_settings_menu_pressed() -> void: + $SettingsMenu.hide() diff --git a/godot/main_screen.tscn b/godot/main_screen.tscn index f4bb36e..525ec47 100644 --- a/godot/main_screen.tscn +++ b/godot/main_screen.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=32 format=3 uid="uid://b1pk005at7x26"] +[gd_scene load_steps=33 format=3 uid="uid://b1pk005at7x26"] [ext_resource type="Theme" uid="uid://bki1nuccpiu3o" path="res://wb_theme.tres" id="1"] [ext_resource type="Script" uid="uid://rbmcgn3hetrs" path="res://main_screen.gd" id="2"] @@ -1186,6 +1186,13 @@ bg_color = Color(0.164706, 0.164706, 0.164706, 1) [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_musqq"] bg_color = Color(0.862745, 0.435294, 0.329412, 1) +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_sqqhh"] +bg_color = Color(0.94902, 0.94902, 0.937255, 1) +corner_radius_top_left = 20 +corner_radius_top_right = 20 +corner_radius_bottom_right = 20 +corner_radius_bottom_left = 20 + [node name="AppWindow" type="CanvasLayer"] script = ExtResource("2") @@ -1208,6 +1215,7 @@ unique_name_in_owner = true [node name="InstructionPanel" type="Panel" parent="StartScreen"] unique_name_in_owner = true +visible = false anchors_preset = 8 anchor_left = 0.5 anchor_top = 0.5 @@ -2481,11 +2489,75 @@ offset_bottom = 109.0 [node name="FileMenu" type="PopupMenu" parent="AppMenuBar"] title = "File" -item_count = 2 +item_count = 4 item_0/text = "Reset" item_0/id = 0 item_1/text = "Quit" item_1/id = 1 +item_2/text = "Info" +item_2/id = 2 +item_3/text = "Settings" +item_3/id = 3 + +[node name="SettingsMenu" type="CanvasLayer" parent="."] + +[node name="FadeOut" type="Panel" parent="SettingsMenu"] +offset_left = -1.0 +offset_top = -1.0 +offset_right = 1280.0 +offset_bottom = 720.0 + +[node name="SettingsPanel" type="Panel" parent="SettingsMenu"] +offset_left = 63.0 +offset_top = 81.0 +offset_right = 1218.0 +offset_bottom = 679.0 +theme_override_styles/panel = SubResource("StyleBoxFlat_sqqhh") + +[node name="CloseSettingsMenu" type="Button" parent="SettingsMenu"] +offset_left = 1190.0 +offset_top = 92.0 +offset_right = 1208.0 +offset_bottom = 123.0 +text = "X" + +[node name="AboutMenu" type="CanvasLayer" parent="."] +visible = false + +[node name="FadeOut" type="Panel" parent="AboutMenu"] +offset_left = -1.0 +offset_top = -1.0 +offset_right = 1280.0 +offset_bottom = 720.0 + +[node name="AboutPanel" type="Panel" parent="AboutMenu"] +offset_left = 63.0 +offset_top = 81.0 +offset_right = 1218.0 +offset_bottom = 679.0 +theme_override_styles/panel = SubResource("StyleBoxFlat_sqqhh") + +[node name="RichTextLabel" type="RichTextLabel" parent="AboutMenu"] +offset_left = 446.0 +offset_top = 303.0 +offset_right = 833.0 +offset_bottom = 357.0 +theme = ExtResource("1") +theme_override_font_sizes/normal_font_size = 24 +text = "Time Sampling Form" +horizontal_alignment = 1 + +[node name="MainIcon" type="Sprite2D" parent="AboutMenu"] +position = Vector2(640, 203) +scale = Vector2(0.2, 0.2) +texture = ExtResource("12") + +[node name="CloseAboutMenu" type="Button" parent="AboutMenu"] +offset_left = 1174.0 +offset_top = 89.0 +offset_right = 1205.0 +offset_bottom = 126.0 +text = "X" [connection signal="request_completed" from="HTTPRequest" to="." method="_on_HTTPRequest_request_completed"] [connection signal="request_completed" from="HTTPRequest2" to="." method="_on_HTTPRequest2_request_completed"] @@ -2519,3 +2591,5 @@ item_1/id = 1 [connection signal="pressed" from="Results/Panel/EditMenu/CancelEdit" to="." method="_on_cancel_edit_pressed"] [connection signal="pressed" from="Results/Panel/EditMenu/SaveEdit" to="." method="_on_save_edit_pressed"] [connection signal="id_pressed" from="AppMenuBar/FileMenu" to="." method="_on_test_menu_id_pressed"] +[connection signal="pressed" from="SettingsMenu/CloseSettingsMenu" to="." method="_on_close_settings_menu_pressed"] +[connection signal="pressed" from="AboutMenu/CloseAboutMenu" to="." method="_on_close_about_menu_pressed"] diff --git a/godot/project.godot b/godot/project.godot index 0122a63..e657b0f 100644 --- a/godot/project.godot +++ b/godot/project.godot @@ -70,6 +70,16 @@ BehaviourFive={ "events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":53,"key_label":0,"unicode":53,"location":0,"echo":false,"script":null) ] } +Settings={ +"deadzone": 0.2, +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"command_or_control_autoremap":true,"alt_pressed":false,"shift_pressed":false,"pressed":false,"keycode":0,"physical_keycode":44,"key_label":0,"unicode":44,"location":0,"echo":false,"script":null) +] +} +About={ +"deadzone": 0.2, +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"command_or_control_autoremap":true,"alt_pressed":false,"shift_pressed":false,"pressed":false,"keycode":0,"physical_keycode":73,"key_label":0,"unicode":105,"location":0,"echo":false,"script":null) +] +} [internationalization]