2024-04-24 11:11:16 +02:00
|
|
|
--cd("/cirnofarm/src")
|
|
|
|
|
--include("/cirnofarm/src/cirno.lua")
|
|
|
|
|
|
|
|
|
|
function make_path(name)
|
|
|
|
|
local base_path = "/cirnofarm/src/" -- Change this when releasing
|
|
|
|
|
return base_path .. name
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
local _modules = {}
|
|
|
|
|
|
|
|
|
|
function loadfile (filename)
|
|
|
|
|
local src = fetch(filename)
|
|
|
|
|
|
|
|
|
|
if (type(src) ~= "string") then
|
|
|
|
|
notify("could not include "..filename)
|
|
|
|
|
stop()
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- https://www.lua.org/manual/5.4/manual.html#pdf-load
|
|
|
|
|
-- chunk name (for error reporting), mode ("t" for text only -- no binary chunk loading), _ENV upvalue
|
|
|
|
|
-- @ is a special character that tells debugger the string is a filename
|
|
|
|
|
local func,err = load(src, "@"..filename, "t", _ENV)
|
|
|
|
|
-- syntax error while loading
|
|
|
|
|
if (not func) then
|
|
|
|
|
send_message(3, {event="report_error", content = "*syntax error"})
|
|
|
|
|
send_message(3, {event="report_error", content = tostr(err)})
|
|
|
|
|
|
|
|
|
|
stop()
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
return func
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function require(name)
|
|
|
|
|
local already_imported = _modules[name]
|
|
|
|
|
if already_imported ~= nil then
|
|
|
|
|
return already_imported
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
local filename = fullpath(name:gsub ('%.', '/') ..'.lua')
|
|
|
|
|
|
|
|
|
|
local func = loadfile (filename)
|
|
|
|
|
|
|
|
|
|
local module = func(name)
|
|
|
|
|
_modules[name]=module
|
|
|
|
|
|
|
|
|
|
return module
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--local strawberry = require(make_path("strawberry"))
|
|
|
|
|
--strawberry.func()
|
|
|
|
|
|
|
|
|
|
local cirno = require(make_path("cirno"))
|
|
|
|
|
local mouse_debug = require(make_path("mouse_debug"))
|
|
|
|
|
|
|
|
|
|
tile_width = 16
|
|
|
|
|
tile_height = 16
|
2024-04-14 15:51:45 +02:00
|
|
|
|
|
|
|
|
function _init()
|
2024-04-24 11:11:16 +02:00
|
|
|
cirno.init()
|
2024-04-14 15:51:45 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function _update()
|
2024-04-24 11:11:16 +02:00
|
|
|
cirno.update()
|
2024-04-14 15:51:45 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function _draw()
|
2024-04-24 11:11:16 +02:00
|
|
|
cirno.draw()
|
2024-04-24 22:53:04 +02:00
|
|
|
mouse_debug.draw(4, tile_width, tile_height)
|
2024-04-14 15:51:45 +02:00
|
|
|
end
|