From ffac18d6a5958fbef01c36740c17704cb5813e60 Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Mon, 29 Apr 2019 11:20:59 +0200 Subject: [PATCH] modules/world: add a way to get camera scale and view --- gamecore/modules/world/camera.lua | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/gamecore/modules/world/camera.lua b/gamecore/modules/world/camera.lua index 500ef2f..4427372 100644 --- a/gamecore/modules/world/camera.lua +++ b/gamecore/modules/world/camera.lua @@ -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