Hey everyone, I'm trying to develop a texture atlas packer (https://github.com/dvdfu/packer) for Love2D.
I read in sprites from a source directory and export them packed as an atlas. I'm using Love2D itself to build the tool since there are convenient image APIs (e.g. love.graphics.draw, Image:encode).
As far as I understand, Love2D can only read from the game project folder and the save directory, and can only save to the save directory. Is there a way to bypass these restrictions for my purposes? For example, using native Lua methods to write files from a program executing in Love? If so, are they compatible with Love2D's FileData object types? I'm wondering what my options are.
Thanks!
Love2D I/O to any directory?
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- josefnpat
- Inner party member
- Posts: 955
- Joined: Wed Oct 05, 2011 1:36 am
- Location: your basement
- Contact:
Re: Love2D I/O to any directory?
Awesome! I dislike TexturePacker immensely, and have been using urraka's texpack. I encourage you to check it out to see a very well made CLI texture packer.dvdfu wrote:Hey everyone, I'm trying to develop a texture atlas packer (https://github.com/dvdfu/packer) for Love2D.
https://github.com/urraka/texpack
While it is encouraged to use love.filesystem.*, because this isn't a game, I would suggest looking into Lua's IO module. It will do what you need.dvdfu wrote:As far as I understand, Love2D can only read from the game project folder and the save directory, and can only save to the save directory. Is there a way to bypass these restrictions for my purposes? For example, using native Lua methods to write files from a program executing in Love? If so, are they compatible with Love2D's FileData object types? I'm wondering what my options are.
http://lua-users.org/wiki/IoLibraryTutorial
Missing Sentinel Software | Twitter
FORCIBLY IGNORED.
<leafo> when in doubt delete all of your code
<bartbes> git rm -r *
<bartbes> git commit -m "Fixed all bugs"
<bartbes> git push
FORCIBLY IGNORED.
<leafo> when in doubt delete all of your code
<bartbes> git rm -r *
<bartbes> git commit -m "Fixed all bugs"
<bartbes> git push
Re: Love2D I/O to any directory?
Not to hijack this thread but I'm curious what shortcomings you found in TexturePacker? I've used it for a number of professional projects with teams of 5 to 10 people as well as for a bunch of solo game jams and I've only ever liked what it does.josefnpat wrote:I dislike TexturePacker immensely, and have been using urraka's texpack.
-
- Citizen
- Posts: 87
- Joined: Tue Dec 30, 2014 6:07 pm
Re: Love2D I/O to any directory?
This should be what you want: https://m.reddit.com/r/love2d/comments/ ... mpact=true
I haven't personally used it yet however
I haven't personally used it yet however
- josefnpat
- Inner party member
- Posts: 955
- Joined: Wed Oct 05, 2011 1:36 am
- Location: your basement
- Contact:
Re: Love2D I/O to any directory?
Sure thing! Keep in mind that I used this software years ago, and the current version may be different.Tanner wrote:Not to hijack this thread but I'm curious what shortcomings you found in TexturePacker? I've used it for a number of professional projects with teams of 5 to 10 people as well as for a bunch of solo game jams and I've only ever liked what it does.josefnpat wrote:I dislike TexturePacker immensely, and have been using urraka's texpack.
Honestly, the features and the UI interface is very good. It's also very nice that you can script it into workflows (e.g. makefiles!)
The problem is the DRM that it implements:
* the demo times out
* the demo has nagware
* the demo cripples the output atlases
* it calls home when it starts (starting the software without internet sucks)
* the license only lasts for one year
* You are limited to how many computers you can run it on
Other problems include:
* Being proprietary (obviously this is subjective)
* Cost
* OK Linux compatibility
For me, the most important features include:
* padding (texpak --padding)
* size limitation (texpack --size)
* json output (default)
* Trim (texpack --trim ... I had to request this one! urraka was so nice to do this for me)
* cli workflow integration with makefiles
Urraka's tool has each of these features, and of course it's FOSS!
You can see my integration in "Get Off, Cat!": https://github.com/josefnpat/LD34/blob/ ... tesheet.sh
Missing Sentinel Software | Twitter
FORCIBLY IGNORED.
<leafo> when in doubt delete all of your code
<bartbes> git rm -r *
<bartbes> git commit -m "Fixed all bugs"
<bartbes> git push
FORCIBLY IGNORED.
<leafo> when in doubt delete all of your code
<bartbes> git rm -r *
<bartbes> git commit -m "Fixed all bugs"
<bartbes> git push
Re: Love2D I/O to any directory?
Ah, fair enough. I was so wow'd by it when I first used it that I got the company I was working for to buy it for the team and then I got used to it. FOSS all the way, though, I agree.
Re: Love2D I/O to any directory?
Personally speaking, aside from not being FOSS, TexturePacker also doesn't directly support Love2D and doesn't work for Ubuntu 32-bit (as far as I can tell). It's pretty situational for me, plus I thought making my own would be a little fun.Tanner wrote:Not to hijack this thread but I'm curious what shortcomings you found in TexturePacker? I've used it for a number of professional projects with teams of 5 to 10 people as well as for a bunch of solo game jams and I've only ever liked what it does.josefnpat wrote:I dislike TexturePacker immensely, and have been using urraka's texpack.
This looks exactly like what I'd need! Will look into it, thanks.Skeletonxf wrote:This should be what you want: https://m.reddit.com/r/love2d/comments/ ... mpact=true
I haven't personally used it yet however
Re: Love2D I/O to any directory?
Running into some more problems.
MiniFS is built on top of LuaFileSystem, which is installed through luarocks. It seems like libraries installed through luarocks can't be required through Love2D's runtime without some hacks...that I'd rather not use if I want this packer to be accessible to other developers. Using Lua's default IO also seems like a lot of work to get basic methods like getFiles() working.
Any work arounds? I couldn't find anything through Google.
MiniFS is built on top of LuaFileSystem, which is installed through luarocks. It seems like libraries installed through luarocks can't be required through Love2D's runtime without some hacks...that I'd rather not use if I want this packer to be accessible to other developers. Using Lua's default IO also seems like a lot of work to get basic methods like getFiles() working.
Any work arounds? I couldn't find anything through Google.
-
- Citizen
- Posts: 87
- Joined: Tue Dec 30, 2014 6:07 pm
Re: Love2D I/O to any directory?
I thought this was the entire file available with no further dependencies: https://gitlab.com/Zatherz/minifs/blob/ ... minifs.lua
Edit: ooooh nvm
Edit: ooooh nvm
-
- Party member
- Posts: 730
- Joined: Sat Apr 26, 2014 7:46 pm
Re: Love2D I/O to any directory?
You can include luafilesystem with your .love I forget the exact place you have to put it, but I know on Windows it has to be next to the .exe. what I did the one time attempted to use luafilesystem was steal the binaries from zerobrane. Hopefully slime or bartbes will post next to explain how to distribute binaries with the .love. on Linux you will just have to tell the user to install luafilesystem.
Who is online
Users browsing this forum: Amazon [Bot] and 2 guests