miggor-StreamGraph/main.gd
Lera Elvoé d98d6f52bd add a new main scene (#89)
Reviewed-on: https://codeberg.org/StreamGraph/StreamGraph/pulls/89
Co-authored-by: Lera Elvoé <yagich@poto.cafe>
Co-committed-by: Lera Elvoé <yagich@poto.cafe>
2024-02-29 18:41:53 +00:00

32 lines
1,016 B
GDScript

# (c) 2023-present Eroax
# (c) 2023-present Yagich
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
extends Node
const DEFAULT_RENDERER := preload("res://graph_node_renderer/deck_holder_renderer.tscn")
var deck_holder_renderer: DeckHolderRenderer = null
var deck_holder_renderer_finished := false
func _ready() -> void:
get_tree().auto_accept_quit = false
if DisplayServer.get_name() != "headless":
# not headless, start default renderer
deck_holder_renderer = DEFAULT_RENDERER.instantiate()
add_child(deck_holder_renderer)
deck_holder_renderer.quit_completed.connect(_on_deck_holder_renderer_quit_completed)
func _on_deck_holder_renderer_quit_completed() -> void:
# will be used later to make sure both default and rpc are finished processing
deck_holder_renderer_finished = true
get_tree().quit()
func _notification(what: int) -> void:
if what == NOTIFICATION_WM_CLOSE_REQUEST:
if deck_holder_renderer:
deck_holder_renderer.request_quit()