Cleans up themes and adds styles

This update does the following:
1. Removes themes from children of control node
2. Sets the dark theme to control node (MenuScreen)
3. Defines 2 styles within the 2 themes (dark and light)

So to change the theme overall, for the control node, just load the needed theme, for example:

theme=load("res://assets/ui_controlNode_light_theme.tres")
This commit is contained in:
MacDugRPG 2022-02-27 14:44:55 -05:00
parent dc2fe54ba2
commit 6d7009893c
15 changed files with 174 additions and 21 deletions

View File

@ -0,0 +1,6 @@
[gd_resource type="Theme" load_steps=2 format=2]
[ext_resource path="res://assets/liberation_serif_20pt.tres" type="DynamicFont" id=1]
[resource]
default_font = ExtResource( 1 )

View File

@ -0,0 +1,6 @@
[gd_resource type="Theme" load_steps=2 format=2]
[ext_resource path="res://assets/liberation_serif_20pt.tres" type="DynamicFont" id=1]
[resource]
default_font = ExtResource( 1 )

View File

@ -0,0 +1,25 @@
[gd_resource type="Theme" load_steps=3 format=2]
[ext_resource path="res://assets/liberation_serif_30pt.tres" type="DynamicFont" id=1]
[sub_resource type="StyleBoxFlat" id=1]
bg_color = Color( 0, 0, 0, 1 )
border_width_left = 1
border_width_top = 1
border_width_right = 1
border_width_bottom = 1
border_color = Color( 1, 1, 1, 1 )
[resource]
default_font = ExtResource( 1 )
Button/colors/font_color = Color( 1, 1, 1, 1 )
Button/colors/font_color_disabled = Color( 0.9, 0.9, 0.9, 0.2 )
Button/colors/font_color_hover = Color( 0.94, 0.94, 0.94, 1 )
Button/colors/font_color_pressed = Color( 1, 1, 1, 1 )
Button/constants/hseparation = 2
Button/fonts/font = null
Button/styles/disabled = null
Button/styles/focus = null
Button/styles/hover = null
Button/styles/normal = SubResource( 1 )
Button/styles/pressed = null

View File

@ -0,0 +1,25 @@
[gd_resource type="Theme" load_steps=3 format=2]
[ext_resource path="res://assets/liberation_serif_30pt.tres" type="DynamicFont" id=1]
[sub_resource type="StyleBoxFlat" id=1]
bg_color = Color( 0, 0, 0, 1 )
border_width_left = 1
border_width_top = 1
border_width_right = 1
border_width_bottom = 1
border_color = Color( 1, 1, 1, 1 )
[resource]
default_font = ExtResource( 1 )
Button/colors/font_color = Color( 0.00392157, 0.00392157, 0.00392157, 1 )
Button/colors/font_color_disabled = Color( 0.9, 0.9, 0.9, 0.2 )
Button/colors/font_color_hover = Color( 0.94, 0.94, 0.94, 1 )
Button/colors/font_color_pressed = Color( 1, 1, 1, 1 )
Button/constants/hseparation = 2
Button/fonts/font = null
Button/styles/disabled = null
Button/styles/focus = null
Button/styles/hover = null
Button/styles/normal = SubResource( 1 )
Button/styles/pressed = null

View File

@ -0,0 +1,6 @@
[gd_resource type="Theme" load_steps=2 format=2]
[ext_resource path="res://assets/liberation_serif_30pt.tres" type="DynamicFont" id=1]
[resource]
default_font = ExtResource( 1 )

View File

@ -0,0 +1,6 @@
[gd_resource type="Theme" load_steps=2 format=2]
[ext_resource path="res://assets/liberation_serif_40pt.tres" type="DynamicFont" id=1]
[resource]
default_font = ExtResource( 1 )

View File

@ -0,0 +1,8 @@
[gd_resource type="StyleBoxFlat" format=2]
[resource]
bg_color = Color( 0, 0, 0, 1 )
border_width_left = 1
border_width_top = 1
border_width_right = 1
border_width_bottom = 1

View File

@ -0,0 +1,9 @@
[gd_resource type="StyleBoxFlat" format=2]
[resource]
bg_color = Color( 1, 1, 1, 1 )
border_width_left = 1
border_width_top = 1
border_width_right = 1
border_width_bottom = 1
border_color = Color( 0, 0, 0, 1 )

View File

@ -0,0 +1,28 @@
[gd_resource type="Theme" load_steps=3 format=2]
[ext_resource path="res://assets/sbf_black.tres" type="StyleBox" id=1]
[ext_resource path="res://assets/liberation_serif_30pt.tres" type="DynamicFont" id=2]
[resource]
Button/colors/font_color = Color( 0.878431, 0.878431, 0.878431, 1 )
Button/colors/font_color_disabled = Color( 0.9, 0.9, 0.9, 0.2 )
Button/colors/font_color_hover = Color( 0.94, 0.94, 0.94, 1 )
Button/colors/font_color_pressed = Color( 1, 1, 1, 1 )
Button/constants/hseparation = 2
Button/fonts/font = ExtResource( 2 )
Button/styles/disabled = null
Button/styles/focus = null
Button/styles/hover = null
Button/styles/normal = ExtResource( 1 )
Button/styles/pressed = null
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( 1, 1, 1, 1 )
Label/constants/line_spacing = 3
Label/constants/shadow_as_outline = 0
Label/constants/shadow_offset_x = 1
Label/constants/shadow_offset_y = 1
Label/fonts/font = null
Label/styles/normal = null
Panel/styles/panel = ExtResource( 1 )
VBoxContainer/constants/separation = 4

View File

@ -0,0 +1,28 @@
[gd_resource type="Theme" load_steps=3 format=2]
[ext_resource path="res://assets/sbf_white.tres" type="StyleBox" id=1]
[ext_resource path="res://assets/liberation_serif_30pt.tres" type="DynamicFont" id=2]
[resource]
Button/colors/font_color = Color( 0, 0, 0, 1 )
Button/colors/font_color_disabled = Color( 0.9, 0.9, 0.9, 0.2 )
Button/colors/font_color_hover = Color( 0.94, 0.94, 0.94, 1 )
Button/colors/font_color_pressed = Color( 1, 1, 1, 1 )
Button/constants/hseparation = 2
Button/fonts/font = ExtResource( 2 )
Button/styles/disabled = null
Button/styles/focus = null
Button/styles/hover = null
Button/styles/normal = ExtResource( 1 )
Button/styles/pressed = null
Label/colors/font_color = Color( 0, 0, 0, 1 )
Label/colors/font_color_shadow = Color( 0, 0, 0, 0 )
Label/colors/font_outline_modulate = Color( 1, 1, 1, 1 )
Label/constants/line_spacing = 3
Label/constants/shadow_as_outline = 0
Label/constants/shadow_offset_x = 1
Label/constants/shadow_offset_y = 1
Label/fonts/font = null
Label/styles/normal = null
Panel/styles/panel = ExtResource( 1 )
VBoxContainer/constants/separation = 4

View File

@ -1,32 +1,24 @@
[gd_scene load_steps=8 format=2] [gd_scene load_steps=7 format=2]
[ext_resource path="res://UserInterface/But_ChangeScene.tscn" type="PackedScene" id=1] [ext_resource path="res://UserInterface/But_ChangeScene.tscn" type="PackedScene" id=1]
[ext_resource path="res://Screens/MenuScreen.gd" type="Script" id=2] [ext_resource path="res://Screens/MenuScreen.gd" type="Script" id=2]
[ext_resource path="res://assets/liberation_serif_40pt.tres" type="DynamicFont" id=3] [ext_resource path="res://assets/liberation_serif_40pt.tres" type="DynamicFont" id=3]
[ext_resource path="res://assets/ui_theme.tres" type="Theme" id=4]
[ext_resource path="res://UserInterface/Title.tscn" type="PackedScene" id=5] [ext_resource path="res://UserInterface/Title.tscn" type="PackedScene" id=5]
[ext_resource path="res://assets/Backgrounds/Background_black.png" type="Texture" id=6] [ext_resource path="res://assets/ui_controlNode_dark_theme.tres" type="Theme" id=6]
[ext_resource path="res://UserInterface/But_Quit.tscn" type="PackedScene" id=10] [ext_resource path="res://UserInterface/But_Quit.tscn" type="PackedScene" id=10]
[node name="MenuScreen" type="Control"] [node name="MenuScreen" type="Control"]
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
theme = ExtResource( 4 ) theme = ExtResource( 6 )
script = ExtResource( 2 ) script = ExtResource( 2 )
__meta__ = { __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
} }
[node name="Background" type="TextureRect" parent="."] [node name="Background" type="Panel" parent="."]
anchor_left = 0.5 anchor_right = 1.0
anchor_top = 0.5 anchor_bottom = 1.0
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -576.0
margin_top = -324.0
margin_right = 576.0
margin_bottom = 324.0
texture = ExtResource( 6 )
__meta__ = { __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
} }
@ -34,6 +26,7 @@ __meta__ = {
[node name="Title" parent="." instance=ExtResource( 5 )] [node name="Title" parent="." instance=ExtResource( 5 )]
margin_top = 51.8676 margin_top = 51.8676
margin_bottom = 117.868 margin_bottom = 117.868
theme = null
custom_fonts/font = ExtResource( 3 ) custom_fonts/font = ExtResource( 3 )
[node name="VBoxContainer" type="VBoxContainer" parent="."] [node name="VBoxContainer" type="VBoxContainer" parent="."]

View File

@ -0,0 +1,17 @@
extends Button
# Declare member variables here. Examples:
# var a: int = 2
# var b: String = "text"
var tempToggle = 0
func _on_Button_button_up():
var controlNode = get_node("../../")
print(controlNode.name)
if(tempToggle == 0):
controlNode.theme=load("res://assets/ui_controlNode_dark_theme.tres")
tempToggle = 1
else:
controlNode.theme=load("res://assets/ui_controlNode_light_theme.tres")
tempToggle = 0

View File

@ -7,7 +7,7 @@ extends Button
#Creates param usable in the UI; and the params next to export make it string and file browser #Creates param usable in the UI; and the params next to export make it string and file browser
export(String, FILE) var next_scene_path: = "" export(String, FILE) var next_scene_path: = ""
var tempToggle = 0
func _on_But_NewGame_button_up(): func _on_But_NewGame_button_up():
get_tree().change_scene(next_scene_path) get_tree().change_scene(next_scene_path)

View File

@ -1,13 +1,11 @@
[gd_scene load_steps=3 format=2] [gd_scene load_steps=2 format=2]
[ext_resource path="res://UserInterface/But_ChangeScene.gd" type="Script" id=1] [ext_resource path="res://UserInterface/But_ChangeScene.gd" type="Script" id=1]
[ext_resource path="res://assets/ui_highContrast_but_theme.tres" type="Theme" id=2]
[node name="But_ChangeScene" type="Button"] [node name="But_ChangeScene" type="Button"]
margin_right = 130.0 margin_right = 130.0
margin_bottom = 24.0 margin_bottom = 24.0
size_flags_vertical = 3 size_flags_vertical = 3
theme = ExtResource( 2 )
text = "New Game" text = "New Game"
script = ExtResource( 1 ) script = ExtResource( 1 )
__meta__ = { __meta__ = {

View File

@ -1,13 +1,11 @@
[gd_scene load_steps=3 format=2] [gd_scene load_steps=2 format=2]
[ext_resource path="res://UserInterface/But_Quit.gd" type="Script" id=1] [ext_resource path="res://UserInterface/But_Quit.gd" type="Script" id=1]
[ext_resource path="res://assets/ui_highContrast_but_theme.tres" type="Theme" id=2]
[node name="But_Quit" type="Button"] [node name="But_Quit" type="Button"]
margin_top = 240.0 margin_top = 240.0
margin_right = 179.0 margin_right = 179.0
margin_bottom = 284.0 margin_bottom = 284.0
theme = ExtResource( 2 )
text = "Quit" text = "Quit"
script = ExtResource( 1 ) script = ExtResource( 1 )
__meta__ = { __meta__ = {