From 9aa820bf100845da2024bf3af9e802c90b3a6b51 Mon Sep 17 00:00:00 2001 From: Aki Date: Mon, 31 Jul 2017 22:20:41 +0200 Subject: Fixed scaling issues on display change --- not/Camera.lua | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'not/Camera.lua') diff --git a/not/Camera.lua b/not/Camera.lua index 63489f3..01d5962 100644 --- a/not/Camera.lua +++ b/not/Camera.lua @@ -5,8 +5,6 @@ Camera = { y = 0, dest_x = 0, dest_y = 0, - scale = getScale(), - scaler = getRealScale(), shake = 0, timer = 0, delay = 0, @@ -45,7 +43,7 @@ function Camera:getPosition () end function Camera:getPositionScaled () - return self.x*self.scale, self.y*self.scale + return self.x*getScale(), self.y*getScale() end -- Destination @@ -63,7 +61,7 @@ end function Camera:translatePosition (x, y) local x = x or 0 local y = y or 0 - return (x-self.x)*self.scale, (y-self.y)*self.scale + return (x-self.x)*getScale().scale, (y-self.y)*getScale() end function Camera:translatePoints(...) @@ -72,9 +70,9 @@ function Camera:translatePoints(...) local x,y = self:getOffsets() for k,v in pairs(a) do if k%2 == 1 then - table.insert(r, (v + x) * self.scale) + table.insert(r, (v + x) * getScale()) else - table.insert(r, (v + y) * self.scale) + table.insert(r, (v + y) * getScale()) end end return r @@ -120,8 +118,8 @@ function Camera:follow () sum_y = naut_y + sum_y end end - local x = sum_x / i - love.graphics.getWidth()/self.scale/2 - local y = sum_y / i - love.graphics.getHeight()/self.scale/2 + 4*self.scale -- hotfix + local x = sum_x / i - love.graphics.getWidth()/getScale()/2 + local y = sum_y / i - love.graphics.getHeight()/getScale()/2 + 4*getScale() -- hotfix return x,y end -- cgit v1.1 From ed62b573417bdc85bec616f6016846b02de4c906 Mon Sep 17 00:00:00 2001 From: Aki Date: Tue, 1 Aug 2017 04:30:14 +0200 Subject: Fixed leftover from mass replace --- not/Camera.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'not/Camera.lua') diff --git a/not/Camera.lua b/not/Camera.lua index 01d5962..aa4df5b 100644 --- a/not/Camera.lua +++ b/not/Camera.lua @@ -61,7 +61,7 @@ end function Camera:translatePosition (x, y) local x = x or 0 local y = y or 0 - return (x-self.x)*getScale().scale, (y-self.y)*getScale() + return (x-self.x)*getScale(), (y-self.y)*getScale() end function Camera:translatePoints(...) -- cgit v1.1