It's my second library,Intro !
This is a class for load videos,center-it (give the good position) and add the correct scale (if the window is too small) in your game.
It is very useful if you want to display a simple video in your game and you want a clean code !
this is an example for display a video :
Code: Select all
require 'intro'
function love.load()
intro = intro.init("resources/videos/intro.ogv")
intro.play()
end
function love.draw()
love.graphics.setBackgroundColor( 0,0,0) --not very useful,just set the default color and the background color
love.graphics.setColor(255, 255, 255)
if intro.video:isPlaying() then love.graphics.draw(intro.video, intro.x,intro.y, 0, intro.scale) end
end
Just 3 lines two in the love.load() and one if statement in the love.draw!
HOW TO USE :
1\Make your video in the OGV format.it is strongly recommended to use ffmpeg and this line to convert:
Code: Select all
ffmpeg -i input.mp4 -codec:v libtheora -qscale:v 7 -codec:a libvorbis -qscale:a 5 output.ogv
3\initialize in love.load the video with intro.init(<the path of the ogv video>)
4\use theses functions :
- play() : Play the video
pause() : pause the video
stop() : stop the video
Code: Select all
love.graphics.draw(intro.video, intro.x,intro.y, 0, intro.scale)
In the attachment :
- The complete demo,with a demo video (intro of my game) > 50~ Mo [demo-full.love]
The demo > 2Ko~ [demo.love]
The source of the class > 1Ko~ [intro.lua]
Why I named It "intro" ? Because in the beginning ,this class can just load add one video,and today,i think it can load multiple videos (I haven't try it)...
If you have a suggestion,an issue or you used it in your game,please reply in this post