modules/world: attach and detach view just once
This commit is contained in:
parent
aaf0b1882b
commit
eddf66595c
1 changed files with 2 additions and 4 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue