I'm trying to use the love.graphics.newScreenshot() function but it's not working. The save folder is also not being created* even though I've already set it with t.identity. Running love.exe as admin (I'm using Windows 7 by the way) doesn't make any difference.
*Assuming it's C:\Users\user\AppData\Roaming\LOVE as it says on the wiki.
-- love.load
-- love.update
function love.keypressed(key, isrepeat)
if key == "s" then
local screenshot = love.graphics.newScreenshot();
screenshot:encode('png', os.time() .. '.png');
end
end
-- love.draw
Thanks for replying but I've tried your solution with and without love.filesystem.setIdentity("Demo") in love.load() and it doesn't work. Still no save folder being created either.
function love.keypressed(key, isrepeat)
if key == "s" then
love.filesystem.write(os.time() .. '.png', love.graphics.newScreenshot():encode('png'))
end
end
If you have t.identity set in your conf lua, then that's already fine as it is.
Save folder on win7 is either C:\Users\user\AppData\Roaming\LOVE\<identity> or C:\Users\user\AppData\Roaming\<identity> if you fused the project beforehand.
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
Thanks for the help everyone. It turns out I was using two love.keypressed() functions and it didn't occurred that one was overriding the other. I've rewrote them into one if/elseif function and it's working now.
One last question: what string should I use so the screenshots are saved in numbers like: 001, 002, 003...
AlanGmnz wrote: ↑Sat Nov 11, 2017 4:51 pm
Thanks for the help everyone. It turns out I was using two love.keypressed() functions and it didn't occurred that one was overriding the other. I've rewrote them into one if/elseif function and it's working now.
One last question: what string should I use so the screenshots are saved in numbers like: 001, 002, 003...
You mean like the extensions? or the names?
for both, a simple solution would be just keeping a variable around, and using the following:
which is of course string.format, but called on the format string itself.
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
AlanGmnz wrote: ↑Sat Nov 11, 2017 4:51 pm
Thanks for the help everyone. It turns out I was using two love.keypressed() functions and it didn't occurred that one was overriding the other. I've rewrote them into one if/elseif function and it's working now.
One last question: what string should I use so the screenshots are saved in numbers like: 001, 002, 003...
You mean like the extensions? or the names?
for both, a simple solution would be just keeping a variable around, and using the following:
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.