initial commit

This commit is contained in:
David Allen 2024-10-21 22:57:51 -06:00
commit 994fca9f45
Signed by: towk
GPG key ID: 793B2924A49B3A3F
19 changed files with 483 additions and 0 deletions

2
.gitattributes vendored Normal file
View file

@ -0,0 +1,2 @@
# Normalize EOL for all files that Git considers text files.
* text=auto eol=lf

3
.gitignore vendored Normal file
View file

@ -0,0 +1,3 @@
# Godot 4+ specific ignores
.godot/
/android/

110
Slideshow.gd Normal file
View file

@ -0,0 +1,110 @@
extends Control
@onready var button_next := %Next
@onready var button_previous := %Previous
@onready var content := %Content
@onready var frame := %Frame
var current_index := 0
var duration := 0.5
func _ready() -> void:
_initialize()
func _initialize() -> void:
button_next.pressed.connect(_cycle_next)
button_previous.pressed.connect(_cycle_previous)
# move all slides off screen and fit to content frame (if not ignoring sizes)
_content_fit_size()
_content_reset_positions()
var initial_slide := content.get_child(0)
initial_slide.set_position(content.get_position())
func _content_fit_size() -> void:
for slide in content.get_children():
slide.set_size(content.get_size())
func _content_reset_positions() -> void:
for slide in content.get_children():
slide.set_position(
Vector2(
frame.get_position().x - slide.get_size().x,
frame.get_position().y
)
)
func _cycle_next() -> void:
# get the index of the next node
var next_index := current_index + 1
var slide_count := content.get_child_count()
if next_index >= slide_count:
next_index = 0
# set the initial position of next slide to the left of content before moving
var next_node := content.get_child(next_index)
next_node.set_position(
Vector2(
frame.get_position().x - content.get_size().x,
content.get_position().y
)
)
# slide the current and next nodes to the right simultaneously
var current_slide := content.get_child(current_index)
var tween := get_tree().create_tween().set_parallel(true)
tween.tween_property(
current_slide,
"position:x",
frame.get_position().x + frame.get_size().x, # at end of frame
duration
).set_trans(Tween.TRANS_CUBIC)
tween.tween_property(
next_node,
"position:x",
content.get_position().x, # at beginning of content
duration
).set_trans(Tween.TRANS_CUBIC)
# set the current index to the next one
current_index = next_index
func _cycle_previous() -> void:
# get the index of the previous node
var previous_index := current_index - 1
var slide_count := content.get_child_count()
if previous_index < 0:
previous_index = slide_count - 1
# set the initial position of previous slide to the right of content before moving
var previous_node := content.get_child(previous_index)
previous_node.set_position(
Vector2(
content.get_position().x + content.get_size().x,
content.get_position().y
)
)
# slide the current and previous nodes to the left simultaneously
var current_slide := content.get_child(current_index)
var tween := get_tree().create_tween().set_parallel(true)
tween.tween_property(
current_slide,
"position:x",
frame.get_position().x - frame.get_size().x, # at left of frame
duration
).set_trans(Tween.TRANS_CUBIC)
tween.tween_property(
previous_node,
"position:x",
content.get_position().x, # at beginning of content
duration
).set_trans(Tween.TRANS_CUBIC)
# set the current index to the previous one
current_index = previous_index

110
Slideshow.tscn Normal file
View file

@ -0,0 +1,110 @@
[gd_scene load_steps=7 format=3 uid="uid://gxkftwihyaeb"]
[ext_resource type="Script" path="res://Slideshow.gd" id="1_c4yco"]
[ext_resource type="Texture2D" uid="uid://hae3xxu5gi1j" path="res://assets/textures/left.png" id="2_ipc81"]
[ext_resource type="Texture2D" uid="uid://htlpmfnfxo0p" path="res://assets/textures/airplanecomercial.png" id="3_r020g"]
[ext_resource type="Texture2D" uid="uid://cq85cp58w2yo" path="res://assets/textures/coin.png" id="4_k2rtf"]
[ext_resource type="Texture2D" uid="uid://b0clm03ld3sqt" path="res://assets/textures/checkmark.png" id="5_drrg7"]
[ext_resource type="Texture2D" uid="uid://bj1lt3rs788c0" path="res://assets/textures/right.png" id="6_07ka3"]
[node name="Slideshow" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_c4yco")
[node name="Container" type="MarginContainer" parent="."]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="ScrollContainer" type="ScrollContainer" parent="Container"]
layout_mode = 2
vertical_scroll_mode = 0
[node name="Frame" type="HBoxContainer" parent="Container/ScrollContainer"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
alignment = 1
[node name="Previous" type="TextureButton" parent="Container/ScrollContainer/Frame"]
unique_name_in_owner = true
layout_mode = 2
keep_pressed_outside = true
texture_normal = ExtResource("2_ipc81")
stretch_mode = 3
[node name="ContentFrame" type="PanelContainer" parent="Container/ScrollContainer/Frame"]
clip_children = 1
layout_mode = 2
size_flags_horizontal = 3
[node name="MarginContainer" type="MarginContainer" parent="Container/ScrollContainer/Frame/ContentFrame"]
layout_mode = 2
theme_override_constants/margin_left = 16
theme_override_constants/margin_top = 16
theme_override_constants/margin_right = 16
theme_override_constants/margin_bottom = 16
[node name="Content" type="Control" parent="Container/ScrollContainer/Frame/ContentFrame/MarginContainer"]
unique_name_in_owner = true
layout_mode = 2
[node name="TextureRect" type="TextureRect" parent="Container/ScrollContainer/Frame/ContentFrame/MarginContainer/Content"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
size_flags_horizontal = 3
texture = ExtResource("3_r020g")
expand_mode = 1
[node name="HBoxContainer" type="HBoxContainer" parent="Container/ScrollContainer/Frame/ContentFrame/MarginContainer/Content"]
layout_mode = 0
offset_right = 914.0
offset_bottom = 392.0
[node name="TextureRect2" type="TextureRect" parent="Container/ScrollContainer/Frame/ContentFrame/MarginContainer/Content/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
texture = ExtResource("4_k2rtf")
[node name="TextureRect3" type="TextureRect" parent="Container/ScrollContainer/Frame/ContentFrame/MarginContainer/Content/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
texture = ExtResource("4_k2rtf")
[node name="TextureRect4" type="TextureRect" parent="Container/ScrollContainer/Frame/ContentFrame/MarginContainer/Content/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
texture = ExtResource("4_k2rtf")
[node name="TextureRect3" type="TextureRect" parent="Container/ScrollContainer/Frame/ContentFrame/MarginContainer/Content"]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
grow_horizontal = 2
grow_vertical = 2
size_flags_horizontal = 3
texture = ExtResource("5_drrg7")
stretch_mode = 5
[node name="Next" type="TextureButton" parent="Container/ScrollContainer/Frame"]
unique_name_in_owner = true
layout_mode = 2
keep_pressed_outside = true
texture_normal = ExtResource("6_07ka3")
stretch_mode = 3

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://htlpmfnfxo0p"
path="res://.godot/imported/airplanecomercial.png-3604b65d4ac6f1ad581f4e92ef3402ff.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/textures/airplanecomercial.png"
dest_files=["res://.godot/imported/airplanecomercial.png-3604b65d4ac6f1ad581f4e92ef3402ff.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.

After

Width:  |  Height:  |  Size: 15 KiB

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://b0clm03ld3sqt"
path="res://.godot/imported/checkmark.png-90bf058668dc6a15e6471f7d8f9eb18b.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/textures/checkmark.png"
dest_files=["res://.godot/imported/checkmark.png-90bf058668dc6a15e6471f7d8f9eb18b.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

BIN
assets/textures/coin.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cq85cp58w2yo"
path="res://.godot/imported/coin.png-a2185d81c51e3615d0293c91c41f2138.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/textures/coin.png"
dest_files=["res://.godot/imported/coin.png-a2185d81c51e3615d0293c91c41f2138.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.

After

Width:  |  Height:  |  Size: 15 KiB

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://gq2e4nsmxvgv"
path="res://.godot/imported/exclamation.png-12d4abaa636464265fe9bf460e2c4bc3.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/textures/exclamation.png"
dest_files=["res://.godot/imported/exclamation.png-12d4abaa636464265fe9bf460e2c4bc3.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

BIN
assets/textures/left.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://hae3xxu5gi1j"
path="res://.godot/imported/left.png-bd97b939cfc653e64b2698a809562f8d.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/textures/left.png"
dest_files=["res://.godot/imported/left.png-bd97b939cfc653e64b2698a809562f8d.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

BIN
assets/textures/right.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bj1lt3rs788c0"
path="res://.godot/imported/right.png-e73bbacd62879aa4c672f3bc1e84ca8e.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/textures/right.png"
dest_files=["res://.godot/imported/right.png-e73bbacd62879aa4c672f3bc1e84ca8e.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

1
icon.svg Normal file
View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="128" height="128"><rect width="124" height="124" x="2" y="2" fill="#363d52" stroke="#212532" stroke-width="4" rx="14"/><g fill="#fff" transform="translate(12.322 12.322)scale(.101)"><path d="M105 673v33q407 354 814 0v-33z"/><path fill="#478cbf" d="m105 673 152 14q12 1 15 14l4 67 132 10 8-61q2-11 15-15h162q13 4 15 15l8 61 132-10 4-67q3-13 15-14l152-14V427q30-39 56-81-35-59-83-108-43 20-82 47-40-37-88-64 7-51 8-102-59-28-123-42-26 43-46 89-49-7-98 0-20-46-46-89-64 14-123 42 1 51 8 102-48 27-88 64-39-27-82-47-48 49-83 108 26 42 56 81zm0 33v39c0 276 813 276 814 0v-39l-134 12-5 69q-2 10-14 13l-162 11q-12 0-16-11l-10-65H446l-10 65q-4 11-16 11l-162-11q-12-3-14-13l-5-69z"/><path d="M483 600c0 34 58 34 58 0v-86c0-34-58-34-58 0z"/><circle cx="725" cy="526" r="90"/><circle cx="299" cy="526" r="90"/></g><g fill="#414042" transform="translate(12.322 12.322)scale(.101)"><circle cx="307" cy="532" r="60"/><circle cx="717" cy="532" r="60"/></g></svg>

After

Width:  |  Height:  |  Size: 994 B

37
icon.svg.import Normal file
View file

@ -0,0 +1,37 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://64vwvssqlvbo"
path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://icon.svg"
dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.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
svg/scale=1.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false

16
project.godot Normal file
View file

@ -0,0 +1,16 @@
; Engine configuration file.
; It's best edited using the editor UI and not directly,
; since the parameters that go here are not all obvious.
;
; Format:
; [section] ; section goes between []
; param=value ; assign values to parameters
config_version=5
[application]
config/name="Slideshow"
run/main_scene="res://Slideshow.tscn"
config/features=PackedStringArray("4.3", "Forward Plus")
config/icon="res://icon.svg"