From 8653ab0d2bb46218885103a90e0138fe9ecabb15 Mon Sep 17 00:00:00 2001 From: Clevertop <41929769+Clevertop@users.noreply.github.com> Date: Tue, 24 Sep 2024 10:34:17 +1000 Subject: [PATCH] basic setup --- .gitattributes | 4 +-- .gitignore | 14 +--------- icon.svg | 1 + icon.svg.import | 37 ++++++++++++++++++++++++ project.godot | 44 +++++++++++++++++++++++++++++ slides/standard.tscn | 15 ++++++++++ tools/Presentation.gd | 62 +++++++++++++++++++++++++++++++++++++++++ tools/base_slide.tscn | 8 ++++++ tools/presentation.tscn | 37 ++++++++++++++++++++++++ widgets/header.gd | 58 ++++++++++++++++++++++++++++++++++++++ widgets/header.tscn | 40 ++++++++++++++++++++++++++ 11 files changed, 305 insertions(+), 15 deletions(-) create mode 100644 icon.svg create mode 100644 icon.svg.import create mode 100644 project.godot create mode 100644 slides/standard.tscn create mode 100644 tools/Presentation.gd create mode 100644 tools/base_slide.tscn create mode 100644 tools/presentation.tscn create mode 100644 widgets/header.gd create mode 100644 widgets/header.tscn diff --git a/.gitattributes b/.gitattributes index dfe0770..8ad74f7 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,2 +1,2 @@ -# Auto detect text files and perform LF normalization -* text=auto +# Normalize EOL for all files that Git considers text files. +* text=auto eol=lf diff --git a/.gitignore b/.gitignore index d9aac21..0af181c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,15 +1,3 @@ # Godot 4+ specific ignores .godot/ - -# Godot-specific ignores -.import/ -export.cfg -export_presets.cfg - -# Imported translations (automatically generated from CSV files) -*.translation - -# Mono-specific ignores -.mono/ -data_*/ -mono_crash.*.json +/android/ diff --git a/icon.svg b/icon.svg new file mode 100644 index 0000000..9d8b7fa --- /dev/null +++ b/icon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/icon.svg.import b/icon.svg.import new file mode 100644 index 0000000..92091d9 --- /dev/null +++ b/icon.svg.import @@ -0,0 +1,37 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dweu560gyqjqy" +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 diff --git a/project.godot b/project.godot new file mode 100644 index 0000000..3e6192c --- /dev/null +++ b/project.godot @@ -0,0 +1,44 @@ +; 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="GoSlides" +run/main_scene="res://tools/presentation.tscn" +config/features=PackedStringArray("4.3", "GL Compatibility") +config/icon="res://icon.svg" + +[display] + +window/size/viewport_width=1920 +window/size/viewport_height=1080 + +[input] + +next={ +"deadzone": 0.5, +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194321,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null) +] +} +previous={ +"deadzone": 0.5, +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194319,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null) +] +} +exit={ +"deadzone": 0.5, +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194305,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null) +] +} + +[rendering] + +renderer/rendering_method="gl_compatibility" +renderer/rendering_method.mobile="gl_compatibility" diff --git a/slides/standard.tscn b/slides/standard.tscn new file mode 100644 index 0000000..077f378 --- /dev/null +++ b/slides/standard.tscn @@ -0,0 +1,15 @@ +[gd_scene load_steps=2 format=3 uid="uid://ccokwij05tg74"] + +[ext_resource type="PackedScene" uid="uid://b3hn5sbsngqud" path="res://widgets/header.tscn" id="1_bhwne"] + +[node name="BaseSlide" type="VBoxContainer"] +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="Header" parent="." instance=ExtResource("1_bhwne")] +layout_mode = 2 +title = "Welcome to Godot!" +subtitle = "It's a really cool engine!" diff --git a/tools/Presentation.gd b/tools/Presentation.gd new file mode 100644 index 0000000..5968389 --- /dev/null +++ b/tools/Presentation.gd @@ -0,0 +1,62 @@ +extends Node +#class_name +#Authored by Tom. Please consult for any modifications or major feature requests. + +#region Variables +#Signals + +#Enums + +#Constants + +#Exported Variables +#@export_group("Group") +#@export_subgroup("Subgroup") +@export var slides_node : Control + +#Onready Variables + +#Other Variables (please try to separate and organise!) +var slides : Array[Node] +var current_slide : int = 0 +var total_slides : int + +#endregion + +#region Godot methods +func _ready(): + slides = slides_node.get_children() + total_slides = slides_node.get_child_count() + for slide in slides: + slide.hide() + slides[current_slide].show() + pass + +func _process(delta): + if(Input.is_action_just_pressed("next")): + if current_slide < total_slides-1: + show_next_slide() + elif(Input.is_action_just_pressed("previous")): + if current_slide > 0: + show_previous_slide() +#endregion + +#region Signal methods + +#endregion + +#region Other methods (please try to separate and organise!) + +func show_next_slide(): + slides[current_slide].hide() + current_slide += 1 + slides[current_slide].show() + + +func show_previous_slide(): + slides[current_slide].hide() + current_slide -= 1 + slides[current_slide].show() + + +#endregion diff --git a/tools/base_slide.tscn b/tools/base_slide.tscn new file mode 100644 index 0000000..488e32b --- /dev/null +++ b/tools/base_slide.tscn @@ -0,0 +1,8 @@ +[gd_scene format=3 uid="uid://xxqqqjgt1vmc"] + +[node name="BaseSlide" type="VBoxContainer"] +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 diff --git a/tools/presentation.tscn b/tools/presentation.tscn new file mode 100644 index 0000000..e9d7caa --- /dev/null +++ b/tools/presentation.tscn @@ -0,0 +1,37 @@ +[gd_scene load_steps=5 format=3 uid="uid://c7f5wae7pdjt2"] + +[ext_resource type="Script" path="res://tools/Presentation.gd" id="1_qta7b"] +[ext_resource type="PackedScene" uid="uid://xxqqqjgt1vmc" path="res://tools/base_slide.tscn" id="2_aqnf4"] + +[sub_resource type="Gradient" id="Gradient_7sx77"] +colors = PackedColorArray(0.15482, 0.358303, 0.295465, 1, 0, 0.391486, 0.564688, 1) + +[sub_resource type="GradientTexture2D" id="GradientTexture2D_dod57"] +gradient = SubResource("Gradient_7sx77") +fill_from = Vector2(0, 1) + +[node name="Presentation" type="Node" node_paths=PackedStringArray("slides_node")] +script = ExtResource("1_qta7b") +slides_node = NodePath("Slides") + +[node name="PresentationBackground" type="TextureRect" parent="."] +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +texture = SubResource("GradientTexture2D_dod57") + +[node name="Slides" type="Control" parent="."] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 + +[node name="BaseSlide" parent="Slides" instance=ExtResource("2_aqnf4")] +layout_mode = 0 +anchors_preset = 0 diff --git a/widgets/header.gd b/widgets/header.gd new file mode 100644 index 0000000..99f2f24 --- /dev/null +++ b/widgets/header.gd @@ -0,0 +1,58 @@ +@tool +extends PanelContainer +#class_name +#Authored by Tom. Please consult for any modifications or major feature requests. + +#region Variables +#Signals + +#Enums + +#Constants + +#Exported Variables +#@export_group("Group") +#@export_subgroup("Subgroup") +@export var title : String: + set(value) : + title = value + title_node.text = title +@export var subtitle : String: + set(value) : + subtitle = value + subtitle_node.text = subtitle + subtitle_node.visible = subtitle_node.text != "" +@export_group("Node References") +@export var title_node : Label +@export var subtitle_node : Label + +#Onready Variables + +#Other Variables (please try to separate and organise!) + +#endregion + +#region Godot methods +func _ready(): + #Runs when all children have entered the tree + pass + +func _process(delta): + #Runs per frame + pass +#endregion + +#region Signal methods + +#endregion + +#region Other methods (please try to separate and organise!) +#func set_title(text : String): + #title = text + #title_node.text = title + # +#func set_subtitle(text : String): + #subtitle = text + #subtitle_node.text = title + #subtitle_node.visible = subtitle_node.text != "" +#endregion diff --git a/widgets/header.tscn b/widgets/header.tscn new file mode 100644 index 0000000..4a7f8ed --- /dev/null +++ b/widgets/header.tscn @@ -0,0 +1,40 @@ +[gd_scene load_steps=6 format=3 uid="uid://b3hn5sbsngqud"] + +[ext_resource type="Script" path="res://widgets/header.gd" id="1_h4khk"] + +[sub_resource type="Gradient" id="Gradient_o7xwa"] +colors = PackedColorArray(0.46429, 0.00206019, 0.726487, 1, 0.305082, 0.490299, 1, 1) + +[sub_resource type="GradientTexture2D" id="GradientTexture2D_vfh7v"] +gradient = SubResource("Gradient_o7xwa") +fill_from = Vector2(0, 1) + +[sub_resource type="LabelSettings" id="LabelSettings_mjry0"] +font_size = 66 + +[sub_resource type="LabelSettings" id="LabelSettings_2kr3f"] +font_size = 36 + +[node name="Header" type="PanelContainer" node_paths=PackedStringArray("title_node", "subtitle_node")] +script = ExtResource("1_h4khk") +title_node = NodePath("VBoxContainer/Title") +subtitle_node = NodePath("VBoxContainer/Subtitle") + +[node name="Gradient" type="TextureRect" parent="."] +layout_mode = 2 +texture = SubResource("GradientTexture2D_vfh7v") + +[node name="VBoxContainer" type="VBoxContainer" parent="."] +layout_mode = 2 + +[node name="Title" type="Label" parent="VBoxContainer"] +layout_mode = 2 +text = "Title" +label_settings = SubResource("LabelSettings_mjry0") +horizontal_alignment = 1 + +[node name="Subtitle" type="Label" parent="VBoxContainer"] +layout_mode = 2 +text = "Title" +label_settings = SubResource("LabelSettings_2kr3f") +horizontal_alignment = 1