added assets button press signal
authorEduardo <[email protected]>
Tue, 25 Jun 2024 18:16:43 +0000 (20:16 +0200)
committerEduardo <[email protected]>
Tue, 25 Jun 2024 18:16:43 +0000 (20:16 +0200)
scripts/interface.gd

index 78607216b7b4cac394728ea58da1c68e8466f98b..f3f4874fa7459e9c77777a4cc6d809fe2360270d 100644 (file)
@@ -27,8 +27,10 @@ var layer_controls_open: bool = false
 var movement_controls_open: bool = false
 var colors_menu_open: bool = false
 
+
 signal move_layer(LAYER_MOVEMENT)
 signal move_drawing(MOVEMENT, multiplier: int)
+signal asset_selected(asset_path: String)
 
 
 #region build in funcs
@@ -184,6 +186,10 @@ func _on_multiplier_button_pressed():
        movement_multiplier_label.text = " " + str(movement_multiplier)
 
 
+func _on_asset_selected(file_path: String):
+       asset_selected.emit(file_path)
+
+
 #endregion
 
 #region utils
@@ -206,6 +212,7 @@ func add_timer_with_timeout(function: Callable, seconds: float = 2):
        timer.timeout.connect(timer.queue_free)
        add_child(timer)
 
+
 #endregion
 
 #region signal callbacks
@@ -253,6 +260,8 @@ func _on_section_content(sections: Array[Globals.Section]):
                        texture_button.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT, Control.PRESET_MODE_KEEP_SIZE, ASSET_MARGIN)
                        texture_button.ignore_texture_size = true
                        texture_button.custom_minimum_size = ASSET_MIN_SIZE
+                       
+                       texture_button.pressed.connect(_on_asset_selected.bind(file_path))
 
                        var image = Image.load_from_file(miniature_file_path)
                        var texture = ImageTexture.create_from_image(image)