Add input detection (fullscreen & navigation)

This commit is contained in:
JeremyStar™ 2024-05-17 01:47:23 +02:00
parent c43fdc74e3
commit 195116fe1f
Signed by: JeremyStarTM
GPG key ID: E366BAEF67E4704D
2 changed files with 23 additions and 0 deletions

View file

@ -38,6 +38,19 @@ func _init(core_new: Core, presenloader_new: Node) -> void:
presenloader = presenloader_new presenloader = presenloader_new
func _process(_delta: float) -> void:
# Check for inputs
if Input.is_action_just_pressed("fullscreen"):
logger.diag("Toggling fullscreen mode")
match(DisplayServer.window_get_mode()):
DisplayServer.WindowMode.WINDOW_MODE_WINDOWED: DisplayServer.window_set_mode(DisplayServer.WindowMode.WINDOW_MODE_FULLSCREEN)
_: DisplayServer.window_set_mode(DisplayServer.WindowMode.WINDOW_MODE_WINDOWED)
if Input.is_action_just_pressed("navigate_forwards"):
switch_slide(current_slide + 1)
if Input.is_action_just_pressed("navigate_backwards"):
switch_slide(current_slide - 1)
entrypoint = presenloader.entrypoint_node entrypoint = presenloader.entrypoint_node
manifest = presenloader.manifest manifest = presenloader.manifest

View file

@ -105,6 +105,16 @@ func load_high_quality_wallpaper() -> void:
) )
thread_wallpaper.wait_to_finish() thread_wallpaper.wait_to_finish()
# +++ processing +++
func _process(_delta: float) -> void:
# Check for inputs
if Input.is_action_just_pressed("fullscreen"):
logger.diag("Toggling fullscreen mode")
match(DisplayServer.window_get_mode()):
DisplayServer.WindowMode.WINDOW_MODE_WINDOWED: DisplayServer.window_set_mode(DisplayServer.WindowMode.WINDOW_MODE_FULLSCREEN)
_: DisplayServer.window_set_mode(DisplayServer.WindowMode.WINDOW_MODE_WINDOWED)
# +++ unload & cleanup +++ # +++ unload & cleanup +++
func unload() -> void: func unload() -> void:
logger.info("Unloading user interface") logger.info("Unloading user interface")