Added love.math.encode(format, data | string [, linelength]) and love.math.decode(format, data | string). Current formats are "base64" and "hex". The optional line length only applies to base64 and specifies the maximum number of characters per line in the encoded string.

Removed the variant of love.filesystem.newFileData which decoded a base64-encoded string since it's redundant.

--HG--
branch : minor
This commit is contained in:
Alex Szpakowski
2016-03-28 19:28:40 -03:00
parent 9efbe4892c
commit 734789eb93
15 changed files with 394 additions and 141 deletions
+2 -1
View File
@@ -936,7 +936,8 @@ function love.nogame()
love.graphics.setBackgroundColor(136/255, 193/255, 206/255)
local function load_image(file, name)
return love.graphics.newImage(love.filesystem.newFileData(file, name:gsub("_", "."), "base64"))
local decoded = love.math.decode("base64", file)
return love.graphics.newImage(love.filesystem.newFileData(decoded, name:gsub("_", ".")))
end
g_images = {}