Replies: 1 comment 1 reply
-
Yeah, it's a thin layer into C++ Tiled, so it's not even out in its own library at the moment (something that may change, but it's unlikely going to help make this API available on the web). It sounds like you're going to need a JS library, but I'm not sure if there are any that can also write TMX files. If you're going to write your own solution, note that it might be easier to go with JSON, which is more straight-forward to read and write in JavaScript. The JSON format in Tiled supports all features so it is a full replacement for the TMX / TSX formats. We could likely even set up a type definitions file for the JSON format, based on which you could generate JavaScript or TypeScript code using quicktype that can load and save the format. I think about the only tricky part, if you're going to read & write these files, would be to convert the global tile IDs to tile references after loading, and back to global tile IDs before saving. There's a page about the global tile IDs in the manual. |
Beta Was this translation helpful? Give feedback.
-
I've been developing custom Tiled extensions for my project using the Javascript API (BTW great API, very powerful!). Eventually I will also need to perform similar operations as these extensions, but from a web app instead.
I'm not 100% sure how the Javascript API works, but if I had to guess it's probably a thin layer into the C++ libtiled? Meaning that Tiled itself needs to be running for this API to function? I'm wondering how I could read a map, perform operations using the API, and then save the map, all from a web app, i.e. I can't open Tiled from the front-end client.
There are libs out there for various languages and frameworks that can read and write (?) the TMX files, but I don't think they have functionality such as TileAt, NewLayer, etc.
Thanks for any pointers!
Beta Was this translation helpful? Give feedback.
All reactions