summaryrefslogtreecommitdiffhomepage
path: root/not/World.lua
diff options
context:
space:
mode:
authorAki <nthirtyone@gmail.com>2017-09-10 19:47:12 +0200
committerAki <nthirtyone@gmail.com>2017-09-10 19:47:12 +0200
commite6094cf0fddbd8b66426679d79020b06aacb600a (patch)
treefc7d679352f7bb4634db3c6e228c61590245ef04 /not/World.lua
parentb74e8f712a11cf57462c51873b1cf505d90623e3 (diff)
downloadroflnauts-e6094cf0fddbd8b66426679d79020b06aacb600a.zip
roflnauts-e6094cf0fddbd8b66426679d79020b06aacb600a.tar.gz
roflnauts-e6094cf0fddbd8b66426679d79020b06aacb600a.tar.bz2
Camera now uses love.graphics.translate
Diffstat (limited to 'not/World.lua')
-rw-r--r--not/World.lua19
1 files changed, 14 insertions, 5 deletions
diff --git a/not/World.lua b/not/World.lua
index ae00b48..6aee966 100644
--- a/not/World.lua
+++ b/not/World.lua
@@ -220,11 +220,15 @@ function World:update (dt)
end
function World:draw ()
- local offset_x, offset_y = self.camera:getOffsets()
+ -- TODO: Offests are here to keep compatibility.
+ local offset_x, offset_y = 0, 0
local scale = getScale()
local scaler = getRealScale()
-- TODO: Prototype of layering. See `World@new`.
+ -- TODO: Camera rewrite in progress.
+ self.camera:translate()
+
for _,entity in pairs(self.entities) do
if entity:is(Decoration) then
if entity.layer == 1 then
@@ -248,12 +252,21 @@ function World:draw ()
entity:draw(offset_x, offset_y, scale, debug)
end
+ self.camera:pop()
love.graphics.setCanvas()
+
for _,layer in ipairs(self.layers) do
layer:draw()
layer:clear()
end
+ -- TODO: Just move heroes' tags to front layer.
+ self.camera:translate()
+ for _,naut in pairs(self:getNautsAlive()) do
+ naut:drawTag(offset_x, offset_y, scale)
+ end
+ self.camera:pop()
+
if debug then
local c = self.camera
local w, h = love.graphics.getWidth(), love.graphics.getHeight()
@@ -280,10 +293,6 @@ function World:draw ()
love.graphics.line(x1,y1,x2,y2)
end
- for _,naut in pairs(self:getNautsAlive()) do
- naut:drawTag(offset_x, offset_y, scale)
- end
-
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