Skip to content

sainteos/tmxparser

Repository files navigation

tmxparser

Build Status

This is a C++11 library for parsing the maps generated by Tiled Map Editor.

The TMX format is based upon XML and may contain compressed and encoded tile data to save memory and reduce file sizes. This parser uses the TinyXML2 library and its DOM interface to parse TMX files.

An example file is provided to understand how to use the library.

Features

  • Conformity with the TMX specification page. (Current Version Support is 1.0)
  • Decodes and decompresses tile data.
  • Can parse properties as integers, real numbers, and literals (strings).
  • Can parse the map file when stored in memory.
  • Does not rely on any graphics library.
  • Animated tile support.
  • Group Layer support.

Dependencies

  • zlib
  • TinyXML2 >= 6.0.0

CMake options

USE_MINIZ         "Use miniz.c instead of zlib (default: OFF)"
BUILD_SHARED_LIBS "Build shared libs, otherwise static libs. (default: ON)"
BUILD_TINYXML2    "Build tinyxml2 as external project (default: OFF)"
BUILD_TESTS       "Build tests. (default: OFF)"
BUILD_DOCS        "Build documentation. (default: OFF)"

Installation

tmxparser uses CMake, and the standard CMake build flow works as you'd expect. It's also alternatively available in vcpkg.

mkdir build
cd build
cmake ..
make
sudo make install

To Run The Tests

After make, there will be several artifacts within build/. One of which is called run_tests.

mkdir build
cd build
cmake .. -DBUILDTESTS=ON
make
./run_tests