aboutsummaryrefslogtreecommitdiff
path: root/main.lua
diff options
context:
space:
mode:
authorChris B <1029chris@gmail.com>2016-01-27 12:26:45 -0800
committerChris B <1029chris@gmail.com>2016-01-27 12:26:45 -0800
commit9e09ef17829abb61a18392fee06db6037664b3ee (patch)
tree44fea123d70a4c44523d7c0c88c18fdb81a6d1ce /main.lua
parent05e01a2d69895593ed4d6b069ea2d4a7e4615cba (diff)
Redid layer system. This time simpler. It works!
Diffstat (limited to 'main.lua')
-rw-r--r--main.lua44
1 files changed, 32 insertions, 12 deletions
diff --git a/main.lua b/main.lua
index f14f1f6..6939374 100644
--- a/main.lua
+++ b/main.lua
@@ -33,17 +33,37 @@ function love.mousereleased(x, y, button)
end
function love.draw()
if win[1].ex == true and win[1].s == 0 then
+ win[1].layer = 0
elseif win[1].ex == false or win[1].s ~= 0 then
+ if layer[1] == 0 then
+ layer[1] = 1
+ win[1].layer = 1
+ end
+ if layer[1] == 2 and win[1].layer == 1 then
+ layer[2] = 2
+ layer[1] = 1
+ win[1].layer = 1
+ win[2].layer = 2
+ end
drawWindow(1)
- layer[1].id = 1
end
if win[2].ex == true and win[2].s == 0 then
+ win[1].layer = 0
elseif win[2].ex == false or win[2].s ~= 0 then
+ if layer[1] == 0 then
+ layer[1] = 2
+ win[2].layer = 1
+ end
+ if layer[1] == 1 and win[2].layer == 1 then
+ layer[2] = 1
+ layer[1] = 2
+ win[2].layer = 1
+ win[1].layer = 2
+ end
drawWindow(2)
- layer[1].id = 2
end
- drawStart()
- if(sys.mouse.p.p == true and start.p == false and sys.mouse.p.x >= panel.s.x and sys.mouse.p.x <= panel.s.x+panel.s.width
+ if(sys.mouse.p.p == true and start.p == false and sys.mouse.p.x >= panel.s.x
+ and sys.mouse.p.x <= panel.s.x+panel.s.width
and sys.mouse.p.y >= panel.s.y and sys.mouse.p.y <= panel.s.y+panel.s.height) then
start.p = true
if start.o == true then
@@ -55,15 +75,15 @@ function love.draw()
if start.o == true and sys.mouse.p.p == true and sys.mouse.p.x > 255 or sys.mouse.p.y < 220 then
start.o = false
end
- if start.o == true then
- drawMenu()
+ if layer[2] ~= 0 then
+ love.graphics.draw(win[layer[2]].cvs, win[layer[2]].x, win[layer[2]].y, 0, win[layer[2]].s)
end
- if layer[2].cvs ~= nil then
- love.graphics.setColor(255,255,255)
- love.graphics.draw(layer[2])
+ if layer[1] ~= 0 then
+ love.graphics.draw(win[layer[1]].cvs, win[layer[1]].x, win[layer[1]].y, 0, win[layer[1]].s)
end
- if layer[1].cvs ~= nil then
- love.graphics.setColor(255,255,255)
- love.graphics.draw(layer[1].cvs, layer[1].x, layer[1].y, 0, layer[1].s)
+ drawStart()
+ if start.o == true then
+ drawMenu()
end
+ love.graphics.print(win[1].layer .. " " .. win[2].layer)
end