diff options
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 |
commit | 1810d1f2d646830d14ec39a204c5b9fb80caa974 (patch) | |
tree | b74ac44bd8bea0a13ae42989b562b2706f52a735 | |
parent | 56aec8a72b96a7d9ae8fa7974cf1eb7560ab4c02 (diff) | |
parent | 046725ee047be93695b99fdbc9dc46e3146d9ce8 (diff) |
Merge pull request #59 from Spartan322/feature/splash-opener
-rw-r--r-- | game/project.godot | 4 | ||||
-rw-r--r-- | game/splash_assets/splash_end.png | bin | 0 -> 1264857 bytes | |||
-rw-r--r-- | game/splash_assets/splash_end.png.import | 34 | ||||
-rw-r--r-- | game/splash_assets/splash_image.png | bin | 0 -> 1756225 bytes | |||
-rw-r--r-- | game/splash_assets/splash_image.png.import | 34 | ||||
-rw-r--r-- | game/splash_assets/splash_startup.ogv | bin | 0 -> 2964974 bytes | |||
-rw-r--r-- | game/src/GameMenu.gd | 5 | ||||
-rw-r--r-- | game/src/GameStart.tscn | 52 | ||||
-rw-r--r-- | game/src/SplashContainer.gd | 30 |
9 files changed, 158 insertions, 1 deletions
diff --git a/game/project.godot b/game/project.godot index 7975c0a..323bf41 100644 --- a/game/project.godot +++ b/game/project.godot @@ -11,8 +11,10 @@ config_version=5 [application] config/name="OpenVic2" -run/main_scene="res://src/GameMenu.tscn" +run/main_scene="res://src/GameStart.tscn" config/features=PackedStringArray("4.0", "Forward Plus") +boot_splash/bg_color=Color(0.380392, 0.145098, 0.14902, 1) +boot_splash/image="res://splash_assets/splash_image.png" config/icon="res://icon.svg" config/project_settings_override.template="user://settings.cfg" diff --git a/game/splash_assets/splash_end.png b/game/splash_assets/splash_end.png Binary files differnew file mode 100644 index 0000000..ac7b1da --- /dev/null +++ b/game/splash_assets/splash_end.png diff --git a/game/splash_assets/splash_end.png.import b/game/splash_assets/splash_end.png.import new file mode 100644 index 0000000..64a7f9a --- /dev/null +++ b/game/splash_assets/splash_end.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://deef5hufq0j61" +path="res://.godot/imported/splash_end.png-967b7882642610d3be0d67e2695b1564.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://splash_assets/splash_end.png" +dest_files=["res://.godot/imported/splash_end.png-967b7882642610d3be0d67e2695b1564.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=true +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/game/splash_assets/splash_image.png b/game/splash_assets/splash_image.png Binary files differnew file mode 100644 index 0000000..5f7cff9 --- /dev/null +++ b/game/splash_assets/splash_image.png diff --git a/game/splash_assets/splash_image.png.import b/game/splash_assets/splash_image.png.import new file mode 100644 index 0000000..ce7e72c --- /dev/null +++ b/game/splash_assets/splash_image.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://cgdnixsyh7bja" +path="res://.godot/imported/splash_image.png-e2810276ec1ba470c15ca32f0eb76f88.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://splash_assets/splash_image.png" +dest_files=["res://.godot/imported/splash_image.png-e2810276ec1ba470c15ca32f0eb76f88.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=true +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/game/splash_assets/splash_startup.ogv b/game/splash_assets/splash_startup.ogv Binary files differnew file mode 100644 index 0000000..950d9a6 --- /dev/null +++ b/game/splash_assets/splash_startup.ogv diff --git a/game/src/GameMenu.gd b/game/src/GameMenu.gd index 8430c23..4f1d9be 100644 --- a/game/src/GameMenu.gd +++ b/game/src/GameMenu.gd @@ -35,3 +35,8 @@ func _on_credits_back_button_pressed(): func _on_main_menu_credits_button_pressed(): $Credits.show() $MainMenu.hide() + + + +func _on_splash_container_splash_end(): + show() diff --git a/game/src/GameStart.tscn b/game/src/GameStart.tscn new file mode 100644 index 0000000..2046bb5 --- /dev/null +++ b/game/src/GameStart.tscn @@ -0,0 +1,52 @@ +[gd_scene load_steps=6 format=3 uid="uid://1udsn4mggep2"] + +[ext_resource type="PackedScene" uid="uid://o4u142w4qkln" path="res://src/GameMenu.tscn" id="1_wlojq"] +[ext_resource type="Script" path="res://src/SplashContainer.gd" id="2_xmcgv"] +[ext_resource type="Texture2D" uid="uid://deef5hufq0j61" path="res://splash_assets/splash_end.png" id="3_qfv12"] +[ext_resource type="Texture2D" uid="uid://cgdnixsyh7bja" path="res://splash_assets/splash_image.png" id="4_5b6yq"] +[ext_resource type="VideoStream" path="res://splash_assets/splash_startup.ogv" id="5_8euyy"] + +[node name="GameStartup" type="Control"] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="GameMenu" parent="." instance=ExtResource("1_wlojq")] +visible = false +layout_mode = 1 + +[node name="SplashContainer" type="AspectRatioContainer" parent="." node_paths=PackedStringArray("_splash_finish", "_splash_image", "_splash_video")] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +ratio = 1.7778 +stretch_mode = 3 +script = ExtResource("2_xmcgv") +_splash_finish = NodePath("SplashFinish") +_splash_image = NodePath("SplashImage") +_splash_video = NodePath("SplashVideo") + +[node name="SplashFinish" type="TextureRect" parent="SplashContainer"] +layout_mode = 2 +texture = ExtResource("3_qfv12") +expand_mode = 1 + +[node name="SplashImage" type="TextureRect" parent="SplashContainer"] +layout_mode = 2 +texture = ExtResource("4_5b6yq") +expand_mode = 1 + +[node name="SplashVideo" type="VideoStreamPlayer" parent="SplashContainer"] +layout_mode = 2 +stream = ExtResource("5_8euyy") +autoplay = true +expand = true + +[connection signal="splash_end" from="SplashContainer" to="GameMenu" method="_on_splash_container_splash_end"] +[connection signal="finished" from="SplashContainer/SplashVideo" to="SplashContainer" method="_on_splash_startup_finished"] 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) |