mirror of
https://github.com/Keyslam-Group/Concord.git
synced 2025-09-01 20:03:55 -04:00
Removed the need for manual flushing. Systems now know about their instance
This commit is contained in:
parent
358a455c8b
commit
acd77fafa5
3 changed files with 23 additions and 19 deletions
11
main.lua
11
main.lua
|
@ -89,21 +89,10 @@ function RandomRemover:update(dt)
|
|||
love.window.setTitle(love.timer.getFPS())
|
||||
end
|
||||
|
||||
local RemovalSystem = System({})
|
||||
function RemovalSystem:init(instance)
|
||||
self.instance = instance
|
||||
end
|
||||
|
||||
function RemovalSystem:update()
|
||||
self.instance:flush()
|
||||
end
|
||||
|
||||
Game:addSystem(RandomRemover(), "update")
|
||||
Game:addSystem(RectangleRenderer(), "draw")
|
||||
Game:addSystem(CircleRenderer(), "draw")
|
||||
|
||||
Game:addSystem(RemovalSystem(Game), "update", false)
|
||||
|
||||
for i = 1, 100 do
|
||||
local e = Entity()
|
||||
e:give(Position, love.math.random(0, 700), love.math.random(0, 700))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue