mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-31 15:39:49 +00:00
Add a way to show the indices of each tile, WIP
This commit is contained in:
parent
a4b33ad83c
commit
488c023838
|
@ -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")
|
||||
|
|
16
src/UI/Canvas/TileModeIndices.gd
Normal file
16
src/UI/Canvas/TileModeIndices.gd
Normal 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)
|
Loading…
Reference in a new issue