From eddf66595caa293e89d297843e1896ab42e19a48 Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Thu, 2 May 2019 17:21:48 +0200 Subject: [PATCH] modules/world: attach and detach view just once --- gamecore/modules/world/baseworld.lua | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/gamecore/modules/world/baseworld.lua b/gamecore/modules/world/baseworld.lua index 39e3ff3..a9ba67e 100644 --- a/gamecore/modules/world/baseworld.lua +++ b/gamecore/modules/world/baseworld.lua @@ -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