2026-06-08 15:54:26 +02:00
|
|
|
local api = ...
|
2026-06-12 09:59:47 +02:00
|
|
|
local ecs = api.ecs
|
2026-06-08 15:54:26 +02:00
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
name = "skeleton",
|
|
|
|
|
enabled = true,
|
|
|
|
|
|
2026-06-12 09:59:47 +02:00
|
|
|
init = function()
|
|
|
|
|
--api.ext.skeleton.extendECS()
|
|
|
|
|
end,
|
2026-06-08 15:54:26 +02:00
|
|
|
|
|
|
|
|
update = function()
|
|
|
|
|
local iui = api.iui
|
|
|
|
|
local backend = api.backend
|
|
|
|
|
local mainWindow = api.mainWindow
|
|
|
|
|
end,
|
|
|
|
|
|
|
|
|
|
load = function() end,
|
|
|
|
|
|
|
|
|
|
draw = function(pass)
|
|
|
|
|
if api.iui.idiom == "vr" then
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
|
|
end
|
2026-06-12 09:59:47 +02:00
|
|
|
end,
|
|
|
|
|
|
|
|
|
|
-- ECS API docs: https://bakpakin.github.io/tiny-ecs/doc
|
|
|
|
|
extendECS = function()
|
|
|
|
|
|
|
|
|
|
local exampleSystem = ecs.processingSystem({
|
|
|
|
|
updatethread = true,
|
|
|
|
|
-- drawthread = true
|
|
|
|
|
filter = ecs.requireAll('mycomponent'),
|
|
|
|
|
onAdd = function(self,obj) print_r(obj) end,
|
|
|
|
|
onRemove = function(self,obj) end,
|
|
|
|
|
process = function(self,obj) end,
|
|
|
|
|
})
|
|
|
|
|
ecs.addSystem( api.world, exampleSystem )
|
|
|
|
|
|
|
|
|
|
-- add example entity object
|
|
|
|
|
local obj = { foo = "bar", mycomponent = { a = 1 } }
|
|
|
|
|
ecs.add( api.world, obj )
|
|
|
|
|
obj.commit() -- notify other systems to update entitycache
|
|
|
|
|
|
2026-06-08 15:54:26 +02:00
|
|
|
end
|
|
|
|
|
}
|