LibTMJ 1.4.0
A library for loading JSON Tiled maps
Loading...
Searching...
No Matches
Functions
map.c File Reference
#include <string.h>
#include <jansson.h>
#include "log.h"
#include "tileset.h"
#include "tmj.h"
Include dependency graph for map.c:

Go to the source code of this file.

Functions

Propertyunpack_properties (json_t *properties)
 
Pointunpack_points (json_t *points)
 Unpacks an array of points.
 
Textunpack_text (json_t *text)
 Unpacks a text object.
 
Objectunpack_objects (json_t *objects)
 
void free_objects (Object *objects, size_t object_count)
 Helper function to free Objects.
 
Chunkunpack_chunks (json_t *chunks)
 
void free_chunks (Chunk *chunks, size_t chunk_count)
 
Layerunpack_layers (json_t *layers)
 Loads map layers recursively.
 
void layers_free (Layer *layers, size_t layer_count)
 Helper function for freeing layer tree associated with a map.
 
Mapmap_load_json (json_t *root, const char *path)
 
Maptmj_map_loadf (const char *path, bool check_extension)
 Loads the Tiled map from the file at the given path.
 
Maptmj_map_load (const char *map, const char *name)
 Loads the Tiled map from the given JSON object string.
 
void tmj_map_free (Map *map)
 Frees the memory associated with the given map.
 

Function Documentation

◆ unpack_properties()

Property * unpack_properties ( json_t *  properties)

Definition at line 13 of file map.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ unpack_points()

Point * unpack_points ( json_t *  points)

Unpacks an array of points.

The returned array must be freed by the caller.

Definition at line 155 of file map.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ unpack_text()

Text * unpack_text ( json_t *  text)

Unpacks a text object.

The returned object must be freed by the caller.

Definition at line 199 of file map.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ unpack_objects()

Object * unpack_objects ( json_t *  objects)

Definition at line 256 of file map.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ free_objects()

void free_objects ( Object objects,
size_t  object_count 
)

Helper function to free Objects.

May cause undefined behavior if the objects were modified by the caller of map_load().

Definition at line 422 of file map.c.

Here is the caller graph for this function:

◆ unpack_chunks()

Chunk * unpack_chunks ( json_t *  chunks)

Definition at line 433 of file map.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ free_chunks()

void free_chunks ( Chunk chunks,
size_t  chunk_count 
)

Definition at line 542 of file map.c.

Here is the caller graph for this function:

◆ unpack_layers()

Layer * unpack_layers ( json_t *  layers)

Loads map layers recursively.

Definition at line 555 of file map.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ layers_free()

void layers_free ( Layer layers,
size_t  layer_count 
)

Helper function for freeing layer tree associated with a map.

May result in undefined behavior if the layer objects were modified by the caller of map_load().

Definition at line 878 of file map.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ map_load_json()

Map * map_load_json ( json_t *  root,
const char *  path 
)

Definition at line 893 of file map.c.

Here is the call graph for this function:
Here is the caller graph for this function: