diff --git a/godot_ship/dark_theme.tres b/godot_ship/dark_theme.tres index 0071838..48e3dd2 100644 --- a/godot_ship/dark_theme.tres +++ b/godot_ship/dark_theme.tres @@ -1,13 +1,33 @@ -[gd_resource type="Theme" load_steps=3 format=2] +[gd_resource type="Theme" load_steps=6 format=2] + +[ext_resource path="res://assets/font/Minecraft.ttf" type="DynamicFontData" id=1] + +[sub_resource type="StyleBoxFlat" id=4] +bg_color = Color( 0.239216, 0.211765, 0.317647, 1 ) +corner_radius_top_left = 3 +corner_radius_top_right = 3 +corner_radius_bottom_right = 3 +corner_radius_bottom_left = 3 +shadow_size = 4 [sub_resource type="StyleBoxFlat" id=1] -bg_color = Color( 0.239216, 0.227451, 0.270588, 1 ) -corner_radius_top_left = 2 -corner_radius_top_right = 2 -corner_radius_bottom_right = 2 -corner_radius_bottom_left = 2 +bg_color = Color( 0.109804, 0.0862745, 0.172549, 1 ) +corner_radius_top_left = 3 +corner_radius_top_right = 3 +corner_radius_bottom_right = 3 +corner_radius_bottom_left = 3 +shadow_size = 3 + +[sub_resource type="DynamicFont" id=3] +outline_color = Color( 0, 0, 0, 1 ) +font_data = ExtResource( 1 ) [sub_resource type="DynamicFont" id=2] +outline_color = Color( 0, 0, 0, 1 ) +extra_spacing_top = 5 +extra_spacing_bottom = 3 +extra_spacing_char = 1 +font_data = ExtResource( 1 ) [resource] default_font = SubResource( 2 ) @@ -19,6 +39,26 @@ Button/constants/hseparation = 2 Button/fonts/font = null Button/styles/disabled = null Button/styles/focus = null -Button/styles/hover = null +Button/styles/hover = SubResource( 4 ) Button/styles/normal = SubResource( 1 ) Button/styles/pressed = null +Dialogs/constants/button_margin = 100 +Dialogs/constants/margin = 8 +Label/colors/font_color = Color( 1, 1, 1, 1 ) +Label/colors/font_color_shadow = Color( 0, 0, 0, 0 ) +Label/colors/font_outline_modulate = Color( 0, 0, 0, 1 ) +Label/constants/line_spacing = 3 +Label/constants/shadow_as_outline = 0 +Label/constants/shadow_offset_x = 0 +Label/constants/shadow_offset_y = 0 +Label/fonts/font = SubResource( 3 ) +Label/styles/normal = null +WindowDialog/colors/title_color = Color( 0.152941, 0.152941, 0.152941, 1 ) +WindowDialog/constants/close_h_ofs = 18 +WindowDialog/constants/close_v_ofs = 18 +WindowDialog/constants/scaleborder_size = 4 +WindowDialog/constants/title_height = 20 +WindowDialog/fonts/title_font = null +WindowDialog/icons/close = null +WindowDialog/icons/close_highlight = null +WindowDialog/styles/panel = null diff --git a/godot_ship/light_theme.tres b/godot_ship/light_theme.tres new file mode 100644 index 0000000..7946aed --- /dev/null +++ b/godot_ship/light_theme.tres @@ -0,0 +1,64 @@ +[gd_resource type="Theme" load_steps=6 format=2] + +[ext_resource path="res://assets/font/Minecraft.ttf" type="DynamicFontData" id=1] + +[sub_resource type="StyleBoxFlat" id=4] +bg_color = Color( 1, 1, 1, 1 ) +corner_radius_top_left = 3 +corner_radius_top_right = 3 +corner_radius_bottom_right = 3 +corner_radius_bottom_left = 3 +shadow_size = 4 + +[sub_resource type="StyleBoxFlat" id=1] +bg_color = Color( 0.847059, 0.921569, 0.964706, 1 ) +corner_radius_top_left = 3 +corner_radius_top_right = 3 +corner_radius_bottom_right = 3 +corner_radius_bottom_left = 3 +shadow_size = 3 + +[sub_resource type="DynamicFont" id=2] +outline_color = Color( 0, 0, 0, 1 ) +font_data = ExtResource( 1 ) + +[sub_resource type="DynamicFont" id=3] +outline_color = Color( 0, 0, 0, 1 ) +extra_spacing_top = 5 +extra_spacing_bottom = 3 +extra_spacing_char = 1 +font_data = ExtResource( 1 ) + +[resource] +default_font = SubResource( 3 ) +Button/colors/font_color = Color( 0.0784314, 0.0784314, 0.0784314, 1 ) +Button/colors/font_color_disabled = Color( 0.9, 0.9, 0.9, 0.2 ) +Button/colors/font_color_hover = Color( 0, 0, 0, 1 ) +Button/colors/font_color_pressed = Color( 0, 0, 0, 1 ) +Button/constants/hseparation = 2 +Button/fonts/font = null +Button/styles/disabled = null +Button/styles/focus = null +Button/styles/hover = SubResource( 4 ) +Button/styles/normal = SubResource( 1 ) +Button/styles/pressed = null +Dialogs/constants/button_margin = 100 +Dialogs/constants/margin = 8 +Label/colors/font_color = Color( 1, 1, 1, 1 ) +Label/colors/font_color_shadow = Color( 0, 0, 0, 0 ) +Label/colors/font_outline_modulate = Color( 0, 0, 0, 1 ) +Label/constants/line_spacing = 3 +Label/constants/shadow_as_outline = 0 +Label/constants/shadow_offset_x = 0 +Label/constants/shadow_offset_y = 0 +Label/fonts/font = SubResource( 2 ) +Label/styles/normal = null +WindowDialog/colors/title_color = Color( 0.152941, 0.152941, 0.152941, 1 ) +WindowDialog/constants/close_h_ofs = 18 +WindowDialog/constants/close_v_ofs = 18 +WindowDialog/constants/scaleborder_size = 4 +WindowDialog/constants/title_height = 20 +WindowDialog/fonts/title_font = null +WindowDialog/icons/close = null +WindowDialog/icons/close_highlight = null +WindowDialog/styles/panel = null diff --git a/godot_ship/scenes/Game/Game.tscn b/godot_ship/scenes/Game/Game.tscn index 5d4c5c9..5d8d8d9 100644 --- a/godot_ship/scenes/Game/Game.tscn +++ b/godot_ship/scenes/Game/Game.tscn @@ -16,16 +16,16 @@ anchor_left = 0.912 anchor_top = 0.932 anchor_right = 0.912 anchor_bottom = 0.932 -margin_left = -3.68005 -margin_top = -4.52002 -margin_right = 49.3199 -margin_bottom = 15.48 +margin_left = -37.68 +margin_top = -329.52 +margin_right = 50.32 +margin_bottom = -305.52 __meta__ = { "_edit_use_anchors_": false } [node name="Forfeit" type="Button" parent="Buttons"] -margin_right = 53.0 +margin_right = 88.0 margin_bottom = 20.0 text = "Forfeit" @@ -47,10 +47,11 @@ __meta__ = { } [node name="Button" type="Button" parent="."] -margin_left = 599.361 -margin_top = 2.97302 -margin_right = 636.361 -margin_bottom = 22.973 +visible = false +margin_left = 6.4668 +margin_top = 6.14783 +margin_right = 43.4668 +margin_bottom = 26.1478 text = "Win" [connection signal="pressed" from="Buttons/Forfeit" to="." method="_on_Forfeit_pressed"] diff --git a/godot_ship/scenes/Game/Setup.tscn b/godot_ship/scenes/Game/Setup.tscn index 42db1cd..fdda0b1 100644 --- a/godot_ship/scenes/Game/Setup.tscn +++ b/godot_ship/scenes/Game/Setup.tscn @@ -1,6 +1,7 @@ -[gd_scene load_steps=8 format=2] +[gd_scene load_steps=9 format=2] [ext_resource path="res://assets/game/board_blue.png" type="Texture" id=1] +[ext_resource path="res://dark_theme.tres" type="Theme" id=2] [ext_resource path="res://scenes/ships/3ShipB.tscn" type="PackedScene" id=4] [ext_resource path="res://scenes/ships/3shipA.tscn" type="PackedScene" id=5] [ext_resource path="res://scenes/ships/4Ship.tscn" type="PackedScene" id=6] @@ -15,6 +16,7 @@ anchor_bottom = 0.890237 margin_top = -0.445435 margin_bottom = 39.5145 mouse_filter = 2 +theme = ExtResource( 2 ) script = ExtResource( 10 ) __meta__ = { "_edit_use_anchors_": false @@ -70,20 +72,20 @@ contacts_reported = 1 contact_monitor = true [node name="Confirm Placement" type="Button" parent="."] -margin_left = 409.0 -margin_top = 331.0 -margin_right = 543.0 -margin_bottom = 351.0 +margin_left = 417.0 +margin_top = 316.0 +margin_right = 608.0 +margin_bottom = 340.0 text = "Confirm Placement" __meta__ = { "_edit_use_anchors_": false } [node name="Clear" type="Button" parent="."] -margin_left = 353.0 -margin_top = 331.0 -margin_right = 406.0 -margin_bottom = 351.0 +margin_left = 348.0 +margin_top = 316.0 +margin_right = 408.0 +margin_bottom = 340.0 text = "Clear" __meta__ = { "_edit_use_anchors_": false diff --git a/godot_ship/scenes/Options.tscn b/godot_ship/scenes/Options.tscn index 2ed6077..cd80f96 100644 --- a/godot_ship/scenes/Options.tscn +++ b/godot_ship/scenes/Options.tscn @@ -1,24 +1,52 @@ -[gd_scene load_steps=2 format=2] +[gd_scene load_steps=8 format=2] +[ext_resource path="res://assets/font/Minecraft.ttf" type="DynamicFontData" id=1] [ext_resource path="res://script/options/Options.gd" type="Script" id=2] +[ext_resource path="res://light_theme.tres" type="Theme" id=3] + +[sub_resource type="DynamicFont" id=1] +size = 44 +outline_size = 2 +outline_color = Color( 0, 0, 0, 1 ) +font_data = ExtResource( 1 ) + +[sub_resource type="DynamicFont" id=2] +outline_size = 1 +outline_color = Color( 0, 0, 0, 1 ) +font_data = ExtResource( 1 ) + +[sub_resource type="DynamicFont" id=3] +outline_size = 1 +outline_color = Color( 0, 0, 0, 1 ) +font_data = ExtResource( 1 ) + +[sub_resource type="DynamicFont" id=4] +outline_size = 1 +font_data = ExtResource( 1 ) [node name="Options" type="Control"] anchor_right = 1.0 anchor_bottom = 1.0 +theme = ExtResource( 3 ) script = ExtResource( 2 ) __meta__ = { "_edit_use_anchors_": false } -[node name="MenuLabel" type="RichTextLabel" parent="."] -margin_left = 294.0 -margin_top = 68.0 -margin_right = 346.0 -margin_bottom = 83.0 -custom_colors/default_color = Color( 0, 0, 0, 1 ) +[node name="Options Label" type="Label" parent="."] +anchor_left = 0.5 +anchor_right = 0.5 +margin_left = -82.0 +margin_top = 49.0 +margin_right = 82.0 +margin_bottom = 93.0 +custom_fonts/font = SubResource( 1 ) +custom_colors/font_color_shadow = Color( 0, 0, 0, 1 ) +custom_constants/shadow_offset_y = 8 text = "Options" +align = 2 +valign = 1 __meta__ = { -"_edit_lock_": true, "_edit_use_anchors_": false } @@ -36,11 +64,11 @@ __meta__ = { position = Vector2( 0, 8 ) [node name="Master Label" type="Label" parent="Sliders/Master Volume Setting"] -margin_left = -0.140289 -margin_top = -8.0 -margin_right = 63.8597 -margin_bottom = 8.0 -custom_colors/font_color = Color( 0, 0, 0, 1 ) +margin_left = -8.14029 +margin_top = -14.0 +margin_right = 57.8597 +margin_bottom = 10.0 +custom_fonts/font = SubResource( 2 ) text = "Volume:" align = 2 valign = 1 @@ -50,9 +78,9 @@ __meta__ = { [node name="Master Slider" type="HSlider" parent="Sliders/Master Volume Setting"] margin_left = 64.0 -margin_top = -8.0 +margin_top = -10.0 margin_right = 208.0 -margin_bottom = 8.0 +margin_bottom = 6.0 focus_neighbour_left = NodePath("../../../Back") focus_neighbour_top = NodePath("../../../Back") focus_neighbour_bottom = NodePath("../../Volume Setting/Volume Slider") @@ -61,6 +89,7 @@ focus_previous = NodePath("../../../Back") max_value = 1.0 step = 0.05 tick_count = 10 +ticks_on_borders = true __meta__ = { "_edit_use_anchors_": false } @@ -69,10 +98,11 @@ __meta__ = { position = Vector2( 0, 33 ) [node name="Music Label" type="Label" parent="Sliders/Music Volume Setting"] -margin_top = -8.0 -margin_right = 64.0 -margin_bottom = 8.0 -custom_colors/font_color = Color( 0, 0, 0, 1 ) +margin_left = -6.0 +margin_top = -13.0 +margin_right = 58.0 +margin_bottom = 11.0 +custom_fonts/font = SubResource( 3 ) text = "Music:" align = 2 valign = 1 @@ -81,10 +111,10 @@ __meta__ = { } [node name="Music Slider" type="HSlider" parent="Sliders/Music Volume Setting"] -margin_left = 64.0 -margin_top = -8.0 -margin_right = 208.0 -margin_bottom = 8.0 +margin_left = 64.25 +margin_top = -9.0 +margin_right = 208.25 +margin_bottom = 7.0 focus_neighbour_top = NodePath("../../SFX Setting/SFX Slider") focus_neighbour_bottom = NodePath("../../../Buttons/Dark") focus_next = NodePath("../../../Buttons/Dark") @@ -92,6 +122,7 @@ focus_previous = NodePath("../../SFX Setting/SFX Slider") max_value = 1.0 step = 0.05 tick_count = 10 +ticks_on_borders = true __meta__ = { "_edit_use_anchors_": false } @@ -99,10 +130,11 @@ __meta__ = { [node name="SFX Volume Setting" type="Node2D" parent="Sliders"] [node name="SFX Label" type="Label" parent="Sliders/SFX Volume Setting"] -margin_top = 48.0 -margin_right = 64.0 -margin_bottom = 64.0 -custom_colors/font_color = Color( 0, 0, 0, 1 ) +margin_left = -6.0 +margin_top = 46.0 +margin_right = 58.0 +margin_bottom = 70.0 +custom_fonts/font = SubResource( 4 ) text = "SFX:" align = 2 valign = 1 @@ -112,23 +144,27 @@ __meta__ = { [node name="SFX Slider" type="HSlider" parent="Sliders/SFX Volume Setting"] margin_left = 64.0 -margin_top = 48.0 +margin_top = 50.0 margin_right = 208.0 -margin_bottom = 64.0 +margin_bottom = 66.0 max_value = 1.0 step = 0.05 tick_count = 10 +ticks_on_borders = true __meta__ = { "_edit_use_anchors_": false } [node name="Buttons" type="HBoxContainer" parent="."] -margin_left = 216.0 -margin_top = 200.0 -margin_right = 424.0 -margin_bottom = 224.0 +anchor_left = 0.5 +anchor_top = 0.498036 +anchor_right = 0.5 +anchor_bottom = 0.498036 +margin_left = -102.0 +margin_top = 30.7071 +margin_right = 106.0 +margin_bottom = 54.7071 __meta__ = { -"_edit_lock_": true, "_edit_use_anchors_": false } @@ -157,8 +193,8 @@ text = "Dark Mode" [node name="Back" type="Button" parent="."] margin_left = 16.0 margin_top = 16.0 -margin_right = 28.0 -margin_bottom = 36.0 +margin_right = 83.0 +margin_bottom = 40.0 focus_neighbour_left = NodePath(".") focus_neighbour_top = NodePath(".") focus_neighbour_right = NodePath("../Sliders/SFX Setting/SFX Slider") @@ -167,7 +203,6 @@ focus_next = NodePath("../Sliders/SFX Setting/SFX Slider") focus_previous = NodePath(".") text = "Back" __meta__ = { -"_edit_lock_": true, "_edit_use_anchors_": false } diff --git a/godot_ship/scenes/Title Screen.tscn b/godot_ship/scenes/Title Screen.tscn index 9cc581c..2750f97 100644 --- a/godot_ship/scenes/Title Screen.tscn +++ b/godot_ship/scenes/Title Screen.tscn @@ -1,5 +1,6 @@ -[gd_scene load_steps=4 format=2] +[gd_scene load_steps=5 format=2] +[ext_resource path="res://light_theme.tres" type="Theme" id=1] [ext_resource path="res://script/title screen/Title Screen.gd" type="Script" id=2] [ext_resource path="res://assets/font/Minecraft.ttf" type="DynamicFontData" id=3] @@ -12,6 +13,7 @@ font_data = ExtResource( 3 ) [node name="Title Node" type="Control"] anchor_right = 1.0 anchor_bottom = 1.0 +theme = ExtResource( 1 ) script = ExtResource( 2 ) __meta__ = { "_edit_use_anchors_": false @@ -22,36 +24,36 @@ anchor_left = 0.5 anchor_top = 0.5 anchor_right = 0.5 anchor_bottom = 0.5 -margin_left = -68.077 -margin_top = 10.0 -margin_right = 68.077 -margin_bottom = 102.0 +margin_left = -80.0 +margin_top = 11.0 +margin_right = 80.0 +margin_bottom = 119.0 __meta__ = { "_edit_use_anchors_": false } [node name="Singleplayer" type="Button" parent="VBoxContainer"] -margin_right = 136.0 -margin_bottom = 20.0 +margin_right = 160.0 +margin_bottom = 24.0 focus_neighbour_top = NodePath("../Quit") text = "Single Player" [node name="Multiplayer" type="Button" parent="VBoxContainer"] -margin_top = 24.0 -margin_right = 136.0 -margin_bottom = 44.0 +margin_top = 28.0 +margin_right = 160.0 +margin_bottom = 52.0 text = "Multiplayer" [node name="Options" type="Button" parent="VBoxContainer"] -margin_top = 48.0 -margin_right = 136.0 -margin_bottom = 68.0 +margin_top = 56.0 +margin_right = 160.0 +margin_bottom = 80.0 text = "Options" [node name="Quit" type="Button" parent="VBoxContainer"] -margin_top = 72.0 -margin_right = 136.0 -margin_bottom = 92.0 +margin_top = 84.0 +margin_right = 160.0 +margin_bottom = 108.0 focus_neighbour_bottom = NodePath("../Singleplayer") text = "Quit" @@ -61,9 +63,9 @@ anchor_top = 0.5 anchor_right = 0.5 anchor_bottom = 0.5 margin_left = -157.0 -margin_top = -50.0 +margin_top = -59.0 margin_right = 157.0 -margin_bottom = -6.0 +margin_bottom = -15.0 size_flags_stretch_ratio = 0.0 custom_fonts/font = SubResource( 1 ) custom_colors/font_outline_modulate = Color( 0, 0, 0, 1 ) diff --git a/godot_ship/script/Main.gd b/godot_ship/script/Main.gd index a3d53f9..0820385 100644 --- a/godot_ship/script/Main.gd +++ b/godot_ship/script/Main.gd @@ -7,8 +7,10 @@ onready var Options = preload("res://scenes/Options.tscn" ) onready var Debug_Menu = preload("res://scenes/Debug Menu.tscn" ) # Themes -var lightmode = preload("res://assets/backgrounds/Background_Light.png"); -var darkmode = preload("res://assets/backgrounds/Background_Dark.png"); +var lightmode = preload("res://assets/backgrounds/Background_Light.png") +var darkmode = preload("res://assets/backgrounds/Background_Dark.png") +var light_theme = load("res://light_theme.tres") +var dark_theme = load("res://dark_theme.tres") #flags var power_saving = true @@ -104,5 +106,7 @@ func _on_title_request(): func _on_change_theme(theme): if theme == "light": get_node("Background").set_texture(lightmode) + self.set_theme(light_theme) elif theme == "dark": get_node("Background").set_texture(darkmode) + self.set_theme(dark_theme) diff --git a/godot_ship/script/game/Gameplay/Game.gd b/godot_ship/script/game/Gameplay/Game.gd index 9507d43..fe79fb2 100644 --- a/godot_ship/script/game/Gameplay/Game.gd +++ b/godot_ship/script/game/Gameplay/Game.gd @@ -5,6 +5,9 @@ class ShipData: var Length: int var Orientation: bool #vertical is true, (Trueship = vertical) (Falseship = horizontal) +var light_theme = load("res://light_theme.tres") +var dark_theme = load("res://dark_theme.tres") + # Preloaded assets, to be used later # TODO: Move Setup into the Player. It's just here, for now, so that it can be tested and the game doesn't appear broken onready var Setup = preload("res://scenes/Game/Setup.tscn") @@ -27,6 +30,7 @@ var hit = false # TODO: Multiplayer var is_multiplayer = false + # Called when the node enters the scene tree for the first time. func _ready(): # TODO: Move Setup into the Player. @@ -36,6 +40,12 @@ func _ready(): get_node("ConfirmationDialog").get_ok().text = "Yes" get_node("ConfirmationDialog").get_cancel().text = "No" + get_node("ConfirmationDialog").get_ok().rect_min_size.x = 100 + get_node("ConfirmationDialog").get_cancel().rect_min_size.x = 100 + + var _errno = 0; + _errno += OptionsController.connect("change_theme", self, "_on_change_theme") + _on_change_theme(OptionsController.get_theme()) # TODO: Move Setup into the Player. func game_setup(_ships): @@ -73,3 +83,9 @@ func _on_Button_button_down(): func _on_ConfirmationDialog_confirmed(): end() + +func _on_change_theme(theme): + if theme == "light": + get_node("Buttons").set_theme(light_theme) + elif theme == "dark": + get_node("Buttons").set_theme(dark_theme) diff --git a/godot_ship/script/game/Setup.gd b/godot_ship/script/game/Setup.gd index 4493c9f..e958ea7 100644 --- a/godot_ship/script/game/Setup.gd +++ b/godot_ship/script/game/Setup.gd @@ -6,6 +6,9 @@ onready var Ships = ["2Ship", "3ShipA", "3ShipB", "4Ship", "5Ship"] onready var Victory = preload("res://scenes/Game/Player.tscn") +var light_theme = load("res://light_theme.tres") +var dark_theme = load("res://dark_theme.tres") + class ShipData: var Position: Vector2 var Length: int @@ -15,7 +18,12 @@ class ShipData: func _ready(): # Moves the focus to this menu if find_next_valid_focus(): find_next_valid_focus().grab_focus() - + + get_node("PlaceShipDialog").get_ok().rect_min_size.x = 50 + + var _errno = 0; + _errno += OptionsController.connect("change_theme", self, "_on_change_theme") + _on_change_theme(OptionsController.get_theme()) func _on_Confirm_Placement_pressed(): # Make the button noise @@ -53,3 +61,9 @@ func _on_Clear_pressed(): for ship in Ships: get_node(ship).clear() pass # Replace with function body. + +func _on_change_theme(theme): + if theme == "light": + self.set_theme(light_theme) + elif theme == "dark": + self.set_theme(dark_theme) diff --git a/godot_ship/script/options/Options.gd b/godot_ship/script/options/Options.gd index d4e927b..378f334 100644 --- a/godot_ship/script/options/Options.gd +++ b/godot_ship/script/options/Options.gd @@ -5,6 +5,8 @@ onready var music_slider = find_node("Music Slider", true, true) onready var sound_slider = find_node("SFX Slider", true, true) onready var theme_buttons = find_node("Buttons", true, true).get_children() +var light_theme = load("res://light_theme.tres") +var dark_theme = load("res://dark_theme.tres") # Called when the node enters the scene tree for the first time. func _ready(): @@ -13,6 +15,10 @@ func _ready(): master_slider.value = db2linear(OptionsController.get_mas_volume()) music_slider.value = db2linear(OptionsController.get_mus_volume()) sound_slider.value = db2linear(OptionsController.get_sfx_volume()) + + var _errno = 0; + _errno += OptionsController.connect("change_theme", self, "_on_change_theme") + _on_change_theme(OptionsController.get_theme()) func _on_Button_pressed(): AudioBus.emit_signal("button_clicked") @@ -41,3 +47,9 @@ func _on_Light_pressed(): func _on_Dark_pressed(): AudioBus.emit_signal("button_clicked") OptionsController.set_theme("dark") + +func _on_change_theme(theme): + if theme == "light": + self.set_theme(light_theme) + elif theme == "dark": + self.set_theme(dark_theme) diff --git a/godot_ship/script/title screen/Title Screen.gd b/godot_ship/script/title screen/Title Screen.gd index af2512d..0f8308a 100644 --- a/godot_ship/script/title screen/Title Screen.gd +++ b/godot_ship/script/title screen/Title Screen.gd @@ -1,8 +1,14 @@ extends Control +var light_theme = load("res://light_theme.tres") +var dark_theme = load("res://dark_theme.tres") + # Called when the node enters the scene tree for the first time. func _ready(): $VBoxContainer/Singleplayer.grab_focus() + var _errno = 0; + _errno += OptionsController.connect("change_theme", self, "_on_change_theme") + _on_change_theme(OptionsController.get_theme()) func _on_Singleplayer_pressed(): AudioBus.emit_signal("button_clicked") @@ -23,3 +29,9 @@ func _on_Quit_pressed(): AudioBus.emit_signal("button_clicked") MessageBus.emit_signal("quit") queue_free() + +func _on_change_theme(theme): + if theme == "light": + self.set_theme(light_theme) + elif theme == "dark": + self.set_theme(dark_theme)