I'm working on a custom animated sprite format that involves several PNGs zipped up with a control file. I can't seem to open the image however. love.graphics.newImage has a version that takes a file handle, but it refuses to take it from LuaZip. I get the following error:
Error: [string "loaders/animatedSprite.lua"]:18: Incorrect parameter type: expected ImageData
stack traceback:
[C]: in function 'newImage'
[string "loaders/animatedSprite.lua"]:18: in function 'addImage'
[string "loaders/animatedSprite.lua"]:45: in function 'fromFile'
[string "main.lua"]:13: in function 'load'
[string "boot.lua"]:310: in function <[string "boot.lua"]:308>
[C]: in function 'xpcall'
While it doesn't seem to be a standard file handle, it supports :read(), :seek(), :lines(), and :close() methods. Is there another method I can accomplish this, or should I rework the format to not use a zip file?
You can do this with no problem, just make sure your filepaths are UNIX-compliant (99% of the time, your problem will just be that you used "/" instead of "\").
Earliest Love2D supporter who can't Love anymore. Let me disable pixel shaders if I don't use them, dammit! Lenovo Thinkpad X60 Tablet, built like a tank. But not fancy enough for Love2D 0.10.0+.
@Taehl: To be clear, I'm embedding another zip file inside the .love.
@Ellohir: It's not so much about the size savings as it is about being able to move multiple files around in a cohesive piece. For example, you can't send a folder through the network; it has to be bound within an archive.
My current workaround is to copy the zipfile to a temp file, then unzip that into a temp directory, and load the files from there. It's really hacky, and involves more os.execute and disk activity than I'd like, but it'll work until I get around to reimplementing that part in C. I'm open to more elegant solutions.
With LovelyBigPlanet, we had a similar problem as you, which we solved by making resources shared, and letting each level describe what resources it needed, so the game could download all the resources it didn't already have.
nick.meharry wrote:@Ellohir: It's not so much about the size savings as it is about being able to move multiple files around in a cohesive piece. For example, you can't send a folder through the network; it has to be bound within an archive.
No one has mentioned quads yet, so I'll do: Why not use quads then? You need files that aren't images, maybe?