fix(baseworld): draw all map layer instead of using map:draw()

It allow us to use the exact same transform for map and actors
This commit is contained in:
Kazhnuz 2019-07-14 18:51:00 +02:00
parent f48de0e9bd
commit c7e2f2daca

View file

@ -432,8 +432,8 @@ function BaseWorld:draw(dt)
else else
for i=1, camNumber do for i=1, camNumber do
self.cameras:setScissor(i) self.cameras:setScissor(i)
self:drawMap(i)
self.cameras:attachView(i) self.cameras:attachView(i)
self:drawMap(i)
self:drawActors(i) self:drawActors(i)
self.cameras:detachView(i) self.cameras:detachView(i)
self.cameras:drawHUD(i) self.cameras:drawHUD(i)
@ -451,21 +451,12 @@ function BaseWorld:drawActors(id)
end end
function BaseWorld:drawMap(id) function BaseWorld:drawMap(id)
local tx, ty, scale = 0, 0, 1
if id ~= nil then
-- Du à la manière dont fonctionne STI, on est obligé de récupérer les info
-- de position de camera pour afficher la carte par rapport à ces infos
tx, ty = self.cameras:getInternalCamCoordinate(id)
scale = self.cameras:getViewScale(id) or 2
local vx, vy = self.cameras:getOnScreenViewRelativePosition(id)
tx = math.floor(tx - math.abs(vx))
ty = math.floor(ty - math.abs(vy))
local w, h = core.screen:getDimensions()
end
if self.haveMap then if self.haveMap then
self.map:draw(-tx, -ty, scale, scale) for _, layer in ipairs(self.map.layers) do
if layer.visible and layer.opacity > 0 then
self.map:drawLayer(layer)
end
end
end end
end end