improvement(camera): manually attach the view instead of using hump func
This commit is contained in:
parent
6947d2f3f2
commit
f48de0e9bd
1 changed files with 20 additions and 2 deletions
|
@ -185,7 +185,25 @@ function CameraSystem:attachView(id)
|
||||||
if (id ~= nil) then
|
if (id ~= nil) then
|
||||||
local cam = self:getViewCam(id)
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -193,7 +211,7 @@ function CameraSystem:detachView(id)
|
||||||
if (id ~= nil) then
|
if (id ~= nil) then
|
||||||
local cam = self:getViewCam(id)
|
local cam = self:getViewCam(id)
|
||||||
|
|
||||||
cam:detach()
|
love.graphics.pop()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue