modules/world: attach and detach view just once

This commit is contained in:
Kazhnuz 2019-05-02 17:21:48 +02:00
parent aaf0b1882b
commit eddf66595c

View file

@ -288,19 +288,19 @@ function BaseWorld:draw(dt)
self:drawActors()
else
for i=1, camNumber do
self.cameras:attachView(i)
self:drawMap(i)
self:drawActors(i)
self.cameras:detachView(i)
end
end
end
function BaseWorld:drawActors(id)
self.cameras:attachView(id)
local actors = self:getActors()
for i,v in ipairs(actors) do
v:draw()
end
self.cameras:detachView(id)
end
function BaseWorld:drawMap(id)
@ -317,9 +317,7 @@ function BaseWorld:drawMap(id)
end
if self.haveMap then
self.cameras:attachView(id)
self.map:draw(-tx, -ty, scale, scale)
self.cameras:detachView(id)
end
end