save:
Code: Select all
local scrn = love.graphics.newScreenshot() -- gets the image data for a screenshot. This is unfortunate, because everything is drawn as 1080p and scaled down to whatever the resolution is. This means the string this generates is FRIGGIN' HUEG (save files are ~10MB, 1kb of which is actual save info, and the rest is HUEG SCRNSHOT)
local info = {
scrndata = scrn:getString(), -- gets the string form of the
scrnw = scrn:getWidth(), -- width of the screenshot
scrnh = scrn:getHeight() -- height of the screenshot
}
info = Tserial.pack(info) -- pack the table to a string
name = "autosave"
love.filesystem.write("saves/"..name..".rns",info)
Code: Select all
local t = Tserial.unpack(love.filesystem.read("saves/"..v))
graphic = love.image.newImageData(t.scrnw, t.scrnh, t.scrndata)
The save files are enormous. 10MB save files to save two variables (which is all the game needs for a save/load right now). How can I scale the image data down to a much more reasonable size (1920x1080px -> 425x239px) for use as a thumbnail?
EDIT: I guess I should probably be using :encode() so that the image gets compressed as well, but that didn't occur to me until just now, and I'm not sure if it would work.