modules/world: add a way to get camera scale and view
This commit is contained in:
parent
06a5192b84
commit
ffac18d6a5
1 changed files with 18 additions and 0 deletions
|
@ -101,4 +101,22 @@ function CameraSystem:detachView(id)
|
|||
end
|
||||
end
|
||||
|
||||
function CameraSystem:getViewCoordinate(id)
|
||||
local cam = self:getViewCam(id)
|
||||
|
||||
local camx, camy, camh, camw
|
||||
camx = cam.x - (self.views.width/2)
|
||||
camy = cam.y - (self.views.height/2)
|
||||
|
||||
camw = self.views.width
|
||||
camh = self.views.height
|
||||
return camx, camy, camh, camw
|
||||
end
|
||||
|
||||
function CameraSystem:getViewScale(id)
|
||||
local cam = self:getViewCam(id)
|
||||
|
||||
return cam.scale
|
||||
end
|
||||
|
||||
return CameraSystem
|
||||
|
|
Loading…
Reference in a new issue