Add more methods to entrypoint.gd

This commit is contained in:
JeremyStar™ 2024-05-14 00:05:35 +02:00
parent 79e7da1afd
commit 36492503be
Signed by: JeremyStarTM
GPG key ID: E366BAEF67E4704D
3 changed files with 31 additions and 2 deletions

View file

@ -21,5 +21,8 @@ var core: Core
var logger: CoreLoggerInstance var logger: CoreLoggerInstance
# Required methods # Required methods
func load_resources() -> void: core.logger.crash("PresencodeEntrypoint", "Method load_resources was not overriden") func initialize() -> void: core.logger.crash("PresencodeEntrypoint", "Method initialize was not overriden")
func switch_to_slide(_slide: int) -> void: core.logger.crash("PresencodeEntrypoint", "Method switch_to_slide was not overriden") func switch_to_slide(_slide: int) -> void: core.logger.crash("PresencodeEntrypoint", "Method switch_to_slide was not overriden")
# Optional methods
func play_animation(_type: PresencodeTypes.AnimationStage, _old_slide: int, _new_slide: int) -> void: pass

20
src/classes/types.gd Normal file
View file

@ -0,0 +1,20 @@
# PRESENCODE SOURCE FILE
# Copyright (c) 2024 JeremyStarTM & Contributors
# Licensed under the GNU Affero General Public License v3
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
extends Node
class_name PresencodeTypes
enum AnimationStage { BEFORE, AFTER }

View file

@ -232,9 +232,15 @@ func inject_entrypoint() -> void:
# Instantiate new PresencodeEntrypoint # Instantiate new PresencodeEntrypoint
var entrypoint_node: PresencodeEntrypoint = PresencodeEntrypoint.new() var entrypoint_node: PresencodeEntrypoint = PresencodeEntrypoint.new()
# Give the new node a name and the entrypoint script
entrypoint_node.name = "Entrypoint" entrypoint_node.name = "Entrypoint"
entrypoint_node.set_script(entrypoint) entrypoint_node.set_script(entrypoint)
# Update variables
entrypoint_node.core = core
entrypoint_node.logger = communication.get_source_path("src/" + manifest["entrypoint"])
# Add to SceneTree # Add to SceneTree
get_tree().root.add_child(entrypoint_node) get_tree().root.add_child(entrypoint_node)
# Execute initialize()
await entrypoint_node.initialize()