1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-31 15:39:49 +00:00

Enable tile drawing mode when clicking on a tile button

This commit is contained in:
Emmanouil Papadeas 2024-11-25 17:22:38 +02:00
parent 6f3e3c8566
commit 5c90501293

View file

@ -10,6 +10,7 @@ static var tile_editing_mode := TileEditingMode.AUTO
static var selected_tile_index := 0 static var selected_tile_index := 0
var current_tileset: TileSetCustom var current_tileset: TileSetCustom
@onready var place_tiles: CheckBox = $VBoxContainer/PlaceTiles
@onready var tile_button_container: HFlowContainer = %TileButtonContainer @onready var tile_button_container: HFlowContainer = %TileButtonContainer
@ -45,7 +46,7 @@ func _update_tileset(cel: BaseCel) -> void:
var texture := ImageTexture.create_from_image(tile.image) var texture := ImageTexture.create_from_image(tile.image)
var button := _create_tile_button(texture, i, button_group) var button := _create_tile_button(texture, i, button_group)
if i == selected_tile_index: if i == selected_tile_index:
button.button_pressed = true button.set_pressed_no_signal(true)
tile_button_container.add_child(button) tile_button_container.add_child(button)
@ -82,6 +83,7 @@ func select_tile(tile_index: int) -> void:
func _on_tile_button_toggled(toggled_on: bool, index: int) -> void: func _on_tile_button_toggled(toggled_on: bool, index: int) -> void:
if toggled_on: if toggled_on:
selected_tile_index = index selected_tile_index = index
place_tiles.button_pressed = true
func _clear_tile_buttons() -> void: func _clear_tile_buttons() -> void: