diff options
| -rw-r--r-- | files.lua | 67 | ||||
| -rw-r--r-- | main.lua | 1 | ||||
| -rw-r--r-- | var.lua | 24 | ||||
| -rw-r--r-- | window.lua | 9 |
4 files changed, 89 insertions, 12 deletions
@@ -5,24 +5,79 @@ function drawFiles() 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) - drawUpBox(9, 32, 38, 32, 2) + 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("/User/", 70, 44) + love.graphics.print(file.title, 70, 44) for i=1,#files do if files[i].type == 0 then files[i].x = 40 - files[i].y = 80 - if files[i].x*i < 300 then + 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) love.graphics.draw(icons[32].file,files[i].x,files[i].y,0,1.5,1.5) - love.graphics.setColor(colors.font.dark) - love.graphics.printf(files[i].name,files[i].x-13,files[i].y+48,75,"center") + 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 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 + file.title = "/User/" .. files[i].name .. "/" + if f.home == files then + 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 + 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 @@ -91,6 +91,7 @@ function love.mousereleased(x, y, button) v1.c.chat.next = false end end + file.p = false end function love.draw() if scene == 1 then @@ -202,12 +202,24 @@ function loadVar() std[6] = {} std[6].title = "Impossible" std[6].hl = false - files = {} - files[1] = {name="Documents",type=0,content={},x=0,y=0,hl=false} - files[2] = {name="Downloads",type=0,content={},x=0,y=0,hl=false} - files[3] = {name="Music",type=0,content={},x=0,y=0,hl=false} - files[4] = {name="Pictures",type=0,content={},x=0,y=0,hl=false} - files[5] = {name="Videos",type=0,content={},x=0,y=0,hl=false} + f = {} + f.home = {} + f.home[1] = {name="Documents",type=0,x=0,y=0,hl=false} + f.home[2] = {name="Downloads",type=0,x=0,y=0,hl=false} + f.home[3] = {name="Music",type=0,x=0,y=0,hl=false} + f.home[4] = {name="Pictures",type=0,x=0,y=0,hl=false} + f.home[5] = {name="Videos",type=0,x=0,y=0,hl=false} + f.pictures = {} + f.pictures[1] = {name="Pictures",type=0,x=0,y=0,hl=false} + f.documents = {} + f.music = {} + f.videos = {} + f.downloads = {} + files = f.home + file = {} + file.title = "/User/" + file.p = false + file.back = false end function loadPre() love.graphics.setDefaultFilter("nearest", "nearest") @@ -174,6 +174,8 @@ function drawWindow(id) updateInternet() elseif id == 6 then updateSettings() + elseif id == 3 then + updateFiles() end if id == layer[1] and win[id].bar == "grey" then win[id].bar = "active" @@ -253,3 +255,10 @@ function windowMouseMove(id,limitx,limitw,limity,limith) win[id].y = limith end end +function mouseClick(x,y,w,h) + if sys.mouse.p.x >= x and sys.mouse.p.x <= x+w and + sys.mouse.p.y >= y and sys.mouse.p.y <= y+h and + sys.mouse.p.p == true and sys.mouse.drag == false then + return true + end +end |
