8000 Wangsets by BorisTheBrave · Pull Request #4 · Ragath/TiledLib.Net · GitHub
[go: up one dir, main page]

Skip to content

Wangsets #4

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Wangsets #4

wants to merge 3 commits into from

Conversation

BorisTheBrave
Copy link
Contributor

I wanted to play around with this feature, so I added it to your library.

I've departed a bit from your conventions. Rather than manually loading WangSet, i'm using XmlSerializer. This is a bit less verbose, imho, and in this case the extra flexibility isn't needed - you can see I successfully round trip a .tsx file. Also, chose to match the JSON format rather than the xml one, where they differ.

I also moved some code from TmxMap to TmxMisc - imho it makes more sense to keep reading and writing code in parallel. The upshot of this is you can now write .tsx files. I haven't made an official public API for doing so though.

@@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8"?>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just a re-saved version of external_tileset.json.
The json file is unchanged except I added a wang set and filled in a few tiles for it.

@@ -84,7 +90,7 @@ public class Tileset : ITileset, IXmlSerializable

public static Tileset FromStream(System.IO.Stream stream)
{
using (var reader = new System.IO.StreamReader(stream))
using (var reader = new System.IO.StreamReader(stream, System.Text.Encoding.UTF8, true, 1024, true))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NB: This is a subtle, user visible, change. But now the behaviour matches between Tileset.FromStream and Map.FromStream.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant
0