image slide & video slide with caption, ability to exit presentation by holding esc

This commit is contained in:
Clevertop 2024-09-25 18:34:55 +10:00
parent df75283c99
commit 6025b8c28f
10 changed files with 333 additions and 15 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 143 KiB

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bcnf6sw6dxp8b"
path="res://.godot/imported/02-3d-outdoor-with-editor.webp-b9f7b0d7ce74327bce7a35b3b06d1847.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://02-3d-outdoor-with-editor.webp"
dest_files=["res://.godot/imported/02-3d-outdoor-with-editor.webp-b9f7b0d7ce74327bce7a35b3b06d1847.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=false
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

Binary file not shown.

View file

@ -19,6 +19,7 @@ config/icon="res://icon.svg"
window/size/viewport_width=1920 window/size/viewport_width=1920
window/size/viewport_height=1080 window/size/viewport_height=1080
window/stretch/mode="canvas_items"
[input] [input]

View file

@ -0,0 +1,48 @@
[gd_scene load_steps=5 format=3 uid="uid://3a66ollbs2jl"]
[ext_resource type="Theme" uid="uid://bswj4s1sfy137" path="res://presentation_theme.tres" id="1_gi6yp"]
[ext_resource type="Texture2D" uid="uid://bcnf6sw6dxp8b" path="res://02-3d-outdoor-with-editor.webp" id="2_8f7jp"]
[ext_resource type="VideoStream" path="res://Cat-has-the-softest_-sweetest-little-meow.ogv" id="3_51vxj"]
[sub_resource type="LabelSettings" id="LabelSettings_ys6im"]
font_size = 60
[node name="BaseSlide" type="VBoxContainer"]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme = ExtResource("1_gi6yp")
[node name="PanelContainer" type="PanelContainer" parent="."]
layout_mode = 2
size_flags_vertical = 3
[node name="TextureRect2" type="TextureRect" parent="PanelContainer"]
visible = false
layout_mode = 2
texture = ExtResource("2_8f7jp")
[node name="VideoStreamPlayer" type="VideoStreamPlayer" parent="PanelContainer"]
layout_mode = 2
stream = ExtResource("3_51vxj")
autoplay = true
loop = true
[node name="PanelContainer" type="PanelContainer" parent="PanelContainer"]
layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 8
[node name="MarginContainer" type="MarginContainer" parent="PanelContainer/PanelContainer"]
layout_mode = 2
theme_override_constants/margin_left = 10
theme_override_constants/margin_top = 10
theme_override_constants/margin_right = 10
theme_override_constants/margin_bottom = 10
[node name="Label" type="Label" parent="PanelContainer/PanelContainer/MarginContainer"]
layout_mode = 2
text = "This is a caption for the fullscreen content"
label_settings = SubResource("LabelSettings_ys6im")

39
slides/image_slide.tscn Normal file
View file

@ -0,0 +1,39 @@
[gd_scene load_steps=4 format=3 uid="uid://d8j6ib7w6yys"]
[ext_resource type="Theme" uid="uid://bswj4s1sfy137" path="res://presentation_theme.tres" id="1_j1nyb"]
[ext_resource type="Texture2D" uid="uid://bcnf6sw6dxp8b" path="res://02-3d-outdoor-with-editor.webp" id="2_3v16y"]
[sub_resource type="LabelSettings" id="LabelSettings_ys6im"]
font_size = 60
[node name="ImageSlide" type="VBoxContainer"]
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme = ExtResource("1_j1nyb")
[node name="PanelContainer" type="PanelContainer" parent="."]
layout_mode = 2
size_flags_vertical = 3
[node name="TextureRect2" type="TextureRect" parent="PanelContainer"]
layout_mode = 2
texture = ExtResource("2_3v16y")
[node name="PanelContainer" type="PanelContainer" parent="PanelContainer"]
layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 8
[node name="MarginContainer" type="MarginContainer" parent="PanelContainer/PanelContainer"]
layout_mode = 2
theme_override_constants/margin_left = 10
theme_override_constants/margin_top = 10
theme_override_constants/margin_right = 10
theme_override_constants/margin_bottom = 10
[node name="Label" type="Label" parent="PanelContainer/PanelContainer/MarginContainer"]
layout_mode = 2
text = "This is a caption for the fullscreen content"
label_settings = SubResource("LabelSettings_ys6im")

View file

@ -1,6 +1,7 @@
[gd_scene load_steps=3 format=3 uid="uid://cjnkbtvmbn8nf"] [gd_scene load_steps=4 format=3 uid="uid://cjnkbtvmbn8nf"]
[ext_resource type="Theme" uid="uid://bswj4s1sfy137" path="res://presentation_theme.tres" id="1_w4q3u"] [ext_resource type="Theme" uid="uid://bswj4s1sfy137" path="res://presentation_theme.tres" id="1_w4q3u"]
[ext_resource type="Texture2D" uid="uid://dweu560gyqjqy" path="res://icon.svg" id="3_26fd0"]
[ext_resource type="Texture2D" uid="uid://5girh8nk4p3f" path="res://gradient.tres" id="5_684v5"] [ext_resource type="Texture2D" uid="uid://5girh8nk4p3f" path="res://gradient.tres" id="5_684v5"]
[node name="BaseSlide" type="VBoxContainer"] [node name="BaseSlide" type="VBoxContainer"]
@ -28,3 +29,15 @@ layout_mode = 2
bbcode_enabled = true bbcode_enabled = true
text = "[wave amp=50.0 freq=5.0 connected=1][center][font_size=160][color=#FFFFFF]The Awesome Godot Presentation!!![/color][/font_size][/center][/wave]" text = "[wave amp=50.0 freq=5.0 connected=1][center][font_size=160][color=#FFFFFF]The Awesome Godot Presentation!!![/color][/font_size][/center][/wave]"
fit_content = true fit_content = true
[node name="Icon" type="Sprite2D" parent="PanelContainer/VBoxContainer"]
position = Vector2(251, 164)
texture = ExtResource("3_26fd0")
[node name="Icon2" type="Sprite2D" parent="PanelContainer/VBoxContainer"]
position = Vector2(868, 889)
texture = ExtResource("3_26fd0")
[node name="Icon3" type="Sprite2D" parent="PanelContainer/VBoxContainer"]
position = Vector2(1523, 130)
texture = ExtResource("3_26fd0")

40
slides/video_slide.tscn Normal file
View file

@ -0,0 +1,40 @@
[gd_scene load_steps=4 format=3 uid="uid://oo8pgocaktid"]
[ext_resource type="Theme" uid="uid://bswj4s1sfy137" path="res://presentation_theme.tres" id="1_egthh"]
[ext_resource type="VideoStream" path="res://Cat-has-the-softest_-sweetest-little-meow.ogv" id="2_vauxo"]
[sub_resource type="LabelSettings" id="LabelSettings_ys6im"]
font_size = 60
[node name="VideoSlide" type="VBoxContainer"]
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme = ExtResource("1_egthh")
[node name="PanelContainer" type="PanelContainer" parent="."]
layout_mode = 2
size_flags_vertical = 3
[node name="VideoStreamPlayer" type="VideoStreamPlayer" parent="PanelContainer"]
layout_mode = 2
stream = ExtResource("2_vauxo")
loop = true
[node name="PanelContainer" type="PanelContainer" parent="PanelContainer"]
layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 8
[node name="MarginContainer" type="MarginContainer" parent="PanelContainer/PanelContainer"]
layout_mode = 2
theme_override_constants/margin_left = 10
theme_override_constants/margin_top = 10
theme_override_constants/margin_right = 10
theme_override_constants/margin_bottom = 10
[node name="Label" type="Label" parent="PanelContainer/PanelContainer/MarginContainer"]
layout_mode = 2
text = "look at this adorable little cat :3"
label_settings = SubResource("LabelSettings_ys6im")

View file

@ -13,6 +13,7 @@ extends Node
#@export_group("Group") #@export_group("Group")
#@export_subgroup("Subgroup") #@export_subgroup("Subgroup")
@export var slides_node : Control @export var slides_node : Control
@export var exit_bar : ProgressBar
#Onready Variables #Onready Variables
@ -21,6 +22,8 @@ var slides : Array[Node]
var current_slide : int = 0 var current_slide : int = 0
var total_slides : int var total_slides : int
var exit_clock : float = 0
#endregion #endregion
#region Godot methods #region Godot methods
@ -28,8 +31,8 @@ func _ready():
slides = slides_node.get_children() slides = slides_node.get_children()
total_slides = slides_node.get_child_count() total_slides = slides_node.get_child_count()
for slide in slides: for slide in slides:
slide.hide() disable_slide(slide)
slides[current_slide].show() enable_slide(slides[current_slide])
pass pass
func _process(delta): func _process(delta):
@ -39,6 +42,18 @@ func _process(delta):
elif(Input.is_action_just_pressed("previous")): elif(Input.is_action_just_pressed("previous")):
if current_slide > 0: if current_slide > 0:
show_previous_slide() show_previous_slide()
if Input.is_action_pressed("exit"):
exit_clock += delta
if exit_clock > 2:
get_tree().quit()
else:
exit_clock -= delta*3.5
exit_clock = clamp(exit_clock, 0, 2)
exit_bar.visible = exit_clock > 0
exit_bar.value = exit_clock/2
#endregion #endregion
#region Signal methods #region Signal methods
@ -48,15 +63,41 @@ func _process(delta):
#region Other methods (please try to separate and organise!) #region Other methods (please try to separate and organise!)
func show_next_slide(): func show_next_slide():
slides[current_slide].hide() disable_slide(slides[current_slide])
current_slide += 1 current_slide += 1
slides[current_slide].show() enable_slide(slides[current_slide])
func show_previous_slide(): func show_previous_slide():
slides[current_slide].hide() disable_slide(slides[current_slide])
current_slide -= 1 current_slide -= 1
slides[current_slide].show() enable_slide(slides[current_slide])
func disable_slide(slide : Node):
slide.hide()
reset_videos(slide)
slide.process_mode = Node.PROCESS_MODE_DISABLED
func enable_slide(slide : Node):
slide.process_mode = Node.PROCESS_MODE_INHERIT
slide.show()
play_videos(slide)
func reset_videos(node : Node):
for N in node.get_children():
if N.get_child_count() > 0:
reset_videos(N)
if N is VideoStreamPlayer:
N.stop()
func play_videos(node : Node):
for N in node.get_children():
if N.get_child_count() > 0:
play_videos(N)
if N is VideoStreamPlayer:
N.play()
#endregion #endregion

View file

@ -1,12 +1,25 @@
[gd_scene load_steps=4 format=3 uid="uid://c7f5wae7pdjt2"] [gd_scene load_steps=10 format=3 uid="uid://c7f5wae7pdjt2"]
[ext_resource type="Script" path="res://tools/Presentation.gd" id="1_qta7b"] [ext_resource type="Script" path="res://tools/Presentation.gd" id="1_qta7b"]
[ext_resource type="PackedScene" uid="uid://cjnkbtvmbn8nf" path="res://slides/title.tscn" id="2_t5os2"] [ext_resource type="PackedScene" uid="uid://cjnkbtvmbn8nf" path="res://slides/title.tscn" id="2_t5os2"]
[ext_resource type="PackedScene" uid="uid://ccokwij05tg74" path="res://slides/standard.tscn" id="3_o6pbq"] [ext_resource type="PackedScene" uid="uid://ccokwij05tg74" path="res://slides/standard.tscn" id="3_o6pbq"]
[ext_resource type="Theme" uid="uid://bswj4s1sfy137" path="res://presentation_theme.tres" id="4_wo3mt"]
[ext_resource type="Texture2D" uid="uid://bcnf6sw6dxp8b" path="res://02-3d-outdoor-with-editor.webp" id="5_8ldqg"]
[ext_resource type="VideoStream" path="res://Cat-has-the-softest_-sweetest-little-meow.ogv" id="6_icktr"]
[node name="Presentation" type="Node" node_paths=PackedStringArray("slides_node")] [sub_resource type="LabelSettings" id="LabelSettings_ys6im"]
font_size = 60
[sub_resource type="LabelSettings" id="LabelSettings_a1y11"]
font_size = 60
[sub_resource type="LabelSettings" id="LabelSettings_gl1th"]
font_color = Color(1, 0, 0, 1)
[node name="Presentation" type="Node" node_paths=PackedStringArray("slides_node", "exit_bar")]
script = ExtResource("1_qta7b") script = ExtResource("1_qta7b")
slides_node = NodePath("Slides") slides_node = NodePath("Slides")
exit_bar = NodePath("ProgressBar")
[node name="Slides" type="Control" parent="."] [node name="Slides" type="Control" parent="."]
layout_mode = 3 layout_mode = 3
@ -18,20 +31,109 @@ grow_vertical = 2
size_flags_horizontal = 3 size_flags_horizontal = 3
size_flags_vertical = 3 size_flags_vertical = 3
[node name="BaseSlide" parent="Slides" instance=ExtResource("2_t5os2")] [node name="TitleSlide" parent="Slides" instance=ExtResource("2_t5os2")]
layout_mode = 1 layout_mode = 1
[node name="BaseSlide2" parent="Slides" instance=ExtResource("3_o6pbq")] [node name="StandardSlide1" parent="Slides" instance=ExtResource("3_o6pbq")]
layout_mode = 1 layout_mode = 1
[node name="BaseSlide3" parent="Slides" instance=ExtResource("3_o6pbq")] [node name="StandardSlide2" parent="Slides" instance=ExtResource("3_o6pbq")]
layout_mode = 1 layout_mode = 1
[node name="Header" parent="Slides/BaseSlide3" index="0"] [node name="Header" parent="Slides/StandardSlide2" index="0"]
title = "Meowww!!!" title = "Meowww!!!"
subtitle = "This is the third slide" subtitle = "This is the third slide"
[node name="Footer" parent="Slides/BaseSlide3" index="2"] [node name="Footer" parent="Slides/StandardSlide2" index="2"]
text = "Things are coming along well~" text = "Things are coming along well~"
[editable path="Slides/BaseSlide3"] [node name="ImageSlide" type="VBoxContainer" parent="Slides"]
layout_mode = 0
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme = ExtResource("4_wo3mt")
[node name="PanelContainer" type="PanelContainer" parent="Slides/ImageSlide"]
layout_mode = 2
size_flags_vertical = 3
[node name="TextureRect2" type="TextureRect" parent="Slides/ImageSlide/PanelContainer"]
layout_mode = 2
texture = ExtResource("5_8ldqg")
[node name="PanelContainer" type="PanelContainer" parent="Slides/ImageSlide/PanelContainer"]
layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 8
[node name="MarginContainer" type="MarginContainer" parent="Slides/ImageSlide/PanelContainer/PanelContainer"]
layout_mode = 2
theme_override_constants/margin_left = 10
theme_override_constants/margin_top = 10
theme_override_constants/margin_right = 10
theme_override_constants/margin_bottom = 10
[node name="Label" type="Label" parent="Slides/ImageSlide/PanelContainer/PanelContainer/MarginContainer"]
layout_mode = 2
text = "This is a caption for the fullscreen content"
label_settings = SubResource("LabelSettings_ys6im")
[node name="VideoSlide" type="VBoxContainer" parent="Slides"]
layout_mode = 0
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme = ExtResource("4_wo3mt")
[node name="PanelContainer" type="PanelContainer" parent="Slides/VideoSlide"]
layout_mode = 2
size_flags_vertical = 3
[node name="VideoStreamPlayer" type="VideoStreamPlayer" parent="Slides/VideoSlide/PanelContainer"]
layout_mode = 2
stream = ExtResource("6_icktr")
loop = true
[node name="PanelContainer" type="PanelContainer" parent="Slides/VideoSlide/PanelContainer"]
layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 8
[node name="MarginContainer" type="MarginContainer" parent="Slides/VideoSlide/PanelContainer/PanelContainer"]
layout_mode = 2
theme_override_constants/margin_left = 10
theme_override_constants/margin_top = 10
theme_override_constants/margin_right = 10
theme_override_constants/margin_bottom = 10
[node name="Label" type="Label" parent="Slides/VideoSlide/PanelContainer/PanelContainer/MarginContainer"]
layout_mode = 2
text = "look at this adorable little cat :3"
label_settings = SubResource("LabelSettings_a1y11")
[node name="ProgressBar" type="ProgressBar" parent="."]
custom_minimum_size = Vector2(0, 50)
anchors_preset = 10
anchor_right = 1.0
offset_bottom = 27.0
grow_horizontal = 2
size_flags_horizontal = 3
theme_override_colors/font_color = Color(1, 0, 0, 1)
max_value = 1.0
step = 0.0
show_percentage = false
[node name="Label" type="Label" parent="ProgressBar"]
layout_mode = 1
anchors_preset = 10
anchor_right = 1.0
offset_bottom = 23.0
grow_horizontal = 2
text = "Exiting"
label_settings = SubResource("LabelSettings_gl1th")
horizontal_alignment = 1
[editable path="Slides/StandardSlide2"]