miggor-StreamGraph/test.gd

33 lines
1,018 B
GDScript3
Raw Normal View History

extends Control
var node_renderer_scene := preload("res://test_node_renderer.tscn")
@onready var nodes_container: HBoxContainer = $NodesContainer
@onready var add_button_button: Button = $AddButtonButton
@onready var add_print_button: Button = $AddPrintButton
@onready var connect_them_button: Button = $ConnectThemButton
var deck: Deck = Deck.new()
var button_node = preload("res://classes/deck/nodes/button.gd")
var print_node = preload("res://classes/deck/nodes/print.gd")
func _ready() -> void:
add_button_button.pressed.connect(
func():
var node := deck.add_node(button_node)
var node_renderer = node_renderer_scene.instantiate()
node_renderer.node = node
nodes_container.add_child(node_renderer)
add_button_button.disabled = true
)
add_print_button.pressed.connect(
func():
var node := deck.add_node(print_node)
var node_renderer = node_renderer_scene.instantiate()
node_renderer.node = node
nodes_container.add_child(node_renderer)
add_print_button.disabled = true
)