AlexHeyman / TiledReader

A simple Java library for reading Tiled files
https://www.alexheyman.org/tiledreader/
BSD 3-Clause "New" or "Revised" License
6 stars 3 forks source link

Remove dependency on JavaFX #1

Closed Toboi closed 4 years ago

Toboi commented 4 years ago

Right now, the library requires JavaFX, which isn't necessarily bundled with the JDK (and it isn't with mine).

As it is only required for it's javafx.util.Pair class, I think it's usage could be circumvented by including a custom Pair class in this library.

I would happily provide a PR if you are fine with this.

AlexHeyman commented 4 years ago

Searching around online, it looks like JavaFX is included with the standard JDK as of JDK 7u6, but it's once again not included as of JDK 11.

If we were to remove the JavaFX dependency (which sounds sensible enough), I might like to replace Pair with multiple internal classes of the TiledReader class, one for each semantically different use of Pair in there. I've gotten the sense that using any general-purpose pair class is iffy coding practice anyway, since it can be hard to tell what relationship the pair represents. When I use Pair, it's usually because I'm lazy and/or I don't want to clutter a file with several tiny internal classes.

AlexHeyman commented 4 years ago

I might like to replace Pair with multiple internal classes of the TiledReader class, one for each semantically different use of Pair in there.

This is what I ended up doing in a recent commit, since I had the time. Thanks for bringing this issue up.