aboutsummaryrefslogtreecommitdiff
path: root/desktop.lua
blob: d0f497913524a011f91765325f1f66489f63f6f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
function drawDesktop()
  love.graphics.setColor(255,255,255)
  if desktop.bg.current ~= 0 then
    love.graphics.draw(desktop.bg.current, 0, 0, 0, sys.w/1920, sys.h/1280)
  end
  if v1.explodeintro == true and v1.yes == true then
    if expl.frame >= 20 or v1.c.chat.msgs > 1 then
      love.graphics.draw(v1.scorch, win[2].x-300, win[2].y-100)
    end
    if expl.deb.load == false then
      expl.deb[1].x = win[2].x
      expl.deb[1].y = win[2].y
      expl.deb[2].x = win[2].x+300
      expl.deb[2].y = win[2].y
      expl.deb[3].x = win[2].x
      expl.deb[3].y = win[2].y+300
      expl.deb.load = true
    end
    if expl.deb[1].y < sys.h or expl.deb[2].y < sys.h or expl.deb[3].y < sys.h then
      for i=1,3 do
        love.graphics.draw(expl.deb[i].pic, expl.deb[i].x, expl.deb[i].y, expl.deb[i].r)
        expl.deb[i].y = expl.deb[i].y - expl.deb[i].ym
        expl.deb[i].ym = expl.deb[i].ym - 1
        expl.deb[i].x = expl.deb[i].x + expl.deb[i].xm
        expl.deb[i].r = expl.deb[i].r + expl.deb[i].rm
      end
    end
    if expl.frame <= 89 and v1.c.chat.msgs < 2 then
      love.graphics.setColor(255,255,255)
      love.graphics.draw(expl.pic, expl.frames[expl.frame], win[2].x-750, win[2].y-500, 0, 7, 7)
      expl.frame = expl.frame + 1
    end
  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 and v1.yes == false) 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