New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support compression and decompression in JavaScript API #3153
Comments
|
Bumping for interest. I recently wrote a custom map format that lets me define "sprites" made out of multiple tiles that my game can then use similarly to regular sprites, and it stores the layer data similarly to Tiled's map JSON format. It would be nice to support the same compression options without including bulky libraries in the script. For now, I can only conveniently support "csv" (native JSON array) and uncompressed base64 encoding. Edit: I wonder what the argument and output types should be. For use with Qt.btoa, it would have to be a string, but those not using Qt.btoa and Qt.atob might prefer ArrayBuffers, for easier use with BinaryFile. |
|
After spending some quality time with Qt's base64 encoder Because of this, I think Tiled should provide its own base64 encode/decode methods that can work with binary data (using e.g. ArrayBuffer), and Tiled's compress/decompress should probably also not use strings, to avoid encoding issues with JavaScript strings. Edit: Apparently even the Qt devs recommend exposing one's own C++ functions for base64 encoding binary data, see the comments at the bottom here: https://codereview.qt-project.org/c/qt/qtdeclarative/+/244268 |
Providing some convenience functions for commonly used compression formats and base64 encoding, mostly useful when implementing file formats. Closes mapeditor#3153
That's rather surprising and quite unfortunate. Hopefully the new |
Something like
tiled.compressandtiled.decompress, to make it easier to support zlib, gzip or zstd compression in JS extensions.See mapeditor/tiled-extensions#11.
The text was updated successfully, but these errors were encountered: