diff options
| author | Chris B <1029chris@gmail.com> | 2016-02-25 17:40:30 -0800 |
|---|---|---|
| committer | Chris B <1029chris@gmail.com> | 2016-02-25 17:40:30 -0800 |
| commit | a8b606be2dcdbd345d3f67d5c44275360f7a91e0 (patch) | |
| tree | 93e976be6ef5f112000db861e739b018c0141348 /system.lua | |
| parent | 7d4a634bafb1f5cd8d0dc5f54b51165e5bc651d0 (diff) | |
Removed repeating code, replaced with functions.
Diffstat (limited to 'system.lua')
| -rw-r--r-- | system.lua | 33 |
1 files changed, 12 insertions, 21 deletions
@@ -1,3 +1,8 @@ +function drawLayer(id) + if layer[id] ~= 0 then + love.graphics.draw(win[layer[id]].cvs, win[layer[id]].x, win[layer[id]].y, 0, win[layer[id]].s) + end +end function drawSystem() love.graphics.setBackgroundColor(0, 128, 128) drawDesktop() @@ -24,27 +29,13 @@ function drawSystem() 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 layer[7] ~= 0 then - love.graphics.draw(win[layer[7]].cvs, win[layer[7]].x, win[layer[7]].y, 0, win[layer[7]].s) - end - if layer[6] ~= 0 then - love.graphics.draw(win[layer[6]].cvs, win[layer[6]].x, win[layer[6]].y, 0, win[layer[6]].s) - end - if layer[5] ~= 0 then - love.graphics.draw(win[layer[5]].cvs, win[layer[5]].x, win[layer[5]].y, 0, win[layer[5]].s) - end - if layer[4] ~= 0 then - love.graphics.draw(win[layer[4]].cvs, win[layer[4]].x, win[layer[4]].y, 0, win[layer[4]].s) - end - if layer[3] ~= 0 then - love.graphics.draw(win[layer[3]].cvs, win[layer[3]].x, win[layer[3]].y, 0, win[layer[3]].s) - end - 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[1] ~= 0 then - love.graphics.draw(win[layer[1]].cvs, win[layer[1]].x, win[layer[1]].y, 0, win[layer[1]].s) - end + drawLayer(7) + drawLayer(6) + drawLayer(5) + drawLayer(4) + drawLayer(3) + drawLayer(2) + drawLayer(1) drawStart() if start.o == true then drawMenu() |
