LibTMJ 2.0.0
A library for loading JSON Tiled maps
Loading...
Searching...
No Matches
tmj.h File Reference

The libtmj API. More...

#include <stdbool.h>
#include <stdint.h>
#include <jansson.h>
Include dependency graph for tmj.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  Property
 https://doc.mapeditor.org/en/stable/reference/json-map-format/#property More...
struct  Chunk
 https://doc.mapeditor.org/en/stable/reference/json-map-format/#chunk More...
struct  Point
 https://doc.mapeditor.org/en/stable/reference/json-map-format/#point More...
struct  Text
 https://doc.mapeditor.org/en/stable/reference/json-map-format/#text More...
struct  Object
 https://doc.mapeditor.org/en/stable/reference/json-map-format/#object More...
struct  Layer
 https://doc.mapeditor.org/en/stable/reference/json-map-format/#layer More...
struct  Transformations
 https://doc.mapeditor.org/en/stable/reference/json-map-format/#transformations More...
struct  Terrain
 https://doc.mapeditor.org/en/stable/reference/json-map-format/#terrain More...
struct  Frame
 https://doc.mapeditor.org/en/stable/reference/json-map-format/#frame More...
struct  Tile
 https://doc.mapeditor.org/en/stable/reference/json-map-format/#tile-definition More...
struct  WangTile
 https://doc.mapeditor.org/en/stable/reference/json-map-format/#wang-tile More...
struct  WangColor
 https://doc.mapeditor.org/en/stable/reference/json-map-format/#wang-color More...
struct  WangSet
 https://doc.mapeditor.org/en/stable/reference/json-map-format/#wang-set More...
struct  Grid
 https://doc.mapeditor.org/en/stable/reference/json-map-format/#grid More...
struct  TileOffset
 https://doc.mapeditor.org/en/stable/reference/json-map-format/#tile-offset More...
struct  Tileset
 https://doc.mapeditor.org/en/stable/reference/json-map-format/#tileset More...
struct  Map
 https://doc.mapeditor.org/en/stable/reference/json-map-format/#json-map-format More...
struct  ObjectTemplate
 https://doc.mapeditor.org/en/stable/reference/json-map-format/#object-template More...

Typedefs

typedef struct Property Property
 https://doc.mapeditor.org/en/stable/reference/json-map-format/#property
typedef struct Chunk Chunk
 https://doc.mapeditor.org/en/stable/reference/json-map-format/#chunk
typedef struct Point Point
 https://doc.mapeditor.org/en/stable/reference/json-map-format/#point
typedef struct Text Text
 https://doc.mapeditor.org/en/stable/reference/json-map-format/#text
typedef struct Object Object
 https://doc.mapeditor.org/en/stable/reference/json-map-format/#object
typedef struct Layer Layer
 https://doc.mapeditor.org/en/stable/reference/json-map-format/#layer
typedef struct Transformations Transformations
 https://doc.mapeditor.org/en/stable/reference/json-map-format/#transformations
typedef struct Terrain Terrain
 https://doc.mapeditor.org/en/stable/reference/json-map-format/#terrain
typedef struct Frame Frame
 https://doc.mapeditor.org/en/stable/reference/json-map-format/#frame
typedef struct Tile Tile
 https://doc.mapeditor.org/en/stable/reference/json-map-format/#tile-definition
typedef struct WangTile WangTile
 https://doc.mapeditor.org/en/stable/reference/json-map-format/#wang-tile
typedef struct WangColor WangColor
 https://doc.mapeditor.org/en/stable/reference/json-map-format/#wang-color
typedef struct WangSet WangSet
 https://doc.mapeditor.org/en/stable/reference/json-map-format/#wang-set
typedef struct Grid Grid
 https://doc.mapeditor.org/en/stable/reference/json-map-format/#grid
typedef struct TileOffset TileOffset
 https://doc.mapeditor.org/en/stable/reference/json-map-format/#tile-offset
typedef struct Tileset Tileset
 https://doc.mapeditor.org/en/stable/reference/json-map-format/#tileset
typedef struct Map Map
 https://doc.mapeditor.org/en/stable/reference/json-map-format/#json-map-format
typedef struct ObjectTemplate ObjectTemplate
 https://doc.mapeditor.org/en/stable/reference/json-map-format/#object-template
typedef enum TMJ_LOG_PRIORITY tmj_log_priority

Enumerations

enum  TMJ_LOG_PRIORITY {
  TMJ_LOG_DEBUG , TMJ_LOG_INFO , TMJ_LOG_WARNING , TMJ_LOG_ERR ,
  TMJ_LOG_CRIT
}

Functions

Map * tmj_map_loadf (const char *path, bool check_extension)
 Loads the Tiled map from the file at the given path.
Map * tmj_map_load (const char *map, const char *name)
 Loads the Tiled map from the given JSON object string.
Tileset * tmj_tileset_loadf (const char *path, bool check_extension)
 Loads the Tiled tileset at the given path.
Tileset * tmj_tileset_load (const char *tileset)
 Loads the Tiled tileset from the given JSON object string.
void tmj_map_free (Map *map)
 Frees the memory associated with the given map.
void tmj_tileset_free (Tileset *tileset)
 Frees the memory associated with the given tileset.
void tmj_log_regcb (bool debug, void(*callback)(tmj_log_priority, const char *))
 Registers a callback function to handle logging events.
uint32_t * tmj_decode_layer (const char *data, const char *encoding, const char *compression, size_t *size)
 Decodes layer data from a Tiled map layer.

Variables

const unsigned int TMJ_VERSION_MAJOR
 The library major version.
const unsigned int TMJ_VERSION_MINOR
 The library minor version.
const unsigned int TMJ_VERSION_PATCH
 The library patch version.
const char *const TMJ_VERSION
 The full library version.

Detailed Description

The libtmj API.

The structures returned by the functions defined in this interface are not meant to be modified by the user. Use only the provided functions to do so.

Definition in file tmj.h.

Typedef Documentation

◆ Property

◆ Chunk

◆ Point

◆ Text

◆ Object

◆ Layer

◆ Transformations

◆ Terrain

◆ Frame

◆ Tile

◆ WangTile

◆ WangColor

◆ WangSet

◆ Grid

◆ TileOffset

◆ Tileset

typedef struct Tileset Tileset

https://doc.mapeditor.org/en/stable/reference/json-map-format/#tileset

Note that for sheets, tiles are numbered left-to-right, top-to-bottom

◆ Map

◆ ObjectTemplate