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

Add a way to show the indices of each tile, WIP

This commit is contained in:
Emmanouil Papadeas 2024-11-22 02:08:17 +02:00
parent a4b33ad83c
commit 488c023838
2 changed files with 20 additions and 0 deletions

View file

@ -18,6 +18,7 @@
[ext_resource type="Shader" path="res://src/Shaders/AutoInvertColors.gdshader" id="17_lowhf"]
[ext_resource type="Script" path="res://src/UI/Canvas/ReferenceImages.gd" id="17_qfjb4"]
[ext_resource type="Script" path="res://src/UI/Canvas/color_index.gd" id="18_o3xx2"]
[ext_resource type="Script" path="res://src/UI/Canvas/TileModeIndices.gd" id="19_7a6wb"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_6b0ox"]
shader = ExtResource("1_253dh")
@ -113,3 +114,6 @@ script = ExtResource("16_nxilb")
[node name="ReferenceImages" type="Node2D" parent="."]
script = ExtResource("17_qfjb4")
[node name="TileModeIndices" type="Node2D" parent="."]
script = ExtResource("19_7a6wb")

View file

@ -0,0 +1,16 @@
extends Node2D
func _input(event: InputEvent) -> void:
queue_redraw()
func _draw() -> void:
var current_cel := Global.current_project.get_current_cel()
if current_cel is CelTileMap:
var tilemap_cel := current_cel as CelTileMap
for i in tilemap_cel.indices.size():
var x := float(tilemap_cel.tileset.tile_size.x) * (i % tilemap_cel.indices_x)
var y := float(tilemap_cel.tileset.tile_size.y) * (i / tilemap_cel.indices_x)
var pos := Vector2i(x, y + tilemap_cel.tileset.tile_size.y)
draw_string(Themes.get_font(), pos, str(tilemap_cel.indices[i]), 0, -1, 12)