aboutsummaryrefslogtreecommitdiff
path: root/files.lua
blob: fd5542e523f6b5d281b151fcef59f91a42d5994c (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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
function drawFiles()
  drawDownBox(8, 74, win[3].w-17, win[3].h-108, 4)
  drawDownBox(8, 31, win[3].w-17, 34, 4)
  drawDownBox(7, 374, win[3].w-15, 18, 2)
  love.graphics.setColor(250, 250, 250)
  love.graphics.rectangle("fill", 8, 74, win[3].w-17, win[3].h-108)
  love.graphics.rectangle("fill", 8, 31, win[3].w-17, 34)
  if file.back == false then
    drawUpBox(9, 32, 38, 32, 2)
  else
    drawDownBox(9, 32, 38, 32, 2)
  end
  love.graphics.setColor(255, 255, 255)
  love.graphics.draw(internet.back, 11, 32)
  love.graphics.setColor(colors.font.dark)
  love.graphics.print(file.title, 70, 44)
  for i=1,#files do
    files[i].x = 40
    if i < 6 then
      files[i].y = 80
      files[i].x = (i*80)-43
    elseif i >= 6 then
      files[i].y = 150
      files[i].x = ((i-5)*80)-43
    end
    love.graphics.setFont(pixeloperators)
    love.graphics.setColor(256,256,256)
    if f.home == files then
      love.graphics.draw(icons[32].file,files[i].x,files[i].y,0,1.5,1.5)
    elseif files == f.pictures then
      love.graphics.draw(icons[48].imageFile,files[i].x,files[i].y,0,1,1)
    elseif files == f.videos then
      love.graphics.draw(icons[48].videoFile,files[i].x,files[i].y,0,1,1)
    elseif files == f.music then
      love.graphics.draw(icons[48].musicFile,files[i].x,files[i].y,0,1,1)
    elseif files == f.downloads then
      love.graphics.draw(icons[48].downloadFile,files[i].x,files[i].y,0,1,1)
    elseif files == f.documents then
      love.graphics.draw(icons[48].documentFile,files[i].x,files[i].y,0,1,1)
    end
    if files[i].hl == true then
      love.graphics.setColor(0,0,120)
      love.graphics.rectangle("fill", files[i].x-13,files[i].y+48,75,20)
      love.graphics.setColor(colors.font.light)
      love.graphics.printf(files[i].name,files[i].x-13,files[i].y+48,75,"center")
    else
      love.graphics.setColor(colors.font.dark)
      love.graphics.printf(files[i].name,files[i].x-13,files[i].y+48,75,"center")
    end
    love.graphics.setFont(pressstart)
  end
end
function updateFiles()
  for i=1,#files do
    if mouseClick(win[3].x+files[i].x,win[3].y+files[i].y,80,70) == true
    and layer[1] == 3 and file.p == false then
      file.p = true
      if files[i].hl == false then
        for i=1,#files do
          files[i].hl = false
        end
        files[i].hl = true
        win[3].update = true
      elseif files[i].hl == true then
        win[3].update = true
        if f.home == files then
          file.title = "/User/" .. files[i].name .. "/"
          if i == 4 then
            files = f.pictures
          elseif i == 1 then
            files = f.documents
          elseif i == 2 then
            files = f.downloads
          elseif i == 3 then
            files = f.music
          elseif i == 5 then
            files = f.videos
          end
          return
        elseif files == f.pictures then
          if i == 1 and picture.img ~= picture.cat then
            picture.img = picture.cat
            win[7].update = true
          elseif i == 2 and picture.img ~= picture.art then
            picture.img = picture.art
            win[7].update = true
          end
          openFileWindow(7)
        elseif files == f.videos then
          if i == 1 and vplay.v ~= video.attacktortoise then
            if vplay.v ~= 0 then
              vplay.v:stop()
            end
            vplay.v = video.attacktortoise
            vplay.p = true
          end
          openFileWindow(8)
        elseif files == f.music then
          if i == 1 and mplay.m ~= music.chill then
            if mplay.m ~= 0 then
              mplay.m:stop()
            end
            mplay.m = music.chill
            mplay.p = true
            mplay.title = "How it Begins - Kevin Macleod"
          elseif i == 2 and mplay.m ~= music.rage then
            if mplay.m ~= 0 then
              mplay.m:stop()
            end
            mplay.m = music.rage
            mplay.p = true
            mplay.title = "Fight or Flight - Ethan Meixsell"
          elseif i == 3 and mplay.m ~= music.sophie then
            if mplay.m ~= 0 then
              mplay.m:stop()
            end
            mplay.m = music.sophie
            mplay.p = true
            mplay.title = "Close My Mouth - Silent Partner"
          elseif i == 4 and mplay.m ~= music.ohyeah then
            if mplay.m ~= 0 then
              mplay.m:stop()
            end
            mplay.m = music.ohyeah
            mplay.p = true
            mplay.title = "Down N' Dirty - Jingle Punks"
          elseif i == 5 and mplay.m ~= music.finale then
            if mplay.m ~= 0 then
              mplay.m:stop()
            end
            mplay.m = music.finale
            mplay.p = true
            mplay.title = "Ich Grolle Nicht - Ron Meixsell"
          end
          openFileWindow(9)
        end
      end
    end
  end
  if mouseClick(win[3].x+9,win[3].y+32,38,32) == true and layer[1] == 3 and files ~= f.home then
    files = f.home
    file.title = "/User/"
    win[3].update = true
    file.back = true
  elseif file.back == true and sys.mouse.p.p == false then
    file.back = false
    win[3].update = true
  end
end
function openFileWindow(id)
  if win[id].ex == true then
    if win[3].x+win[3].w+win[id].w+15 < sys.w then
      win[id].x = win[3].x+win[3].w+15
    else
      win[id].x = win[3].x-15-win[id].w
    end
    win[id].y = win[3].y
    win[id].ex = false
    win[id].s = 0.2
    win[id].oldlayer = win[id].layer
    layer.sentToFront = id
  end
end