49 lines
1.7 KiB
Lua
49 lines
1.7 KiB
Lua
local maps = require("lib-core.maps")
|
|
|
|
-- inline stubs (extract in P.0.lib.{render,camera,input,player_control,actor,interaction})
|
|
local render = { hello = function() return "render stub" end }
|
|
local camera = { hello = function() return "camera stub" end }
|
|
local input = { hello = function() return "input stub" end }
|
|
local player_control = { hello = function() return "player_control stub" end }
|
|
local actor = { hello = function() return "actor stub" end }
|
|
local interaction = { hello = function() return "interaction stub" end }
|
|
|
|
-- Load + activate the demo map (P.0.lib.maps slice)
|
|
local demo_map = maps.load("maps/demo.map.json")
|
|
maps.set_current(demo_map)
|
|
|
|
local frames = 0
|
|
local TARGET_FRAMES = 60
|
|
|
|
function init(ctx)
|
|
engine.print("spine-prototype init: maps loaded")
|
|
engine.print("inline stubs loaded: "
|
|
.. render.hello() .. ", "
|
|
.. camera.hello() .. ", "
|
|
.. input.hello() .. ", "
|
|
.. player_control.hello() .. ", "
|
|
.. actor.hello() .. ", "
|
|
.. interaction.hello())
|
|
|
|
local size = maps.size()
|
|
engine.print(string.format("map size: %dx%d", size.w, size.h))
|
|
|
|
local corner = maps.tile_at(0, 0)
|
|
local interior = maps.tile_at(5, 5)
|
|
engine.print("tile at (0,0): " .. corner.id)
|
|
engine.print("tile at (5,5): " .. interior.id)
|
|
engine.print("walkable at (0,0): " .. tostring(maps.is_walkable(0, 0)))
|
|
engine.print("walkable at (5,5): " .. tostring(maps.is_walkable(5, 5)))
|
|
end
|
|
|
|
function update(ctx, dt)
|
|
frames = frames + 1
|
|
if frames >= TARGET_FRAMES then
|
|
engine.exit(0)
|
|
end
|
|
end
|
|
|
|
function cleanup(ctx)
|
|
engine.print("spine-prototype cleanup: total_frames=" .. frames)
|
|
end
|