Touched up screenshotting a bit

This commit is contained in:
Ishaan Bhardwaj 2021-03-01 20:37:44 -05:00
parent ba235c8a41
commit 83de216408

View File

@ -150,9 +150,11 @@ function love.keypressed(key, scancode)
-- f12 is reserved for saving screenshots -- f12 is reserved for saving screenshots
elseif scancode == "f12" then elseif scancode == "f12" then
local ss_name = os.date("ss/%Y-%m-%d_%H-%M-%S.png") local ss_name = os.date("ss/%Y-%m-%d_%H-%M-%S.png")
if not love.filesystem.getInfo("ss") then local info = love.filesystem.getInfo("ss")
love.filesystem.createDirectory("ss") if not info or info.type ~= "directory" then
end love.filesystem.remove("ss")
love.filesystem.createDirectory("ss")
end
print("Saving screenshot as "..ss_name) print("Saving screenshot as "..ss_name)
GLOBAL_CANVAS:newImageData():encode("png", ss_name) GLOBAL_CANVAS:newImageData():encode("png", ss_name)
-- function keys are reserved -- function keys are reserved