Available since LÖVE 11.0
This function replaces love.graphics.newScreenshot.
Creates a screenshot once the current frame is done (after love.draw has finished).
Since this function enqueues a screenshot capture rather than executing it immediately, it can be called from an input callback or love.update and it will still capture all of what's drawn to the screen in that frame.
This function creates a new ImageData object and can cause love to slow down significantly if it's called every frame.
Capture a screenshot and save it to a file at the end of the current frame.
love.graphics.captureScreenshot( filename )
string filenameNothing.
Capture a screenshot and call a callback with the generated ImageData at the end of the current frame.
love.graphics.captureScreenshot( callback )
function callbackNothing.
Capture a screenshot and push the generated ImageData to a Channel at the end of the current frame.
love.graphics.captureScreenshot( channel )
Nothing.
Create a new screenshot and write it to the save directory.
function love.load()
love.filesystem.setIdentity("screenshot_example")
end
function love.keypressed(key)
if key == "c" then
love.graphics.captureScreenshot(os.time() .. ".png")
end
end
function love.draw()
love.graphics.circle("fill", 400, 300, 200)
end
© 2006–2020 LÖVE Development Team
Licensed under the GNU Free Documentation License, Version 1.3.
https://love2d.org/wiki/love.graphics.captureScreenshot