Godot-RTS-Template/autoloads/bootstrap.gd

26 lines
643 B
GDScript3
Raw Normal View History

2025-07-31 17:34:57 +00:00
extends Node
## Should always be at the top of autoloads
func _ready() -> void:
var loader := AssetLoader.new()
# If there was a critical error, quit immediately
if loader.critical_error:
Engine.get_main_loop().quit(1)
return
loader.load_all() # TODO: Making it async
# Otherwise, continue startup
_start_game()
## This will show a native MessageBox on Windows,
## a native dialog on macOS, and GTK/QT dialog on Linux.
func _show_error_popup(context:String, message: String) -> void:
OS.alert(context+":"+message, context+":Error")
func _start_game() -> void:
print("Game starting...")
#TODO: Load main menu or world scene