-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
baylej tmx
Library: | baylej/tmx |
---|---|
Language: | C |
Links: | documentation, issues |
baylej/tmx is well-maintained and implements all features of the TMX 1.0 format. It can read TMX and TSX files, either from disk or from memory. It comes with examples showing how to render the maps using either Allegro 5 or SDL 2.
It depends on libxml2 for XML-parsing (using XmlTextReader) and zlib for decompressing tile layer data. It uses cmake for compilation.
The project already ships with several examples that show how to access all the data and how to render the map. To compile the examples it is necessary to invoke the compiler with the options necessary for it to find the includes files and libraries of the dependencies.
First compile the library itself. It is not necessary to install the library, so provided you have installed the dependencies you can just run:
cmake .
make
And then compile and link the example, which in addition to libxml2 and zlib depends on SDL 2 and SDL2_image:
cd examples/sdl
g++ sdl.c -o sdl -I../../src `pkg-config --cflags --libs sdl2 SDL2_image libxml-2.0 zlib` ../../libtmx.a
The above command compiles sdl.c
into an executable called sdl
. It passes ../../src
as include folder for finding the TMX library includes. Then it uses pkg-config
to pass the needed compiler and linker flags based on the listed dependencies. Finally it links with the static libtmx.a
library.
You can then run the example as follows:
./sdl <map-file-to-render.tmx>
The author uses the library in his Ludum Dare games. There are likely some projects using this library, but none are known at the moment. If you are using this library, let us know!
Quick Links: Download on itch.io • Tiled Manual • Support Tiled Development