From 100f994e953627f4c403c3318bdd29ef8d34e528 Mon Sep 17 00:00:00 2001 From: 1029chris <1029chris@gmail.com> Date: Thu, 2 Jun 2016 14:37:23 -0700 Subject: Image viewer can now look at image of a cat --- assets.lua | 2 ++ assets/cat.jpg | Bin 0 -> 6500 bytes files.lua | 4 ++++ var.lua | 1 + viewer.lua | 4 ++++ window.lua | 2 ++ 6 files changed, 13 insertions(+) create mode 100644 assets/cat.jpg diff --git a/assets.lua b/assets.lua index c05313a..f8d7a41 100644 --- a/assets.lua +++ b/assets.lua @@ -94,6 +94,8 @@ function loadAssets(id) settings = { comp = love.graphics.newImage("assets/computer.png") } + picture = {} + picture.cat = love.graphics.newImage("assets/cat.jpg") end if id == 9 then chat = { diff --git a/assets/cat.jpg b/assets/cat.jpg new file mode 100644 index 0000000..aa6483d Binary files /dev/null and b/assets/cat.jpg differ diff --git a/files.lua b/files.lua index df37c2d..df4cb27 100644 --- a/files.lua +++ b/files.lua @@ -80,6 +80,10 @@ function updateFiles() end return elseif files == f.pictures then + if i == 1 and picture.img ~= picture.cat then + picture.img = picture.cat + win[7].update = true + end openFileWindow(7) elseif files == f.videos then openFileWindow(8) diff --git a/var.lua b/var.lua index b3a2f98..01bef19 100644 --- a/var.lua +++ b/var.lua @@ -247,6 +247,7 @@ function loadVar() file.title = "/User/" file.p = false file.back = false + picture.img = 0 end function loadPre() love.graphics.setDefaultFilter("nearest", "nearest") diff --git a/viewer.lua b/viewer.lua index 126bc2b..5255d72 100644 --- a/viewer.lua +++ b/viewer.lua @@ -1,4 +1,8 @@ function drawPicture() + drawDownBox(8, 31, win[7].w-17, win[7].h-40, 4) + if picture.img ~= 0 then + love.graphics.draw(picture.img, 8, 31) + end end function drawVideo() end diff --git a/window.lua b/window.lua index a1606c8..f497cc9 100644 --- a/window.lua +++ b/window.lua @@ -26,6 +26,8 @@ function drawWindow(id) drawFiles() elseif id == 5 then drawHelp() + elseif id == 7 then + drawPicture() end love.graphics.setCanvas() win[id].update = false -- cgit