Skip to content

Commit

Permalink
update example3 to work with love v11.0 (update setColor values)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikaoto committed Apr 9, 2018
1 parent 63f82fe commit cca9a9e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions examples/example3/main.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
-- example3
-- Press up to increase z and down to decrease
-- Press up to increase z index and down to decrease
package.path = package.path .. ";../../?.lua"
local deep = require "../deep"

Expand All @@ -13,33 +13,33 @@ local rect = {
function love.draw()
-- Queue a green rectangle draw call (x = 200, y = 60, z = 2)
deep.queue(2, function()
love.graphics.setColor(0, 255, 0)
love.graphics.setColor(0, 1, 0)
love.graphics.rectangle("fill", rect.x, 60, rect.width, rect.height)
end)

-- Yellow rectangle. Execution index (3) affects draw order, so it acts just like the z coordinate
deep.queue(3, function()
love.graphics.setColor(255, 255, 0)
love.graphics.setColor(1, 1, 0)
love.graphics.rectangle("fill", rect.x, 100, rect.width, rect.height)
end)

-- Blue rectangle
deep.queue(4, function()
love.graphics.setColor(0, 0, 255)
love.graphics.setColor(0, 0, 1)
love.graphics.rectangle("fill", rect.x, 140, rect.width, rect.height)
end)

-- Red square, which can move through the z axis
deep.queue(current_z, function()
love.graphics.setColor(255, 0, 0)
love.graphics.setColor(1, 0, 0)
love.graphics.rectangle("fill", 300, 80, 80, 80) -- (type, x, y, width, height)
end)

-- Draw everything in the queue
deep.execute()

-- Draw the current z index on top-left of the screen
love.graphics.setColor(255, 255, 255)
love.graphics.setColor(1, 1, 1)
love.graphics.print("current_z is "..current_z)
end

Expand Down

0 comments on commit cca9a9e

Please sign in to comment.