summaryrefslogtreecommitdiffhomepage
path: root/not/Camera.lua
diff options
context:
space:
mode:
authorAki <nthirtyone@gmail.com>2017-07-31 22:20:41 +0200
committerAki <nthirtyone@gmail.com>2017-07-31 22:20:41 +0200
commit9aa820bf100845da2024bf3af9e802c90b3a6b51 (patch)
treebda923b078103be78526a8492c07422b9c420891 /not/Camera.lua
parenta5dfe50a4f4dd64ef0f54e1caaef8a2672ff8c76 (diff)
downloadroflnauts-9aa820bf100845da2024bf3af9e802c90b3a6b51.zip
roflnauts-9aa820bf100845da2024bf3af9e802c90b3a6b51.tar.gz
roflnauts-9aa820bf100845da2024bf3af9e802c90b3a6b51.tar.bz2
Fixed scaling issues on display change
Diffstat (limited to 'not/Camera.lua')
-rw-r--r--not/Camera.lua14
1 files changed, 6 insertions, 8 deletions
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