Merge pull request #25 from jackamo/fix/quick-readme-fixes

README: Fix 'Quick Example' to be runnable
This commit is contained in:
Justin van der Leij 2020-01-09 10:58:02 +01:00 committed by GitHub
commit be4a5d9ec7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -536,19 +536,19 @@ function MoveSystem:update(dt)
end end
local DrawSystem = Concord.System({Position, Drawable}) local DrawSystem = Concord.system({Position, Drawable})
function DrawSystem:draw() function DrawSystem:draw()
for _, e in ipairs(self.pool) do for _, e in ipairs(self.pool) do
local position = e[Position] local position = e[Position]
love.graphics.circle("fill", position.x, position.y, 5) love.graphics.circle("fill", position.x, position.y, 5)
end end
end end
-- Create the World -- Create the World
local world = World() local world = Concord.world()
-- Add the Systems -- Add the Systems
world:addSystems(MoveSystem, DrawSystem) world:addSystems(MoveSystem, DrawSystem)
@ -571,11 +571,11 @@ local entity_3 = Concord.entity(world)
-- Emit the events -- Emit the events
function love.update(dt) function love.update(dt)
world:emit(dt) world:emit("update", dt)
end end
function love.draw() function love.draw()
world:draw() world:emit("draw")
end end
``` ```