basic setup

This commit is contained in:
Clevertop 2024-09-24 10:34:17 +10:00
parent 57c4b27db5
commit 8653ab0d2b
11 changed files with 305 additions and 15 deletions

58
widgets/header.gd Normal file
View file

@ -0,0 +1,58 @@
@tool
extends PanelContainer
#class_name
#Authored by Tom. Please consult for any modifications or major feature requests.
#region Variables
#Signals
#Enums
#Constants
#Exported Variables
#@export_group("Group")
#@export_subgroup("Subgroup")
@export var title : String:
set(value) :
title = value
title_node.text = title
@export var subtitle : String:
set(value) :
subtitle = value
subtitle_node.text = subtitle
subtitle_node.visible = subtitle_node.text != ""
@export_group("Node References")
@export var title_node : Label
@export var subtitle_node : Label
#Onready Variables
#Other Variables (please try to separate and organise!)
#endregion
#region Godot methods
func _ready():
#Runs when all children have entered the tree
pass
func _process(delta):
#Runs per frame
pass
#endregion
#region Signal methods
#endregion
#region Other methods (please try to separate and organise!)
#func set_title(text : String):
#title = text
#title_node.text = title
#
#func set_subtitle(text : String):
#subtitle = text
#subtitle_node.text = title
#subtitle_node.visible = subtitle_node.text != ""
#endregion

40
widgets/header.tscn Normal file
View file

@ -0,0 +1,40 @@
[gd_scene load_steps=6 format=3 uid="uid://b3hn5sbsngqud"]
[ext_resource type="Script" path="res://widgets/header.gd" id="1_h4khk"]
[sub_resource type="Gradient" id="Gradient_o7xwa"]
colors = PackedColorArray(0.46429, 0.00206019, 0.726487, 1, 0.305082, 0.490299, 1, 1)
[sub_resource type="GradientTexture2D" id="GradientTexture2D_vfh7v"]
gradient = SubResource("Gradient_o7xwa")
fill_from = Vector2(0, 1)
[sub_resource type="LabelSettings" id="LabelSettings_mjry0"]
font_size = 66
[sub_resource type="LabelSettings" id="LabelSettings_2kr3f"]
font_size = 36
[node name="Header" type="PanelContainer" node_paths=PackedStringArray("title_node", "subtitle_node")]
script = ExtResource("1_h4khk")
title_node = NodePath("VBoxContainer/Title")
subtitle_node = NodePath("VBoxContainer/Subtitle")
[node name="Gradient" type="TextureRect" parent="."]
layout_mode = 2
texture = SubResource("GradientTexture2D_vfh7v")
[node name="VBoxContainer" type="VBoxContainer" parent="."]
layout_mode = 2
[node name="Title" type="Label" parent="VBoxContainer"]
layout_mode = 2
text = "Title"
label_settings = SubResource("LabelSettings_mjry0")
horizontal_alignment = 1
[node name="Subtitle" type="Label" parent="VBoxContainer"]
layout_mode = 2
text = "Title"
label_settings = SubResource("LabelSettings_2kr3f")
horizontal_alignment = 1