54 lines
1.1 KiB
Lua
54 lines
1.1 KiB
Lua
local videoPath = "videos/darnellCutscene.ogv"
|
|
|
|
local song
|
|
local videoStream
|
|
local video
|
|
|
|
local random
|
|
|
|
local module = {}
|
|
|
|
function module.onCreate(songName)
|
|
if songName == "Darnell" then
|
|
sharedVars.canStart = false
|
|
song = songName
|
|
videoStream = love.video.newVideoStream(love.filesystem.newFile(videoPath))
|
|
videoStream:play()
|
|
video = love.graphics.newVideo(videoStream)
|
|
video:play()
|
|
end
|
|
end
|
|
|
|
function module.onUpdate()
|
|
if videoStream then
|
|
if not videoStream:isPlaying() then
|
|
sharedVars.canStart = true
|
|
video = nil
|
|
videoStream = nil
|
|
else
|
|
if love.keyboard.isDown("space") and videoStream and videoStream:isPlaying() then
|
|
videoStream:pause()
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
function module.onDraw()
|
|
if video then
|
|
love.graphics.draw(video, 0,0,0,1.5,1.5)
|
|
end
|
|
end
|
|
|
|
function module.onClose()
|
|
if video then
|
|
video:stop()
|
|
video:release()
|
|
video = nil
|
|
|
|
videoStream:stop()
|
|
videoStream:release()
|
|
videoStream = nil
|
|
end
|
|
end
|
|
|
|
return module |