Finalize example entrypoint.gd

This commit is contained in:
JeremyStar™ 2024-05-14 00:52:14 +02:00
parent 1fb0716cdf
commit dfe788ef20
Signed by: JeremyStarTM
GPG key ID: E366BAEF67E4704D

View file

@ -1,7 +1,22 @@
extends PresencodeEntrypoint
func initialize() -> void:
logger.info("Initialized entrypoint for example presentation")
var resources_list: Dictionary = { "slide_0": "slides/slide_0.tscn", "slide_1": "slides/slide_1.tscn" }
var resources: Dictionary = {}
func switch_slide(new_slide: int) -> void:
func initialize() -> void:
logger.info("Initializing entrypoint for example presentation")
# Load resources
resources = await api.load_resources(resources_list)
# Switch to starting slide
switch_to_slide(0)
func switch_to_slide(new_slide: int) -> void:
logger.info("Switching to slide " + str(new_slide))
# Remove all scenes
api.remove_all_slides()
# Add new slide
sms.add_scene("slide", "slide_" + str(new_slide), CoreTypes.SceneType.MAIN)