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()
|
self:drawActors()
|
||||||
else
|
else
|
||||||
for i=1, camNumber do
|
for i=1, camNumber do
|
||||||
|
self.cameras:attachView(i)
|
||||||
self:drawMap(i)
|
self:drawMap(i)
|
||||||
self:drawActors(i)
|
self:drawActors(i)
|
||||||
|
self.cameras:detachView(i)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function BaseWorld:drawActors(id)
|
function BaseWorld:drawActors(id)
|
||||||
self.cameras:attachView(id)
|
|
||||||
local actors = self:getActors()
|
local actors = self:getActors()
|
||||||
for i,v in ipairs(actors) do
|
for i,v in ipairs(actors) do
|
||||||
v:draw()
|
v:draw()
|
||||||
end
|
end
|
||||||
self.cameras:detachView(id)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function BaseWorld:drawMap(id)
|
function BaseWorld:drawMap(id)
|
||||||
|
@ -317,9 +317,7 @@ function BaseWorld:drawMap(id)
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.haveMap then
|
if self.haveMap then
|
||||||
self.cameras:attachView(id)
|
|
||||||
self.map:draw(-tx, -ty, scale, scale)
|
self.map:draw(-tx, -ty, scale, scale)
|
||||||
self.cameras:detachView(id)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue