maug
Quick and dirty C mini-augmentation library.
|
Data Structures | |
struct | RETROTILE_PARSER |
Macros | |
#define | RETROTILE_PARSER_MSTATE_TABLE(f) |
Typedefs | |
typedef MERROR_RETVAL(* | retrotile_tj_parse_cb) (const char *dirname, const char *filename, MAUG_MHANDLE *p_tm_h, struct MDATA_VECTOR *p_td, mparser_wait_cb_t wait_cb, void *wait_data, mparser_parse_token_cb token_cb, void *token_cb_data, uint8_t passes) |
Functions | |
MERROR_RETVAL | retrotile_parse_json_c (struct RETROTILE_PARSER *parser, char c) |
mfix_t | retrotile_static_rotation_from_dir (const char *dir) |
Convert a less-or-equal-to-two-character string to a direction in degrees. | |
MERROR_RETVAL | retrotile_parse_json_file (const char *dirname, const char *filename, MAUG_MHANDLE *p_tilemap_h, struct MDATA_VECTOR *p_tile_defs, mparser_wait_cb_t wait_cb, void *wait_data, mparser_parse_token_cb token_cb, void *token_cb_data, uint8_t passes) |
Parse the JSON file at the given path into a heap-allocated tilemap with a RETROTILE struct header. | |
#define RETROTILE_PARSER_MSTATE_TABLE | ( | f | ) |
MERROR_RETVAL retrotile_parse_json_file | ( | const char * | dirname, |
const char * | filename, | ||
MAUG_MHANDLE * | p_tilemap_h, | ||
struct MDATA_VECTOR * | p_tile_defs, | ||
mparser_wait_cb_t | wait_cb, | ||
void * | wait_data, | ||
mparser_parse_token_cb | token_cb, | ||
void * | token_cb_data, | ||
uint8_t | passes ) |
Parse the JSON file at the given path into a heap-allocated tilemap with a RETROTILE struct header.
dirname | Base directory from which to load the tilemap and its accompanying data files. This includes external tileset files and tile graphics. |
filename | Name of tilemap JSON file to parse, inside of dirname. |
p_tilemap_h | Pointer to a MAUG_MHANDLE to allocate and load the tilemap into. The handle targeted should be NULL and, if this is successful, will no longer be NULL afterward. |
p_tile_defs | Pointer to a MDATA_VECTOR to be loaded with RETROTILE_TILE_DEF structs from the given tilemap. |
wait_cb | Callback to call every so often during loading (e.g. to update a loading animation or similar). |
wait_data | Arbitrary data to pass to wait_cb when it is called. |
token_cb | Callback to parse engine-specific custom tokens from the tilemap JSON. Should return MERROR_PREEMPT if parsing is successful and should override standard parsing. |
passes | Number of passes to make on parsed tilemap. This can be combined with token_cb for more advanced operations. The minimum is 2. |
mfix_t retrotile_static_rotation_from_dir | ( | const char * | dir | ) |
Convert a less-or-equal-to-two-character string to a direction in degrees.
This function is useful for converting a prerendered isometric tileset to modifications for a realtime-rendered ::RETRO3DP_MODEL.