flame-engine / tiled.dart

A Dart Tiled library. Parse your TMX files into useful representations. Compatible with Flame.
https://flame-engine.org/
MIT License
50 stars 30 forks source link

Fixed parseTmx for CSV-formatted tilemap layers #36

Closed doodlezucc closed 2 years ago

doodlezucc commented 2 years ago

This pull request fixes parsing of tilemaps formatted in .tmx with layer data encoding set to CSV. It's actually kind of surprising this issue wasn't addressed before because AFAIK this is Tiled's default configuration.

When parsing a layer, its data was assumed to be a list. This already works well for JSON tilemaps. I added support to convert the CSV String into a List<int>.

This commit also includes a test for this encoding which would fail and throw a TypeError before.

spydon commented 2 years ago

@lfraker do you want to review this small PR too?

lfraker commented 2 years ago

Looks good, awesome to be able to use CSV now as well!

spydon commented 2 years ago

I'll release this later with the pending PR. :)