ECS/Concord - resolved
Posted: Tue Nov 30, 2021 9:59 pm
Edit: resolved - my code is one valid way. Leaving here for others.
Hi all - any ECS/Concord users here?
I'm new to ECS and trying to rewire my brain. Just checking if this example is the right way to DRAW entities:
Lots of code but really - is my systemDraw the right way to manage the drawing of many different types of entities?
Hi all - any ECS/Concord users here?
I'm new to ECS and trying to rewire my brain. Just checking if this example is the right way to DRAW entities:
Code: Select all
-- define components
Concord.component("isSquare")
Concord.component("isCircle")
-- define Systems
systemDraw = Concord.system({
pool = {"drawable"}
})
function systemDraw:draw()
for _, e in ipairs(self.pool) do
if e.isSquare ~= nil then
-- use love.graphics.rectangle
end
if e.isCircle ~= nil then
-- use love.graphics.circle
end
end
end
-- Add the Systems
WORLD:addSystems(systemDraw)
-- add entities
shape1 = Concord.entity(WORLD)
:give("isSquare")
:give("drawable")
shape2 = Concord.entity(WORLD)
:give("isCircle")
:give("drawable")
Lots of code but really - is my systemDraw the right way to manage the drawing of many different types of entities?