Skip to content

Commit

Permalink
refactor: create menu button and hero themes
Browse files Browse the repository at this point in the history
Rather than impling components with theme overwrites, we create some
themes to be more easily applied to one-off buttons/labels.
  • Loading branch information
russmatney committed Jan 22, 2024
1 parent cd4f2f1 commit fb307a6
Show file tree
Hide file tree
Showing 6 changed files with 146 additions and 33 deletions.
8 changes: 8 additions & 0 deletions addons/core/ui/HeroLabelStyle.tres
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[gd_resource type="Theme" load_steps=2 format=3 uid="uid://ckbpwodffr03"]

[ext_resource type="FontFile" uid="uid://b0w8s6hidvrrr" path="res://addons/core/assets/fonts/Born2bSportyV2.ttf" id="1_g5tfq"]

[resource]
RichTextLabel/colors/default_color = Color(0.0823529, 0.419608, 0.635294, 1)
RichTextLabel/font_sizes/normal_font_size = 128
RichTextLabel/fonts/normal_font = ExtResource("1_g5tfq")
62 changes: 52 additions & 10 deletions addons/core/ui/MenuButton.tscn
Original file line number Diff line number Diff line change
@@ -1,20 +1,62 @@
[gd_scene load_steps=4 format=3 uid="uid://b3ivyg8cxtuof"]
[gd_scene load_steps=7 format=3 uid="uid://b3ivyg8cxtuof"]

[ext_resource type="FontFile" uid="uid://b0w8s6hidvrrr" path="res://addons/core/assets/fonts/Born2bSportyV2.ttf" id="1"]

[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_a657c"]
bg_color = Color(0.74902, 0.298039, 0.133333, 1)
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_3n65y"]
content_margin_left = 8.0
content_margin_top = 2.0
content_margin_right = 8.0
content_margin_bottom = 2.0
bg_color = Color(0.619608, 0.235294, 0.0941176, 1)
corner_radius_top_left = 4
corner_radius_top_right = 4
corner_radius_bottom_right = 4
corner_radius_bottom_left = 4

[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_74t6f"]
bg_color = Color(0.617747, 0.235822, 0.0945145, 1)
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_th2ko"]
content_margin_left = 8.0
content_margin_top = 2.0
content_margin_right = 8.0
content_margin_bottom = 2.0
bg_color = Color(0.619608, 0.235294, 0.0941176, 1)
corner_radius_top_left = 4
corner_radius_top_right = 4
corner_radius_bottom_right = 4
corner_radius_bottom_left = 4

[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_7qgli"]
content_margin_left = 8.0
content_margin_top = 2.0
content_margin_right = 8.0
content_margin_bottom = 2.0
bg_color = Color(0.0823529, 0.419608, 0.635294, 1)
corner_radius_top_left = 4
corner_radius_top_right = 4
corner_radius_bottom_right = 4
corner_radius_bottom_left = 4

[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_tjbed"]
content_margin_left = 8.0
content_margin_top = 2.0
content_margin_right = 8.0
content_margin_bottom = 2.0
bg_color = Color(0.619608, 0.235294, 0.0941176, 1)
corner_radius_top_left = 4
corner_radius_top_right = 4
corner_radius_bottom_right = 4
corner_radius_bottom_left = 4

[sub_resource type="Theme" id="Theme_gsvm3"]
Button/font_sizes/font_size = 32
Button/fonts/font = ExtResource("1")
Button/styles/focus = SubResource("StyleBoxFlat_3n65y")
Button/styles/hover = SubResource("StyleBoxFlat_th2ko")
Button/styles/normal = SubResource("StyleBoxFlat_7qgli")
Button/styles/pressed = SubResource("StyleBoxFlat_tjbed")

[node name="Button" type="Button"]
custom_minimum_size = Vector2(60, 0)
offset_right = 58.0
offset_bottom = 20.0
theme_override_fonts/font = ExtResource("1")
theme_override_font_sizes/font_size = 32
theme_override_styles/hover = SubResource("StyleBoxFlat_a657c")
theme_override_styles/pressed = SubResource("StyleBoxFlat_a657c")
theme_override_styles/focus = SubResource("StyleBoxFlat_74t6f")
theme = SubResource("Theme_gsvm3")
text = "Level 1"
55 changes: 55 additions & 0 deletions addons/core/ui/MenuButtonStyle.tres
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
[gd_resource type="Theme" load_steps=6 format=3 uid="uid://dn5bl1q612dpj"]

[ext_resource type="FontFile" uid="uid://b0w8s6hidvrrr" path="res://addons/core/assets/fonts/Born2bSportyV2.ttf" id="1_fr6gb"]

[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_3n65y"]
content_margin_left = 8.0
content_margin_top = 2.0
content_margin_right = 8.0
content_margin_bottom = 2.0
bg_color = Color(0.619608, 0.235294, 0.0941176, 1)
corner_radius_top_left = 4
corner_radius_top_right = 4
corner_radius_bottom_right = 4
corner_radius_bottom_left = 4

[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_th2ko"]
content_margin_left = 8.0
content_margin_top = 2.0
content_margin_right = 8.0
content_margin_bottom = 2.0
bg_color = Color(0.619608, 0.235294, 0.0941176, 1)
corner_radius_top_left = 4
corner_radius_top_right = 4
corner_radius_bottom_right = 4
corner_radius_bottom_left = 4

[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_7qgli"]
content_margin_left = 8.0
content_margin_top = 2.0
content_margin_right = 8.0
content_margin_bottom = 2.0
bg_color = Color(0.0823529, 0.419608, 0.635294, 1)
corner_radius_top_left = 4
corner_radius_top_right = 4
corner_radius_bottom_right = 4
corner_radius_bottom_left = 4

[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_tjbed"]
content_margin_left = 8.0
content_margin_top = 2.0
content_margin_right = 8.0
content_margin_bottom = 2.0
bg_color = Color(0.619608, 0.235294, 0.0941176, 1)
corner_radius_top_left = 4
corner_radius_top_right = 4
corner_radius_bottom_right = 4
corner_radius_bottom_left = 4

[resource]
Button/font_sizes/font_size = 32
Button/fonts/font = ExtResource("1_fr6gb")
Button/styles/focus = SubResource("StyleBoxFlat_3n65y")
Button/styles/hover = SubResource("StyleBoxFlat_th2ko")
Button/styles/normal = SubResource("StyleBoxFlat_7qgli")
Button/styles/pressed = SubResource("StyleBoxFlat_tjbed")
1 change: 1 addition & 0 deletions src/menus/ActionInputIcon.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
[ext_resource type="Script" path="res://src/menus/ActionInputIcon.gd" id="2_lnakd"]

[node name="ActionInputIcon" type="RichTextLabel"]
visible = false
clip_contents = false
custom_minimum_size = Vector2(30, 0)
offset_right = 30.0
Expand Down
47 changes: 28 additions & 19 deletions src/menus/ControlsPanel.tscn
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
[gd_scene load_steps=5 format=3 uid="uid://cq5r4oojxyu5a"]
[gd_scene load_steps=6 format=3 uid="uid://cq5r4oojxyu5a"]

[ext_resource type="Script" path="res://src/menus/ControlsPanel.gd" id="1_j8soe"]
[ext_resource type="FontFile" uid="uid://d06oxhmw5eq58" path="res://addons/core/assets/fonts/vexed/Arcade_Cabinet.ttf" id="2_s8vdu"]
[ext_resource type="Theme" uid="uid://ckbpwodffr03" path="res://addons/core/ui/HeroLabelStyle.tres" id="2_qkmov"]
[ext_resource type="PackedScene" uid="uid://cpxj4aeuv006l" path="res://addons/dj/MuteButtonList.tscn" id="3_88sjl"]
[ext_resource type="Theme" uid="uid://dn5bl1q612dpj" path="res://addons/core/ui/MenuButtonStyle.tres" id="4_b8l8d"]

[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_6sn6c"]
bg_color = Color(0.94902, 0.811765, 0.615686, 1)
Expand All @@ -29,49 +30,57 @@ layout_mode = 2
[node name="RichTextLabel" type="RichTextLabel" parent="PanelContainer/VBoxContainer/CenterContainer"]
custom_minimum_size = Vector2(500, 0)
layout_mode = 2
theme_override_colors/default_color = Color(0, 0, 0, 1)
theme_override_fonts/normal_font = ExtResource("2_s8vdu")
theme_override_font_sizes/normal_font_size = 64
theme = ExtResource("2_qkmov")
bbcode_enabled = true
text = "[center]Controls[/center]"
text = "[center]Options[/center]"
fit_content = true
scroll_active = false

[node name="CenterContainer2" type="CenterContainer" parent="PanelContainer/VBoxContainer"]
custom_minimum_size = Vector2(0, 100)
[node name="HBoxContainer" type="HBoxContainer" parent="PanelContainer/VBoxContainer"]
layout_mode = 2
size_flags_vertical = 3
alignment = 1

[node name="VBoxContainer" type="VBoxContainer" parent="PanelContainer/VBoxContainer/CenterContainer2"]
[node name="CenterContainer2" type="CenterContainer" parent="PanelContainer/VBoxContainer/HBoxContainer"]
custom_minimum_size = Vector2(0, 100)
layout_mode = 2
size_flags_horizontal = 3

[node name="ResetButton" type="Button" parent="PanelContainer/VBoxContainer/CenterContainer2/VBoxContainer"]
unique_name_in_owner = true
custom_minimum_size = Vector2(200, 0)
[node name="VBoxContainer" type="VBoxContainer" parent="PanelContainer/VBoxContainer/HBoxContainer/CenterContainer2"]
layout_mode = 2
text = "Reset All"

[node name="MainMenuButton" type="Button" parent="PanelContainer/VBoxContainer/CenterContainer2/VBoxContainer"]
[node name="MainMenuButton" type="Button" parent="PanelContainer/VBoxContainer/HBoxContainer/CenterContainer2/VBoxContainer"]
unique_name_in_owner = true
custom_minimum_size = Vector2(200, 0)
layout_mode = 2
theme = ExtResource("4_b8l8d")
text = "Main Menu"

[node name="WorldMapButton" type="Button" parent="PanelContainer/VBoxContainer/CenterContainer2/VBoxContainer"]
[node name="WorldMapButton" type="Button" parent="PanelContainer/VBoxContainer/HBoxContainer/CenterContainer2/VBoxContainer"]
unique_name_in_owner = true
custom_minimum_size = Vector2(200, 0)
layout_mode = 2
theme = ExtResource("4_b8l8d")
text = "World Map"

[node name="MuteButtonList" parent="PanelContainer/VBoxContainer/CenterContainer2/VBoxContainer" instance=ExtResource("3_88sjl")]
[node name="MuteButtonList" parent="PanelContainer/VBoxContainer/HBoxContainer/CenterContainer2/VBoxContainer" instance=ExtResource("3_88sjl")]
layout_mode = 2

[node name="ScrollContainer" type="ScrollContainer" parent="PanelContainer/VBoxContainer"]
[node name="ResetButton" type="Button" parent="PanelContainer/VBoxContainer/HBoxContainer/CenterContainer2/VBoxContainer"]
unique_name_in_owner = true
custom_minimum_size = Vector2(200, 0)
layout_mode = 2
size_flags_vertical = 3
theme = ExtResource("4_b8l8d")
text = "Reset Controls"

[node name="ScrollContainer" type="ScrollContainer" parent="PanelContainer/VBoxContainer/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
follow_focus = true

[node name="EditActionRows" type="VBoxContainer" parent="PanelContainer/VBoxContainer/ScrollContainer"]
[node name="EditActionRows" type="VBoxContainer" parent="PanelContainer/VBoxContainer/HBoxContainer/ScrollContainer"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
alignment = 1
6 changes: 2 additions & 4 deletions src/menus/WorldMap.tscn
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[gd_scene load_steps=6 format=3 uid="uid://bri7j48xu7ujk"]

[ext_resource type="Script" path="res://src/menus/WorldMap.gd" id="1_hw6qs"]
[ext_resource type="FontFile" uid="uid://d06oxhmw5eq58" path="res://addons/core/assets/fonts/vexed/Arcade_Cabinet.ttf" id="2_n1bpl"]
[ext_resource type="Theme" uid="uid://ckbpwodffr03" path="res://addons/core/ui/HeroLabelStyle.tres" id="2_hqo3t"]
[ext_resource type="Script" path="res://src/menus/WorldList.gd" id="3_sgxgd"]
[ext_resource type="Script" path="res://src/menus/WorldMapOptionsList.gd" id="4_d7s3e"]

Expand Down Expand Up @@ -31,9 +31,7 @@ size_flags_vertical = 3
[node name="RichTextLabel" type="RichTextLabel" parent="PanelContainer/VBoxContainer"]
layout_mode = 2
size_flags_vertical = 3
theme_override_colors/default_color = Color(0.560784, 0.364706, 0.517647, 1)
theme_override_fonts/normal_font = ExtResource("2_n1bpl")
theme_override_font_sizes/normal_font_size = 64
theme = ExtResource("2_hqo3t")
bbcode_enabled = true
text = "[center]World Map[/center]"
fit_content = true
Expand Down

0 comments on commit fb307a6

Please sign in to comment.