aboutsummaryrefslogtreecommitdiff
path: root/main.lua
blob: f42d40409fd46cbcaead7f4d9ad78fc61ad9497e (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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
function love.load()
  require "window"
  require "panel"
  require "startmenu"
  require "var"
  require "desktop"
  require "internet"
  require "files"
  require "torrent"
  require "help"
  require "chat"
  require "settings"
  love.graphics.setDefaultFilter("nearest", "nearest")
  love.graphics.setBackgroundColor(0, 128, 128)
  love.graphics.setNewFont()
  pressstart = love.graphics.newFont("fonts/pressstart.ttf", 12)
  pressstart:setFilter("nearest", "nearest")
  love.graphics.setFont(pressstart)
  loadVar()
end
function love.update(dt)
  sys.mouse.x = love.mouse.getX()
  sys.mouse.y = love.mouse.getY()
  if love.keyboard.isDown("escape") == true then
    love.event.quit()
  end
  if love.keyboard.isDown("u") == true and win[1].min == true then
    win[1].min = false
    win[2].min = false
  end
end
function love.mousepressed(x, y, button)
  sys.mouse.p.x = x
  sys.mouse.p.y = y
  sys.mouse.p.p = true
end
function love.mousereleased(x, y, button)
  sys.mouse.p.p = false
  start.p = false
end
function love.draw()
  if win[1].ex == true and win[1].s == 0 then
    win[1].layer = 0
    win[1].panel = 0
    if panel.b[1] == 1 then
      panel.b[1] = panel.b[2]
      panel.b[2] = panel.b[3]
      panel.b[3] = panel.b[4]
      panel.b[4] = panel.b[5]
      panel.b[5] = panel.b[6]
      panel.b[6] = panel.b[7]
    elseif panel.b[2] == 1 then
      panel.b[2] = panel.b[3]
      panel.b[3] = panel.b[4]
      panel.b[4] = panel.b[5]
      panel.b[5] = panel.b[6]
      panel.b[6] = panel.b[7]
    end
  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
    if panel.b[1] == 0 then
      panel.b[1] = 1
    elseif panel.b[2] == 0 and panel.b[1] ~= 1 then
      panel.b[2] = 1
    end
    drawWindow(1)
  end
  if win[2].ex == true and win[2].s == 0 then
    win[1].layer = 0
    win[1].panel = 0
    if panel.b[1] == 2 then
      panel.b[1] = panel.b[2]
      panel.b[2] = panel.b[3]
      panel.b[3] = panel.b[4]
      panel.b[4] = panel.b[5]
      panel.b[5] = panel.b[6]
      panel.b[6] = panel.b[7]
    elseif panel.b[2] == 2 then
      panel.b[2] = panel.b[3]
      panel.b[3] = panel.b[4]
      panel.b[4] = panel.b[5]
      panel.b[5] = panel.b[6]
      panel.b[6] = panel.b[7]
    end
  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
    if panel.b[1] == 0 then
      panel.b[1] = 2
    elseif panel.b[2] == 0 and panel.b[1] ~= 2 then
      panel.b[2] = 2
    end
    drawWindow(2)
  end
  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
      start.o = false
    elseif start.o == false then
      start.o = true
    end
  end
  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[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
  drawStart()
  if start.o == true then
    drawMenu()
  end
end