mirror of
https://gitlab.com/MaddoScientisto/cirnofarm.git
synced 2026-06-01 11:15:34 +00:00
42 lines
No EOL
1.1 KiB
Lua
42 lines
No EOL
1.1 KiB
Lua
--[[pod_format="raw",created="2024-04-22 19:55:03",modified="2024-04-22 20:14:14",revision=9]]
|
|
M = {}
|
|
|
|
function debug_mouse(layers_count, tile_width, tile_height)
|
|
local mx,my = mouse()
|
|
local x_offset = 5
|
|
local y_offset = 5
|
|
|
|
-- tile size
|
|
local tw=tile_width
|
|
local th=tile_height
|
|
|
|
-- window width and height
|
|
local w=480
|
|
local h=270
|
|
|
|
-- offset if box leaves screen
|
|
if mx>w-20 then x_offset=-15 end
|
|
if my>h-29 then y_offset=-24 end
|
|
|
|
-- draw debug text box
|
|
local tile_x = mx\tw
|
|
local tile_y = my\th
|
|
|
|
rect((tile_x*tw)+tw,(tile_y*th)+th,tile_x*tw,(tile_y*th),8)
|
|
rectfill(mx+x_offset-1,my+y_offset-1,mx+x_offset+14,my+y_offset+23+8,1)
|
|
print(string.format("%d (%d)",tile_x,mx),mx+x_offset,my+y_offset,8)
|
|
print(string.format("%d (%d)",tile_y,my),mx+x_offset,my+y_offset+8,9)
|
|
|
|
for i=layers_count,1,-1 do
|
|
local sprite = get_layer_tile(tile_x,tile_y,i)
|
|
local flag = fget(sprite)
|
|
print(sprite,mx+x_offset+(i*16),my+y_offset+8*2,10)
|
|
print(flag,mx+x_offset+(i*16),my+y_offset+8+8*2,10)
|
|
end
|
|
end
|
|
|
|
function M.draw(layers_count, tile_width, tile_height)
|
|
return debug_mouse(layers_count, tile_width, tile_height)
|
|
end
|
|
|
|
return M |