Update project

This commit is contained in:
JeremyStar™ 2024-05-08 20:45:33 +02:00
parent e98d81446c
commit 246536b89e
Signed by: JeremyStarTM
GPG key ID: E366BAEF67E4704D
18 changed files with 95 additions and 230 deletions

@ -1 +1 @@
Subproject commit 92855bb4e7dec253093ec043e5d070ccba91c1ec
Subproject commit 9d46a0ec051eda6c898c836922fc6622d063cc36

View file

@ -2,7 +2,7 @@ extends Node
var core: Core
var core_config: CoreConfiguration = CoreConfiguration.new()
@onready var logger: CoreLoggerInstance = core.logger.get_instance("Init.gd")
@onready var logger: CoreLoggerInstance = core.logger.get_instance("Init.gd", self)
@onready var sms: CoreBaseModule = core.sms
func _init() -> void:
@ -15,7 +15,7 @@ func _ready() -> void:
await core.complete_init()
logger.info("Loading Test.tscn into SceneTree")
sms.add_scene("test", CoreTypes.SceneType.MAIN, ResourceLoader.load("res://Test.tscn").instantiate())
sms.add_scene("test", ResourceLoader.load("res://Test.tscn").instantiate(), CoreTypes.SceneType.MAIN)
logger.info("Freeing")
queue_free()

View file

@ -1,6 +1,6 @@
extends Control
@onready var logger: CoreLoggerInstance = get_node("/root/CORE").logger.get_instance("Test.gd")
@onready var logger: CoreLoggerInstance = get_node("/root/CORE").logger.get_instance("Test.gd", self)
func _ready() -> void:
$SuiIconButton.connect("up", func() -> void: logger.info("SuiIconButton: up()"))

View file

@ -1,10 +1,11 @@
[gd_scene load_steps=6 format=3 uid="uid://5fghtsgvqc7j"]
[gd_scene load_steps=8 format=3 uid="uid://5fghtsgvqc7j"]
[ext_resource type="PackedScene" uid="uid://cxg471hoqg6mr" path="res://SUI/scenesrc/SuiIconButton.tscn" id="1_3di6k"]
[ext_resource type="Script" path="res://Test.gd" id="1_xnmp1"]
[ext_resource type="PackedScene" uid="uid://4hi8y7pu3w0v" path="res://SUI/scenesrc/SuiTextButton.tscn" id="2_dxvwu"]
[ext_resource type="PackedScene" uid="uid://1r7pvm0biuk7" path="res://SUI/scenesrc/SuiHeader.tscn" id="2_pcev0"]
[ext_resource type="PackedScene" uid="uid://bso65vpjqc4g4" path="res://SUI/scenesrc/SuiText.tscn" id="4_1lt1v"]
[ext_resource type="Texture2D" uid="uid://beqhfqbyme6in" path="res://SUI/dist/example.png" id="4_12skp"]
[node name="Test" type="Control"]
layout_mode = 3
@ -17,31 +18,32 @@ script = ExtResource("1_xnmp1")
[node name="SuiHeader" parent="." instance=ExtResource("2_pcev0")]
layout_mode = 1
offset_left = 43.0
offset_top = 349.0
offset_right = -360.0
offset_bottom = -14.0
offset_left = 171.0
offset_top = 436.0
offset_right = -282.0
offset_bottom = -4.0
text = "Header: Normal [b]Bold[/b] [i]Italic[/i] [b][i]Bold Italic[/i][/b] [code]Code -->[/code]"
[node name="SuiIconButton" parent="." instance=ExtResource("1_3di6k")]
layout_mode = 1
offset_left = 423.0
offset_left = 671.0
offset_top = 28.0
offset_right = -32.0
offset_bottom = -408.0
offset_bottom = -446.0
image = ExtResource("4_12skp")
[node name="SuiText" parent="." instance=ExtResource("4_1lt1v")]
layout_mode = 1
offset_left = 371.0
offset_top = 205.0
offset_right = -349.0
offset_bottom = -225.0
offset_left = 697.0
offset_top = 245.0
offset_right = -23.0
offset_bottom = -185.0
text = "Text: Normal [b]Bold[/b] [i]Italic[/i] [b][i]Bold Italic[/i][/b] [code]Code -->[/code]"
[node name="SuiTextButton" parent="." instance=ExtResource("2_dxvwu")]
layout_mode = 1
offset_left = 645.0
offset_top = 307.0
offset_right = -26.0
offset_bottom = -69.0
offset_left = 665.0
offset_top = 368.0
offset_right = -6.0
offset_bottom = -8.0
text = "Button: Normal [b]Bold[/b] [i]Italic[/i] [b][i]Bold Italic[/i][/b] [code]Code -->[/code]"

View file

@ -19,7 +19,7 @@ boot_splash/show_image=false
[display]
window/size/viewport_width=950
window/size/viewport_width=960
window/size/viewport_height=540
[filesystem]

View file

@ -1,7 +1,6 @@
[gd_scene load_steps=4 format=3 uid="uid://1r7pvm0biuk7"]
[gd_scene load_steps=3 format=3 uid="uid://1r7pvm0biuk7"]
[ext_resource type="Script" path="res://SUI/src/SuiHeader.gd" id="1_b3qg3"]
[ext_resource type="Script" path="res://SUI/src/SuiHeaderTool.gd" id="2_bnj46"]
[ext_resource type="Script" path="res://SUI/src/SuiHeader.gd" id="2_bnj46"]
[ext_resource type="Theme" uid="uid://c08yxv1cirbxe" path="res://SUI/themes/RichTextLabel.tres" id="3_877pi"]
[node name="SuiHeader" type="Control"]
@ -13,14 +12,11 @@ offset_right = -780.0
offset_bottom = -490.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_b3qg3")
[node name="ToolScript" type="Node" parent="."]
script = ExtResource("2_bnj46")
[node name="Text" type="RichTextLabel" parent="."]
layout_mode = 0
offset_right = 170.0
offset_right = 180.0
offset_bottom = 50.0
theme = ExtResource("3_877pi")
theme_override_font_sizes/normal_font_size = 35

View file

@ -1,8 +1,6 @@
[gd_scene load_steps=5 format=3 uid="uid://cxg471hoqg6mr"]
[gd_scene load_steps=3 format=3 uid="uid://cxg471hoqg6mr"]
[ext_resource type="Script" path="res://SUI/src/SuiIconButton.gd" id="1_ekv73"]
[ext_resource type="Texture2D" uid="uid://beqhfqbyme6in" path="res://SUI/dist/example.png" id="2_c5w38"]
[ext_resource type="Script" path="res://SUI/src/SuiIconButtonTool.gd" id="2_g6elc"]
[ext_resource type="Script" path="res://SUI/src/SuiIconButton.gd" id="2_g6elc"]
[ext_resource type="Theme" uid="uid://prqv77t23rsq" path="res://SUI/themes/Button.tres" id="3_knxki"]
[node name="SuiIconButton" type="Control"]
@ -11,29 +9,24 @@ anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
offset_right = -900.0
offset_bottom = -490.0
offset_bottom = -480.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_ekv73")
image = ExtResource("2_c5w38")
script = ExtResource("2_g6elc")
ip_left = 8
ip_top = 5
ip_right = 8
ip_bottom = 5
[node name="ToolScript" type="Node" parent="."]
script = ExtResource("2_g6elc")
[node name="Button" type="Button" parent="."]
layout_mode = 0
offset_right = 50.0
offset_bottom = 50.0
offset_right = 60.0
offset_bottom = 60.0
theme = ExtResource("3_knxki")
[node name="Icon" type="NinePatchRect" parent="."]
layout_mode = 0
offset_left = 8.0
offset_top = 5.0
offset_right = 42.0
offset_bottom = 45.0
texture = ExtResource("2_c5w38")
offset_right = 60.0
offset_bottom = 60.0

View file

@ -1,7 +1,6 @@
[gd_scene load_steps=4 format=3 uid="uid://bso65vpjqc4g4"]
[gd_scene load_steps=3 format=3 uid="uid://bso65vpjqc4g4"]
[ext_resource type="Script" path="res://SUI/src/SuiText.gd" id="1_1jc62"]
[ext_resource type="Script" path="res://SUI/src/SuiTextTool.gd" id="2_87ovr"]
[ext_resource type="Script" path="res://SUI/src/SuiText.gd" id="2_87ovr"]
[ext_resource type="Theme" uid="uid://c08yxv1cirbxe" path="res://SUI/themes/RichTextLabel.tres" id="3_fttgr"]
[node name="SuiText" type="Control"]
@ -13,14 +12,11 @@ offset_right = -850.0
offset_bottom = -503.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_1jc62")
[node name="ToolScript" type="Node" parent="."]
script = ExtResource("2_87ovr")
[node name="Text" type="RichTextLabel" parent="."]
layout_mode = 0
offset_right = 100.0
offset_right = 110.0
offset_bottom = 37.0
theme = ExtResource("3_fttgr")
theme_override_font_sizes/normal_font_size = 25

View file

@ -1,7 +1,6 @@
[gd_scene load_steps=5 format=3 uid="uid://4hi8y7pu3w0v"]
[gd_scene load_steps=4 format=3 uid="uid://4hi8y7pu3w0v"]
[ext_resource type="Script" path="res://SUI/src/SuiTextButton.gd" id="1_tjgbd"]
[ext_resource type="Script" path="res://SUI/src/SuiTextButtonTool.gd" id="2_43xd1"]
[ext_resource type="Script" path="res://SUI/src/SuiTextButton.gd" id="2_43xd1"]
[ext_resource type="Theme" uid="uid://prqv77t23rsq" path="res://SUI/themes/Button.tres" id="3_u0br7"]
[ext_resource type="Theme" uid="uid://c08yxv1cirbxe" path="res://SUI/themes/RichTextLabel.tres" id="4_vp57w"]
@ -14,20 +13,17 @@ offset_right = -700.0
offset_bottom = -490.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_tjgbd")
[node name="ToolScript" type="Node" parent="."]
script = ExtResource("2_43xd1")
[node name="Button" type="Button" parent="."]
layout_mode = 0
offset_right = 250.0
offset_right = 260.0
offset_bottom = 50.0
theme = ExtResource("3_u0br7")
[node name="Text" type="RichTextLabel" parent="."]
layout_mode = 0
offset_right = 250.0
offset_right = 260.0
offset_bottom = 50.0
mouse_filter = 2
theme = ExtResource("4_vp57w")

29
sui/src/SuiBaseClass.gd Normal file
View file

@ -0,0 +1,29 @@
@tool
extends Control
class_name SuiBaseClass
var core: Core
var logger: CoreLoggerInstance = null
@export_category("Debugging")
@export var editor_process: bool = true
@export var runtime_process: bool = true
# +++ initialization and process methods +++
func _ready() -> void:
if !in_editor(): core = get_node("/root/CORE")
func _process(_delta: float):
if execute_process(): update_element()
# +++ element updating +++
func update_element() -> void: pass
# +++ etc +++
func execute_process() -> bool:
if in_editor() and !editor_process: return false
elif !in_editor() and !runtime_process: return false
else: return true
func in_editor() -> bool:
return get_node_or_null("/root/CORE") == null

View file

@ -1,24 +1,11 @@
extends Control
@onready var logger: CoreLoggerInstance = get_node("/root/CORE").logger.get_instance("SUI/src/SuiHeader.gd")
@tool
extends SuiBaseClass
@export_category("Base Configuration")
@export_subgroup("RichTextLabel")
@export var bbcode_support: bool = true
@export_multiline var text: String = "[center]SuiHeader[/center]"
@export var font_size: int = 35
@export_category("Debugging")
@export var editor_process: bool = true
@export var runtime_process: bool = true
func _ready() -> void:
# Free unused children
logger.diag("<" + name + "> Freeing ToolScript")
get_child(0).queue_free()
func _process(_delta: float) -> void:
if !runtime_process: return
update_element()
func update_element() -> void:
# Update sizes

View file

@ -1,19 +0,0 @@
@tool
extends Node
func _process(_delta: float):
if !get_parent().editor_process: return
var parent: Control = get_parent()
var text: RichTextLabel = parent.get_node("Text")
# Update sizes
text.size = parent.size
# Update RichTextLabel stuff
text.bbcode_enabled = parent.bbcode_support
text.text = parent.text
text.add_theme_font_size_override("normal_font_size", parent.font_size)
text.add_theme_font_size_override("bold_font_size", parent.font_size)
text.add_theme_font_size_override("italics_font_size", parent.font_size)
text.add_theme_font_size_override("bold_italics_font_size", parent.font_size)
text.add_theme_font_size_override("mono_font_size", parent.font_size)

View file

@ -1,6 +1,5 @@
extends Control
@onready var logger: CoreLoggerInstance = get_node("/root/CORE").logger.get_instance("SUI/src/SuiIconButton.gd")
@tool
extends SuiBaseClass
@export_category("Base Configuration")
@export_subgroup("Button")
@ -25,9 +24,6 @@ extends Control
@export_subgroup("Axis Stretch")
@export var as_horizontal: NinePatchRect.AxisStretchMode = NinePatchRect.AxisStretchMode.AXIS_STRETCH_MODE_STRETCH
@export var as_vertical: NinePatchRect.AxisStretchMode = NinePatchRect.AxisStretchMode.AXIS_STRETCH_MODE_STRETCH
@export_category("Debugging")
@export var editor_process: bool = true
@export var runtime_process: bool = true
signal down
signal up
@ -35,20 +31,12 @@ signal pressed
signal toggled
func _ready() -> void:
# Free unused children
logger.diag("<" + name + "> Freeing ToolScript")
get_child(0).queue_free()
# Add signals
logger.diag("<" + name + "> Adding signals")
$Button.connect("button_down", func() -> void: emit_signal("down"))
$Button.connect("button_up", func() -> void: emit_signal("up"))
$Button.connect("pressed", func() -> void: emit_signal("pressed"))
$Button.connect("toggled", func(toggled_on: bool) -> void: emit_signal("toggled", toggled_on))
func _process(_delta: float) -> void:
if !runtime_process: return
update_element()
super()
if !in_editor():
$Button.connect("button_down", func() -> void: emit_signal("down"))
$Button.connect("button_up", func() -> void: emit_signal("up"))
$Button.connect("pressed", func() -> void: emit_signal("pressed"))
$Button.connect("toggled", func(toggled_on: bool) -> void: emit_signal("toggled", toggled_on))
func update_element() -> void:
# Update button size

View file

@ -1,34 +0,0 @@
@tool
extends Node
func _process(_delta: float):
if !get_parent().editor_process: return
var parent: Control = get_parent()
var button: Button = parent.get_node("Button")
var icon: NinePatchRect = parent.get_node("Icon")
# Update button size
button.size = parent.size
# Update icon size + padding
icon.size = parent.size
icon.position.x = parent.ip_left
icon.position.y = parent.ip_top
icon.size.x -= parent.ip_right + parent.ip_left
icon.size.y -= parent.ip_bottom + parent.ip_top
# Update Button stuff
button.disabled = parent.disabled
button.toggle_mode = parent.toggle_mode
button.button_pressed = parent.button_pressed
# Update NinePatchRect stuff
icon.texture = parent.image
icon.region_rect = parent.region_rect
icon.draw_center = parent.draw_center
icon.patch_margin_left = parent.pm_left
icon.patch_margin_top = parent.pm_top
icon.patch_margin_right = parent.pm_right
icon.patch_margin_bottom = parent.pm_bottom
icon.axis_stretch_horizontal = parent.as_horizontal
icon.axis_stretch_vertical = parent.as_vertical

View file

@ -1,34 +1,22 @@
extends Control
@onready var logger: CoreLoggerInstance = get_node("/root/CORE").logger.get_instance("SUI/src/SuiText.gd")
@tool
extends SuiBaseClass
@export_category("Base Configuration")
@export_subgroup("RichTextLabel")
@export var bbcode_support: bool = true
@export_multiline var text: String = "[center]SuiText[/center]"
@export var font_size: int = 25
@export_category("Debugging")
@export var editor_process: bool = true
@export var runtime_process: bool = true
signal meta_clicked
signal meta_hover_started
signal meta_hover_ended
func _ready() -> void:
# Free unused children
logger.diag("<" + name + "> Freeing ToolScript")
get_child(0).queue_free()
# Add signals
logger.diag("<" + name + "> Adding signals")
$Text.connect("meta_clicked", func(meta: Variant) -> void: emit_signal("meta_clicked", meta))
$Text.connect("meta_hover_started", func(meta: Variant) -> void: emit_signal("meta_hover_started", meta))
$Text.connect("meta_hover_ended", func(meta: Variant) -> void: emit_signal("meta_hover_ended", meta))
func _process(_delta: float) -> void:
if !runtime_process: return
update_element()
func _ready():
super()
if in_editor():
$Text.connect("meta_clicked", func(meta: Variant) -> void: emit_signal("meta_clicked", meta))
$Text.connect("meta_hover_started", func(meta: Variant) -> void: emit_signal("meta_hover_started", meta))
$Text.connect("meta_hover_ended", func(meta: Variant) -> void: emit_signal("meta_hover_ended", meta))
func update_element() -> void:
# Update sizes

View file

@ -1,6 +1,5 @@
extends Control
@onready var logger: CoreLoggerInstance = get_node("/root/CORE").logger.get_instance("SUI/src/SuiTextButton.gd")
@tool
extends SuiBaseClass
@export_category("Base Configuration")
@export_subgroup("Button")
@ -11,9 +10,6 @@ extends Control
@export var bbcode_support: bool = true
@export_multiline var text: String = "[center]SuiTextButton[/center]"
@export var font_size: int = 35
@export_category("Debugging")
@export var editor_process: bool = true
@export var runtime_process: bool = true
signal down
signal up
@ -21,20 +17,12 @@ signal pressed
signal toggled
func _ready() -> void:
# Free unused children
logger.diag("<" + name + "> Freeing ToolScript")
get_child(0).queue_free()
# Add signals
logger.diag("<" + name + "> Adding signals")
$Button.connect("button_down", func() -> void: emit_signal("down"))
$Button.connect("button_up", func() -> void: emit_signal("up"))
$Button.connect("pressed", func() -> void: emit_signal("pressed"))
$Button.connect("toggled", func(toggled_on: bool) -> void: emit_signal("toggled", toggled_on))
func _process(_delta: float) -> void:
if !runtime_process: return
update_element()
super()
if !in_editor():
$Button.connect("button_down", func() -> void: emit_signal("down"))
$Button.connect("button_up", func() -> void: emit_signal("up"))
$Button.connect("pressed", func() -> void: emit_signal("pressed"))
$Button.connect("toggled", func(toggled_on: bool) -> void: emit_signal("toggled", toggled_on))
func update_element() -> void:
# Update sizes

View file

@ -1,26 +0,0 @@
@tool
extends Node
func _process(_delta: float):
if !get_parent().editor_process: return
var parent: Control = get_parent()
var button: Button = parent.get_node("Button")
var text: RichTextLabel = parent.get_node("Text")
# Update sizes
button.size = parent.size
text.size = parent.size
# Update Button stuff
button.disabled = parent.disabled
button.toggle_mode = parent.toggle_mode
button.button_pressed = parent.button_pressed
# Update RichTextLabel stuff
text.bbcode_enabled = parent.bbcode_support
text.text = parent.text
text.add_theme_font_size_override("normal_font_size", parent.font_size)
text.add_theme_font_size_override("bold_font_size", parent.font_size)
text.add_theme_font_size_override("italics_font_size", parent.font_size)
text.add_theme_font_size_override("bold_italics_font_size", parent.font_size)
text.add_theme_font_size_override("mono_font_size", parent.font_size)

View file

@ -1,19 +0,0 @@
@tool
extends Node
func _process(_delta: float):
if !get_parent().editor_process: return
var parent: Control = get_parent()
var text: RichTextLabel = parent.get_node("Text")
# Update sizes
text.size = parent.size
# Update RichTextLabel stuff
text.bbcode_enabled = parent.bbcode_support
text.text = parent.text
text.add_theme_font_size_override("normal_font_size", parent.font_size)
text.add_theme_font_size_override("bold_font_size", parent.font_size)
text.add_theme_font_size_override("italics_font_size", parent.font_size)
text.add_theme_font_size_override("bold_italics_font_size", parent.font_size)
text.add_theme_font_size_override("mono_font_size", parent.font_size)