improvement(camera): manually attach the view instead of using hump func

This commit is contained in:
Kazhnuz 2019-07-14 18:48:25 +02:00
parent 6947d2f3f2
commit f48de0e9bd
1 changed files with 20 additions and 2 deletions

View File

@ -185,7 +185,25 @@ function CameraSystem:attachView(id)
if (id ~= nil) then
local cam = self:getViewCam(id)
cam:attach()
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:getInternalCamCoordinate(id)
tx, ty = core.screen:getScreenCoordinate(tx, ty)
scale = self:getViewScale(id) or 2
local vx, vy = self:getOnScreenViewRelativePosition(id)
tx = math.floor(tx - math.abs(vx)) * -1
ty = math.floor(ty - math.abs(vy)) * -1
local w, h = core.screen:getDimensions()
end
print(tx, ty, scale)
love.graphics.push()
love.graphics.origin()
love.graphics.translate(math.floor(tx), math.floor(ty))
love.graphics.scale(scale, scale)
end
end
@ -193,7 +211,7 @@ function CameraSystem:detachView(id)
if (id ~= nil) then
local cam = self:getViewCam(id)
cam:detach()
love.graphics.pop()
end
end