Difference between revisions of "Lily"
m (Fix Lily appears at very top in Category:Libraries) |
m (Update for v.3.0.6 (LCily page)) |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 3: | Line 3: | ||
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. | ||
− | Example below | + | Example below correspond to Lily v3.0.6 |
== Examples == | == Examples == | ||
Line 39: | Line 39: | ||
{lily.newImage, love.filesystem.newFile("image1-1.png")}, -- or the function object | {lily.newImage, love.filesystem.newFile("image1-1.png")}, -- or the function object | ||
}) | }) | ||
− | |||
multilily:onComplete(function(_, lilies) | multilily:onComplete(function(_, lilies) | ||
image1 = lilies[1][1] | image1 = lilies[1][1] | ||
Line 56: | Line 55: | ||
== Links == | == Links == | ||
− | [https://github.com/MikuAuahDark/lily GitHub Repository] (including documentation) | + | * [https://github.com/MikuAuahDark/lily GitHub Repository] (including documentation) |
+ | * [https://love2d.org/forums/viewtopic.php?f=5&t=84750 Forum Post] | ||
{{#set:LOVE Version=0.10.0}} | {{#set:LOVE Version=0.10.0}} | ||
Line 64: | Line 64: | ||
{{#set:Keyword=Threaded Resource Loading}} | {{#set:Keyword=Threaded Resource Loading}} | ||
[[Category:Libraries]] | [[Category:Libraries]] | ||
+ | == Other Languages == | ||
+ | {{i18n|Lily}} |
Latest revision as of 12:30, 17 December 2019
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 correspond to Lily v3.0.6
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
})
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)
- Forum Post
Other Languages
Dansk –
Deutsch –
English –
Español –
Français –
Indonesia –
Italiano –
Lietuviškai –
Magyar –
Nederlands –
Polski –
Português –
Română –
Slovenský –
Suomi –
Svenska –
Türkçe –
Česky –
Ελληνικά –
Български –
Русский –
Српски –
Українська –
עברית –
ไทย –
日本語 –
正體中文 –
简体中文 –
Tiếng Việt –
한국어
More info