screenshot_timer=screenshot_timer+love.timer.getDelta()
if screenshot_timer>(1/30) then
screenshot_timer=0
screenshot[screenshot_num]=love.graphics.newScreenshot()
screenshot_num=screenshot_num+1
end
screenshot_timer=screenshot_timer+dt
if screenshot_timer>(1/30) then
screenshot_timer=0
screenshot[screenshot_num]=love.image.newEncodedImageData(love.graphics.newScreenshot(),"bmp")
screenshot_num=screenshot_num+1
end
You can, however I think it will be easier in the long run if you go along with the language's standard practice instead of trying to fight it.
Tesselode wrote:Also, love.timer.getDelta() seems to work pretty well. And I can't seem to get dt to work with functions called inside love.update.
You have to pass dt as an argument to the function being called to make it work. Also, getDelta() passes the Lua/C++ boundary, so it is slower, although perhaps only marginally so.
Tesselode wrote:And no, your code doesn't work, unfortunately.
Hm. I must confess I've never used the screenshot feature of LÖVE myself, so I don't know what would be the problem.
for a=1,screenshot_num-1 do
screenshot[a]:getPixel(0,0)
love.filesystem.write(a..".bmp",love.image.newEncodedImageData(screenshot[a],"bmp"))
end
The problem internally is love doesn't bind the image when you encode it. The result is love encodes the last bound image. The call to getPixel() causes the screenshot you're about to encode, to be bound.