TiledLib.Net icon indicating copy to clipboard operation
TiledLib.Net copied to clipboard

Tileset caching

Open LubieKakao1212 opened this issue 1 year ago • 3 comments

I realized that external tilesets are loaded for each map separately and there is no way to cache them since in your implementation tilesets contain information about first gid. I propose changing Tileset references in ExternalTileset to ITiIeset and make ExternalTileset not propagate the FirstGid property but instead offset the gid in this[int gid].

Also will fork this repo and apply the second change I mentioned (without a PR) because I need this feature for GlobalGameJam which is starting "soon".

LubieKakao1212 avatar Jan 22 '24 18:01 LubieKakao1212

you can do caching, it would be done by passing your own loader here https://github.com/Ragath/TiledLib.Net/blob/1ee5af3b1a405dfa5effa5c2e0f09390f29774a6/TiledLib/Map.cs#L77

As for the FirstGid property, it's merely matching Tiled's behavior. But if this has changed over the years, I will implement a migration for the version change and adjust the behavior.

Ragath avatar Jan 22 '24 19:01 Ragath

That's what I did, but still ExternalTileset would propagate FirstGid to the Tileset and cause errors when reading the tiles. Also as far as I understand the specification FirstGid is a property present in the map and not the tileset

LubieKakao1212 avatar Jan 23 '24 21:01 LubieKakao1212

Is object rotation not supported? Or am I missing something?

LubieKakao1212 avatar Jan 23 '24 21:01 LubieKakao1212