Record the game as movie file
Posted: Tue Jul 27, 2021 8:11 am
Hello,
I would like to record the game play as a movie file.
I am pretty sure it should be possible at least to save each frame drawn by love.
Is there a function in love API with which I can retrieve the full image built at the end of love.draw()
For example, like this :
Of course, it might slow fown the game, but at the end, I can make a movie from all "img_%d.png" file with .e.g. ffmpeg.
Is it possible to do something like this ?
Regards
EDIT :
I think it is possible by drawing everything at first to a canvas.
Indeed, the canvas API has the function "newImageData()" which generates an image from the canvas data.
In my game, that would require to draw a canvas into another canvas, is it possible ?
Regards
I would like to record the game play as a movie file.
I am pretty sure it should be possible at least to save each frame drawn by love.
Is there a function in love API with which I can retrieve the full image built at the end of love.draw()
For example, like this :
Code: Select all
function love.draw()
-- draw all game objects --
img = love.window.getFrame()
love.filesystem.save(img, string.format("img_%d.png", i))
i = i + 1
end
Of course, it might slow fown the game, but at the end, I can make a movie from all "img_%d.png" file with .e.g. ffmpeg.
Is it possible to do something like this ?
Regards
EDIT :
I think it is possible by drawing everything at first to a canvas.
Indeed, the canvas API has the function "newImageData()" which generates an image from the canvas data.
In my game, that would require to draw a canvas into another canvas, is it possible ?
Regards