diff options
| author | 1029chris <1029chris@gmail.com> | 2016-03-10 13:14:28 -0800 |
|---|---|---|
| committer | 1029chris <1029chris@gmail.com> | 2016-03-10 13:14:28 -0800 |
| commit | d88edc5bc473f699cd7606ce82e1d40e97171ac8 (patch) | |
| tree | 9547f3ef4d2b4ddd0775dae22576f73e784168f1 /desktop.lua | |
| parent | 9cc069a875776c2bd6da50597c0c1cdcd198ca87 (diff) | |
Added desktop icons that launch applications
Diffstat (limited to 'desktop.lua')
| -rw-r--r-- | desktop.lua | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/desktop.lua b/desktop.lua index 64dd26b..118698b 100644 --- a/desktop.lua +++ b/desktop.lua @@ -3,9 +3,44 @@ function drawDesktop() if desktop.bg.current ~= 0 then love.graphics.draw(desktop.bg.current, 0, 0, 0, sys.w/1920, sys.h/1280) end + for i=1,6 do + drawIcon(i) + checkIcon(i) + end if sys.mouse.p.p == true and sys.mouse.drag == false then love.graphics.setColor(0,80,160,80) love.graphics.rectangle("fill", sys.mouse.p.x, sys.mouse.p.y, sys.mouse.x-sys.mouse.p.x, sys.mouse.y-sys.mouse.p.y) love.graphics.rectangle("line", sys.mouse.p.x, sys.mouse.p.y, sys.mouse.x-sys.mouse.p.x, sys.mouse.y-sys.mouse.p.y) end end +function drawIcon(id, x, y) + if icon[id].hl == true then + love.graphics.setColor(0,0,120) + love.graphics.rectangle("fill", icon[id].x+55-pressstart:getWidth(win[id].title)/2-6, + icon[id].y+45, pressstart:getWidth(win[id].title)+10, 25) + end + love.graphics.setColor(colors.font.light) + love.graphics.print(win[id].title, icon[id].x+55, icon[id].y+55, 0, 1, 1, pressstart:getWidth(win[id].title)/2) + love.graphics.setColor(255,255,255) + love.graphics.draw(win[id].icon32, icon[id].x+30, icon[id].y, 0, 1.5, 1.5) +end +function checkIcon(id) + if(sys.mouse.p.x >= icon[id].x+4 and sys.mouse.p.x <= icon[id].x+100 and sys.mouse.p.p == true + and sys.mouse.p.y >= icon[id].y and sys.mouse.p.y <= icon[id].y+75) then + if icon[id].hl == false and icon[id].cl == false then + icon[id].hl = true + icon[id].cl = true + elseif icon[id].hl == true and icon[id].cl == false then + icon[id].hl = false + icon[id].cl = true + if win[id].ex == true then + win[id].ex = false + win[id].s = 0.2 + win[id].oldlayer = win[id].layer + layer.sentToFront = id + end + end + elseif sys.mouse.drag == true or sys.mouse.p.x > 120 or sys.mouse.p.y > 550 then + icon[id].hl = false + end +end |
