aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoriamcheeseman <[email protected]>2026-03-12 17:00:24 -0400
committeriamcheeseman <[email protected]>2026-03-12 17:00:24 -0400
commit97d2fc1f3cef3c02fee36e416a8f2b5205940be2 (patch)
tree88b7b6a16e931433bfd25328078f6ba213b567ff /src
parentc11b02ac27e68a218ea80826765cd1631e95e6d0 (diff)
show the tileset you're using
Diffstat (limited to 'src')
-rw-r--r--src/objs/player.lua2
-rw-r--r--src/objs/tilemap.lua11
2 files changed, 12 insertions, 1 deletions
diff --git a/src/objs/player.lua b/src/objs/player.lua
index c046c7c..4b75cb3 100644
--- a/src/objs/player.lua
+++ b/src/objs/player.lua
@@ -54,6 +54,8 @@ function player_ui_sys(_)
tile = tile + 1
end
im.layout()
+
+ im.image(TILE_TEX, get_tileset_quad(tile))
im.end_window()
end
diff --git a/src/objs/tilemap.lua b/src/objs/tilemap.lua
index 8b1ab76..f1cdd15 100644
--- a/src/objs/tilemap.lua
+++ b/src/objs/tilemap.lua
@@ -107,7 +107,7 @@ function rebuild_tilemap(map)
end
end
-local TILE_TEX = get_tex("res/img/tilesets.png")
+TILE_TEX = get_tex("res/img/tilesets.png")
local TILE_QUAD = lg.newQuad(
0, 0,
TILESIZE, TILESIZE,
@@ -150,3 +150,12 @@ function remove_tile(map, x, y)
map.tiledata[ID(map, x, y)] = 0
map.needs_rebuild = true
end
+
+function get_tileset_quad(tileset)
+ local start_y = (tileset - 1) * 4 * TILESIZE
+ return lg.newQuad(
+ 0, start_y,
+ 4 * TILESIZE, 4 * TILESIZE,
+ TILE_TEX:getDimensions()
+ )
+end