How to get the source filename of a loaded Image?
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
How to get the source filename of a loaded Image?
I'm trying to make a built-in editor for my game and therefore I need it to save new entities which in turn need to save whatever image they're using, but I'm having trouble serializing an image effectively. The way I'd like to do it would be to simply save the path to the image file, but it doesn't look like there's any Image:getSource() function. Any alternatives are also welcome. Thanks!
Re: How to get the source filename of a loaded Image?
There is (File):getFilename which returns the full file path when a files is dropped onto the game window. If you don't use filedropped, you most likely would need to implement some kind of file browser, where users can navigate to the desired file and select it - then use the path the user navigated to and store it as variable to write it to your save file later.
- zorg
- Party member
- Posts: 3465
- Joined: Thu Dec 13, 2012 2:55 pm
- Location: Absurdistan, Hungary
- Contact:
Re: How to get the source filename of a loaded Image?
You can use a library to support arbitrary paths in your editor: https://github.com/megagrump/nativefs
It's easier, in comparison to implementing image encodings löve can read but not write (all but png).
It's easier, in comparison to implementing image encodings löve can read but not write (all but png).
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
Who is online
Users browsing this forum: No registered users and 6 guests