I meanslime wrote:https://bitbucket.org/rude/love/issues/ ... g-functionHDPLocust wrote:folder dialog box.
love.filesystem.getDirectoryItems('global path') for custom folder dialog boxes,
love.graphics.newImage('global path') for load image, also music and other.
Now i use FFI (<dirent> lib) for folder listing,
and my fs-lib with standart io for loading images/music/fonts etc:
Code: Select all
function fs:loadImage(p)
assert(love.filesystem, 'LOVE2d method only')
assert(love.image and love.graphics, 'Image and graphics modules required')
self.assertion(p, 'string')
local path = self:getPath(p)
local formatList = {'png', 'tga'}
assert(self.checkFormat(path, formatList), 'Available image formats: '..table.concat(formatList, ', ')..'.') --check img format
if not self.absCheck(p) then return love.graphics.newImage(p), 'success' end --if path not global, load it directly
local file = io.open(path, 'rb');
if not file then
return _, 'Image does not exists'
end
local str = file:read('*a') file:close()
love.filesystem.write( 'tmpFile', str) --copy file to temp
local image = love.graphics.newImage('tmpFile') --load img from temp
os.remove(love.filesystem.getSaveDirectory()..'/tmpFile') --remove temp
return image, 'success'
end