[TinyECS] Filtering Doesn't Work

Showcase your libraries, tools and other projects that help your fellow love users.
Post Reply
uvector
Prole
Posts: 1
Joined: Sat Feb 03, 2018 1:58 am

[TinyECS] Filtering Doesn't Work

Post by uvector »

Hi, Everyone. I'm currently learning to use the ECS system. I'm using Tiny ECS.

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
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 50 guests