Skip to content
Bayle Jonathan edited this page May 22, 2015 · 24 revisions

A portable C library to load tiled maps in your games.

Dependencies (optional)

This project depends on Zlib, Jansson and LibXml2.

Usage

#include <tmx.h>

int main(void) {
  tmx_map *map = tmx_load("path/map.tmx");
  if (!map) {
    tmx_perror("tmx_load");
    return 1;
  }
  /* ... */
  tmx_free(map);
  return 0;
}

Data-Structure

See the TMX map format reference page.

Describes the datastructure with an UML-like diagram.

View fullres.

Compiling

This project uses cmake as a build system builder. You can either use cmake, ccmake or cmake-gui.

You can disable XML support by setting WANT_XML to off, the same way with WANT_JSON you can disable JSON support.

On linux :

mkdir build
cd build
cmake ..
make && make install

On windows :

See the Building on windows wiki page.

Thread Safety

Jansson, Zlib and LibXML2 are all thread safe. TMX is thread safe except its tmx_strerr function, which uses a global to store the error message.

Clone this wiki locally