aboutsummaryrefslogtreecommitdiff
path: root/game/src/SplashContainer.gd
diff options
context:
space:
mode:
author George L. Albany <Megacake1234@gmail.com>2023-03-12 22:36:30 +0100
committer GitHub <noreply@github.com>2023-03-12 22:36:30 +0100
commit1810d1f2d646830d14ec39a204c5b9fb80caa974 (patch)
treeb74ac44bd8bea0a13ae42989b562b2706f52a735 /game/src/SplashContainer.gd
parent56aec8a72b96a7d9ae8fa7974cf1eb7560ab4c02 (diff)
parent046725ee047be93695b99fdbc9dc46e3146d9ce8 (diff)
Merge pull request #59 from Spartan322/feature/splash-opener
Diffstat (limited to 'game/src/SplashContainer.gd')
-rw-r--r--game/src/SplashContainer.gd30
1 files changed, 30 insertions, 0 deletions
diff --git a/game/src/SplashContainer.gd b/game/src/SplashContainer.gd
new file mode 100644
index 0000000..524d314
--- /dev/null
+++ b/game/src/SplashContainer.gd
@@ -0,0 +1,30 @@
+extends Control
+
+signal splash_end
+
+@export var _splash_finish : TextureRect
+@export var _splash_image : TextureRect
+@export var _splash_video : VideoStreamPlayer
+
+func _process(_delta):
+ var stream_texture := _splash_video.get_video_texture()
+ if stream_texture != null and not stream_texture.get_image().is_invisible():
+ _splash_image.hide()
+ _splash_finish.show()
+ set_process(false)
+
+func _input(event):
+ if (event is InputEventKey\
+ or event is InputEventMouse\
+ or event is InputEventScreenTouch\
+ or event is InputEventJoypadButton) and event.is_pressed():
+ _splash_finish.hide()
+ _on_splash_startup_finished()
+ accept_event()
+
+func _on_splash_startup_finished():
+ set_process_input(false)
+ splash_end.emit()
+ var tween := create_tween()
+ tween.tween_property(self, "modulate:a", 0, 0.5)
+ tween.tween_callback(self.queue_free)