Migrate to Venus' splash text implmenetation

This commit is contained in:
JeremyStar™ 2024-05-18 19:02:47 +02:00
parent ac9c91c76e
commit 37b08bd681
Signed by: JeremyStarTM
GPG key ID: E366BAEF67E4704D
4 changed files with 24 additions and 96 deletions

View file

@ -32,7 +32,7 @@ export/convert_text_resources_to_binary=false
[editor_plugins]
enabled=PackedStringArray("res://addons/SUI/plugin.cfg")
enabled=PackedStringArray("res://addons/SUI/plugin.cfg", "res://addons/venus/plugin.cfg")
[filesystem]

View file

@ -1,9 +1,10 @@
[gd_scene load_steps=10 format=3 uid="uid://cbqdxkaq5m44g"]
[gd_scene load_steps=9 format=3 uid="uid://cbqdxkaq5m44g"]
[ext_resource type="Shader" path="res://assets/shaders/blur.gdshader" id="1_6kunn"]
[ext_resource type="Script" path="res://src/userinterface.gd" id="1_7rse1"]
[ext_resource type="Texture2D" uid="uid://485ypkeljwca" path="res://assets/images/WallpaperResized.png" id="1_kfnw8"]
[ext_resource type="Texture2D" uid="uid://b23f0o450c2xl" path="res://assets/images/IconText.png" id="3_hxo5p"]
[ext_resource type="PackedScene" uid="uid://bnftxfwr021q6" path="res://addons/venus/assets/uielements/Splash.tscn" id="5_db03k"]
[ext_resource type="PackedScene" uid="uid://bso65vpjqc4g4" path="res://addons/SUI/scenesrc/SuiText.tscn" id="5_lpbss"]
[ext_resource type="PackedScene" uid="uid://4hi8y7pu3w0v" path="res://addons/SUI/scenesrc/SuiTextButton.tscn" id="6_xj8q1"]
@ -13,28 +14,6 @@ shader_parameter/radius = 4.0
shader_parameter/steps = 32
shader_parameter/vertex_expand = 1.0
[sub_resource type="Animation" id="Animation_8cqjd"]
resource_name = "anim"
length = 0.5
loop_mode = 1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:scale")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.3, 0.5),
"transitions": PackedFloat32Array(3, 1, 1),
"update": 0,
"values": [Vector2(1, 1), Vector2(1.063, 1.063), Vector2(1, 1)]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_hqqk1"]
_data = {
"anim": SubResource("Animation_8cqjd")
}
[node name="UserInterface" type="NinePatchRect"]
material = SubResource("ShaderMaterial_tg5oh")
offset_right = 1440.0
@ -54,34 +33,12 @@ offset_bottom = 260.0
grow_horizontal = 2
texture = ExtResource("3_hxo5p")
[node name="Splash" parent="." instance=ExtResource("5_lpbss")]
modulate = Color(1, 1, 0, 1)
layout_mode = 1
anchors_preset = 5
anchor_left = 0.5
anchor_right = 0.5
anchor_bottom = 0.0
offset_left = 177.0
[node name="SplashVenus" parent="." instance=ExtResource("5_db03k")]
offset_left = 898.0
offset_top = 210.0
offset_right = 619.0
offset_right = 1340.0
offset_bottom = 300.0
grow_vertical = 1
rotation = -0.366519
pivot_offset = Vector2(221, 45)
text = "[center]Hmm... something went wrong.[/center]"
font_size = 30
[node name="AnimPlayer" type="AnimationPlayer" parent="Splash"]
libraries = {
"": SubResource("AnimationLibrary_hqqk1")
}
autoplay = "anim"
[node name="Switcher" type="Button" parent="Splash"]
self_modulate = Color(1, 1, 1, 0)
layout_mode = 0
offset_right = 442.0
offset_bottom = 90.0
splash_category = "presencode"
[node name="Buttons" type="Control" parent="."]
layout_mode = 1

View file

@ -68,6 +68,9 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.""")
core_config.logui_enabled = args["display_logui"]
core.reload_configuration(core_config)
# Register Venus' modules
VenusManager.new(core).register_modules()
# Initialize internals
logger.info("Initializing internals")
@ -91,6 +94,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.""")
# Load UserInterface.tscn
var userinterface: NinePatchRect = load("res://scenesrc/UserInterface.tscn").instantiate()
userinterface.name = "UserInterface"
userinterface.core = core
userinterface.core_config = core_config.duplicate()
userinterface.presenloader = presenloader
get_tree().root.add_child.call_deferred(userinterface)

View file

@ -17,9 +17,10 @@
extends NinePatchRect
# CORE
var core: Core
var core_config: CoreConfiguration
@onready var core: Core = get_node("/root/CORE")
@onready var logger: CoreLoggerInstance = core.logger.get_instance("src/userinterface.gd", self)
var splashes: CoreBaseModule
# Internal infrastructure
var presenloader: Node
@ -27,49 +28,27 @@ var presenloader: Node
# Variables
var shutdown: bool = false
var cleanup_hook: int
var splashes: Array[String] = [
"Made in Godot 4.2!",
"Made with the CORE Framework!",
"Awesome!",
"Cute!",
"Dangerous.",
"Dangerously explosive!",
"Made in Germany",
": Godot Edition",
"this was blatantly ripped off from Minecraft",
"Trans rights are human rights!",
"// TODO",
"# TODO",
"UwU",
"open source :)",
"i use presencode btw",
"i use arch btw",
"69 haha funny number",
"<3 neofox",
"<3 blobfox",
"<3",
"Coin Score % 256 = Saved Coin Score",
"xD",
"Now in 2D!",
"very bad",
"beta and alpha males are overrated, i'm a release male",
"uses .pcar files!",
"licensed under the GNU AGPL v3!",
"## @experimental",
"Welcome!",
"Godot 4 + [s]0.1 + 0.2[/s] 20 = Godot 4.2!"
]
# Threads
var thread_wallpaper: Thread = Thread.new()
# +++ initialization +++
func _enter_tree() -> void:
splashes = core.get_custom_module("splashes")
splashes.copy_splashes("default", "presencode")
splashes.add_splashes("presencode", [
"Dangerous.",
"i use presencode btw",
"Now in 2D!",
"very bad",
"uses .pcar files!"
])
func _ready() -> void:
# Register cleanup hook
cleanup_hook = core.register_cleanup_hook(Callable(self, "cleanup"))
# Call update methods
update_splash()
add_connections()
# Load higher quality wallpaper
@ -132,9 +111,6 @@ func cleanup() -> void:
# Adds connections
func add_connections() -> void:
# Splash update button
$Splash/Switcher.connect("pressed", func() -> void: update_splash())
# Buttons
$Buttons/PresentZip.connect("pressed", Callable(self, "display_open_dialog").bind(false))
$Buttons/PresentDir.connect("pressed", Callable(self, "display_open_dialog").bind(true))
@ -217,12 +193,3 @@ func handle_open_dialog_logic(path: String, file_dialog: FileDialog) -> void:
# Unload user interface
unload()
# Updates the splash text
func update_splash() -> void:
var new_splash: String = splashes.pick_random()
while true:
if new_splash != $Splash.text:
break
$Splash.text = "[center]" + new_splash + "[/center]"