But I am stuck on why my code doesn't work. I have Googled for answers, but no results.
When I gives filter to the Tiny world update, it doesn't work. But If I removed the filter, it works. Am I using the filter correctly?
Thanks.
Code: Select all
local tiny = require("lib/tiny")
local debugRenderSystem = tiny.processingSystem()
debugRenderSystem.filter = tiny.requireAll('debugRenderable','position','size')
function debugRenderSystem:process(e, dt)
love.graphics.rectangle('line',e.position.x,e.position.y,e.size.width,e.size.height)
end
local bird = {
position = {x = 100, y = 200},
size = {width = 30, height = 20},
debugRenderable = true,
}
local world = tiny.world()
tiny.addEntity(world, bird)
tiny.addSystem(world, debugRenderSystem)
-- Main draw callback
function love.draw()
local dt = love.timer.getDelta()
-- This next line doesn't work
tiny.update(world, dt, tiny.filter('debugRenderable') )
-- But, if no filter applied, it works
-- tiny.update(world, dt )
end