Difference between revisions of "Lily"
(Lily LÖVE Async Loading Library) |
m (Fix Lily appears at very top in Category:Libraries) |
||
Line 1: | Line 1: | ||
Lily, LÖVE Async Loading Library. | Lily, LÖVE Async Loading Library. | ||
+ | |||
Allows you to load resources in separate thread, like [[love-loader]] but uses more threads (which means faster) and more functions. It supports many resources, like [[Image]], [[ImageData]], [[Video]], [[Source]], [[SoundData]], and more. | Allows you to load resources in separate thread, like [[love-loader]] but uses more threads (which means faster) and more functions. It supports many resources, like [[Image]], [[ImageData]], [[Video]], [[Source]], [[SoundData]], and more. | ||
Line 57: | Line 58: | ||
[https://github.com/MikuAuahDark/lily GitHub Repository] (including documentation) | [https://github.com/MikuAuahDark/lily GitHub Repository] (including documentation) | ||
− | {{#set:LOVE Version= | + | {{#set:LOVE Version=0.10.0}} |
− | {{#set:LOVE Min Version= | + | {{#set:LOVE Min Version=0.10.0}} |
{{#set:Description=LÖVE Async Loading Library}} | {{#set:Description=LÖVE Async Loading Library}} | ||
{{#set:Standalone_Lua_Module=Yes}} | {{#set:Standalone_Lua_Module=Yes}} | ||
+ | {{#set:Keyword=Threaded Resource Loading}} | ||
[[Category:Libraries]] | [[Category:Libraries]] |
Revision as of 15:01, 31 December 2017
Lily, LÖVE Async Loading Library.
Allows you to load resources in separate thread, like love-loader but uses more threads (which means faster) and more functions. It supports many resources, like Image, ImageData, Video, Source, SoundData, and more.
Example below correstpond to Lily v2.0
Examples
Single loading
local lily = require("lily")
local myimage
local mysound
function love.load()
lily.newImage("image.png"):onComplete(function(userdata, image)
-- In v2.0, there's "userdata" before the return value
myimage = image
end)
lily.newSource("song.wav"):onComplete(function(userdata, sound)
-- In v2.0, there's "userdata" before the return value
mysound = sound
sound:play()
end)
end
function love.draw()
if myimage then love.graphics.draw(myimage, 0, 24, 0, 0.25, 0.25)
else love.graphics.print("Loading image") end
if not(mysound) then love.graphics.print("Loading song", 0, 12) end
end
Multi loading
local lily = require("lily")
function love.load()
multilily = lily.loadMulti({
{"newImage", "image1-0.png"}, -- You can use string
{lily.newImage, love.filesystem.newFile("image1-1.png")}, -- or the function object
})
local a = love.timer.getTime()
multilily:onComplete(function(_, lilies)
image1 = lilies[1][1]
image2 = lilies[2][1]
end)
end
function love.update() end
function love.draw()
if multilily:isComplete() then
love.graphics.draw(image1, -1024, -1024)
love.graphics.draw(image2)
end
end
Links
GitHub Repository (including documentation)