aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author1029chris <1029chris@gmail.com>2016-06-08 14:32:57 -0700
committer1029chris <1029chris@gmail.com>2016-06-08 14:32:57 -0700
commit7b0bc171d659ff4a0dddc724860fdd09f42b08b3 (patch)
treeb0a0a6961d838ffade9773ed85f1b902f7c6ddce
parent0c3a6ca6190ad47e5fbe1dfaa45c45aa07b4ced9 (diff)
Added video player
Added 1 video for video player to play
-rw-r--r--assets.lua2
-rw-r--r--assets/attacktortoise.ogvbin0 -> 833023 bytes
-rw-r--r--files.lua7
-rw-r--r--var.lua3
-rw-r--r--viewer.lua17
-rw-r--r--window.lua4
6 files changed, 33 insertions, 0 deletions
diff --git a/assets.lua b/assets.lua
index a3a9cd7..caabdd8 100644
--- a/assets.lua
+++ b/assets.lua
@@ -232,6 +232,8 @@ function loadAssets(id)
expl.deb[3].pic = love.graphics.newImage("assets/debris3.png")
end
if id == 16 then
+ video = {}
+ video.attacktortoise = love.graphics.newVideo("assets/attacktortoise.ogv")
loadVar()
end
if id == 17 then
diff --git a/assets/attacktortoise.ogv b/assets/attacktortoise.ogv
new file mode 100644
index 0000000..64fbb16
--- /dev/null
+++ b/assets/attacktortoise.ogv
Binary files differ
diff --git a/files.lua b/files.lua
index 1192333..fe6e130 100644
--- a/files.lua
+++ b/files.lua
@@ -84,6 +84,13 @@ function updateFiles()
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
diff --git a/var.lua b/var.lua
index b215df8..6ee9bab 100644
--- a/var.lua
+++ b/var.lua
@@ -263,6 +263,9 @@ function loadVar()
mplay.pr = false
mplay.title = "Nothing"
mplay.bar = {}
+ vplay = {}
+ vplay.v = 0
+ vplay.p = false
end
function loadPre()
love.graphics.setDefaultFilter("nearest", "nearest")
diff --git a/viewer.lua b/viewer.lua
index 506c406..943bd5a 100644
--- a/viewer.lua
+++ b/viewer.lua
@@ -5,6 +5,13 @@ function drawPicture()
end
end
function drawVideo()
+ drawDownBox(8, 31, win[8].w-16, win[8].h-82, 4)
+ love.graphics.setColor(20,20,20)
+ love.graphics.rectangle("fill",8,31,win[8].w-16,win[8].h-82)
+ drawControls(8+38,win[8].h-34-8)
+ if vplay.v ~= 0 then
+ love.graphics.draw(vplay.v,8,31)
+ end
end
function drawMusic()
drawDownBox(8,31,win[9].w-17,win[9].h-82,4)
@@ -45,6 +52,16 @@ function drawControls(x,y)
drawUpBox(x-38,y,32,32,2)
love.graphics.draw(but.back, x-38, y)
end
+function updateVideo()
+ if vplay.p == true and vplay.v ~= 0 then
+ vplay.v:play()
+ win[8].update = true
+ end
+ if win[8].ex == true and vplay.v ~= 0 then
+ vplay.v:stop()
+ vplay.v = 0
+ end
+end
function updateMusic()
if mouseClick(win[9].x+8+38,win[9].y+win[9].h-34-8,32,32) == true and mplay.m ~= 0 and mplay.pr == false then
if but.but == but.pause then
diff --git a/window.lua b/window.lua
index e95e01e..a8e8673 100644
--- a/window.lua
+++ b/window.lua
@@ -30,6 +30,8 @@ function drawWindow(id)
drawPicture()
elseif id == 9 then
drawMusic()
+ elseif id == 8 then
+ drawVideo()
end
love.graphics.setCanvas()
win[id].update = false
@@ -182,6 +184,8 @@ function drawWindow(id)
updateFiles()
elseif id == 9 then
updateMusic()
+ elseif id == 8 then
+ updateVideo()
end
if id == layer[1] and win[id].bar == "grey" then
win[id].bar = "active"