This repository has been archived on 2024-08-28. You can view files and clone it, but cannot push or open issues or pull requests.
gmtk-2024/scripts/global.gd

25 lines
685 B
GDScript3
Raw Permalink Normal View History

2024-08-17 15:49:40 +00:00
extends Node
var previous_window_mode = -1
func _process(delta: float) -> void:
2024-08-17 21:39:51 +00:00
# keybinds
2024-08-17 15:49:40 +00:00
if Input.is_action_just_pressed("toggle_fullscreen"):
2024-08-19 02:16:36 +00:00
var window = get_window()
if window.mode == Window.MODE_FULLSCREEN:
2024-08-17 15:49:40 +00:00
if previous_window_mode != -1:
2024-08-19 02:16:36 +00:00
window.mode = previous_window_mode
2024-08-17 15:49:40 +00:00
else:
2024-08-19 02:16:36 +00:00
window.mode = Window.MODE_MAXIMIZED
2024-08-17 15:49:40 +00:00
else:
2024-08-19 02:16:36 +00:00
previous_window_mode = window.mode
window.mode = Window.MODE_FULLSCREEN
elif Input.is_action_just_pressed("back") and not OS.has_feature("web"):
var tree = get_tree()
print(tree.current_scene.name)
if tree.current_scene.name == "MainMenu":
tree.quit()
else:
tree.change_scene_to_file("res://ui/MainMenu.tscn")