summaryrefslogtreecommitdiffhomepage
path: root/not
diff options
context:
space:
mode:
authorAki <nthirtyone@gmail.com>2017-09-12 01:58:22 +0200
committerAki <nthirtyone@gmail.com>2017-09-12 01:58:22 +0200
commitae2e4b139f4c1e9e84ad1bca0b1e6044162aec01 (patch)
tree6e5f6809d8f5d470434abfad08fa95d5b19825a3 /not
parent20eb4aa0ecd165b727cbb5bb3f3a7aad6a49ebce (diff)
downloadroflnauts-ae2e4b139f4c1e9e84ad1bca0b1e6044162aec01.zip
roflnauts-ae2e4b139f4c1e9e84ad1bca0b1e6044162aec01.tar.gz
roflnauts-ae2e4b139f4c1e9e84ad1bca0b1e6044162aec01.tar.bz2
Individual layer scaling and scaled down layers
Diffstat (limited to 'not')
-rw-r--r--not/World.lua15
1 files changed, 7 insertions, 8 deletions
diff --git a/not/World.lua b/not/World.lua
index 0a3ce30..37b6dbe 100644
--- a/not/World.lua
+++ b/not/World.lua
@@ -32,6 +32,7 @@ function World:new (map, nauts)
do
local layer = Layer(320, 180)
layer.ratio = 0
+ layer.scale = 1
layer.draw = function (self)
love.graphics.setColor(255, 255, 255, 255)
love.graphics.draw(self.canvas, 0, 0, 0, getScale(), getScale())
@@ -255,25 +256,21 @@ function World:update (dt)
end
function World:draw ()
- local scale = 1
-
-- TODO: Prototype of layering. See `World@new`.
-- TODO: Camera rewrite in progress.
for _,entity in pairs(self.entities) do
- if entity:is(Ray) then
- entity.layer:renderTo(entity.draw, entity)
- elseif entity.draw and entity.layer then
+ if entity.draw and entity.layer then
self.camera:push()
- self.camera:scale()
+ self.camera:scale(entity.layer.scale)
self.camera:translate(entity.layer.ratio)
- entity.layer:renderTo(entity.draw, entity, 0, 0, scale, debug) -- TODO: Offsets are passed as zeroes in World@draw for compatibility reasons. Remove them.
+ entity.layer:renderTo(entity.draw, entity, 0, 0, 1, debug) -- TODO: Offsets and Scale are passed as 0,0,1 in World@draw for compatibility reasons. Remove them.
self.camera:pop()
end
if entity.drawTag then
self.camera:push()
self.camera:scale()
self.camera:translate()
- self.layers[6]:renderTo(entity.drawTag, entity, 0, 0, scale) -- TODO: Offsets passed. See `World@draw`.
+ self.layers[6]:renderTo(entity.drawTag, entity, 0, 0, 1) -- TODO: Offsets and Scale passed. See `World@draw`.
self.camera:pop()
end
end
@@ -304,6 +301,8 @@ function World:draw ()
self.camera:pop()
end
+ -- TODO: Draw method beyond this point is a very, very dark place.
+ local scale = getScale()
for _,naut in pairs(self:getNautsAll()) do
-- I have no idea where to place them T_T
-- let's do: bottom-left, bottom-right, top-left, top-right