maug
Quick and dirty C mini-augmentation library.
Loading...
Searching...
No Matches
RetroTile Generators

Tools for procedurally generating tilemaps. More...

Collaboration diagram for RetroTile Generators:

Typedefs

typedef MERROR_RETVAL(* retrotile_ani_cb) (void *animation_cb_data, int16_t iter)
 
typedef MERROR_RETVAL(* retrotile_gen_cb) (struct RETROTILE *t, retroflat_tile_t min_z, retroflat_tile_t max_z, uint32_t tuning, size_t layer_idx, uint8_t flags, void *data, retrotile_ani_cb animation_cb, void *animation_cb_data)
 

Functions

MERROR_RETVAL retrotile_gen_diamond_square_iter (struct RETROTILE *t, retroflat_tile_t min_z, retroflat_tile_t max_z, uint32_t tuning, size_t layer_idx, uint8_t flags, void *data, retrotile_ani_cb animation_cb, void *animation_cb_data)
 Generate tilemap terrain using diamond square algorithm.
 
MERROR_RETVAL retrotile_gen_voronoi_iter (struct RETROTILE *t, retroflat_tile_t min_z, retroflat_tile_t max_z, uint32_t tuning, size_t layer_idx, uint8_t flags, void *data, retrotile_ani_cb animation_cb, void *animation_cb_data)
 Generate tilemap terrain using voronoi graph.
 
MERROR_RETVAL retrotile_gen_smooth_iter (struct RETROTILE *t, retroflat_tile_t min_z, retroflat_tile_t max_z, uint32_t tuning, size_t layer_idx, uint8_t flags, void *data, retrotile_ani_cb animation_cb, void *animation_cb_data)
 Average the values in adjacent tiles over an already-generated tilemap.
 
MERROR_RETVAL retrotile_gen_borders_iter (struct RETROTILE *t, retroflat_tile_t min_z, retroflat_tile_t max_z, uint32_t tuning, size_t layer_idx, uint8_t flags, void *data, retrotile_ani_cb animation_cb, void *animation_cb_data)
 Given a list of RETROTILE_DATA_BORDER structs, this will search for occurrences of RETROTILE_DATA_BORDER::center next to RETROTILE_DATA_BORDER::outside and replace with the appropriate border between the two!
 
struct RETROTILE_LAYERretrotile_get_layer_p (struct RETROTILE *tilemap, uint32_t layer_idx)
 
MERROR_RETVAL retrotile_alloc_tile_defs (MAUG_MHANDLE *p_tile_defs_h, size_t *p_tile_defs_count, size_t ndefs)
 
MERROR_RETVAL retrotile_alloc (MAUG_MHANDLE *p_tilemap_h, size_t w, size_t h, size_t layers_count)
 

Detailed Description

Tools for procedurally generating tilemaps.

Function Documentation

◆ retrotile_gen_diamond_square_iter()

MERROR_RETVAL retrotile_gen_diamond_square_iter ( struct RETROTILE * t,
retroflat_tile_t min_z,
retroflat_tile_t max_z,
uint32_t tuning,
size_t layer_idx,
uint8_t flags,
void * data,
retrotile_ani_cb animation_cb,
void * animation_cb_data )

Generate tilemap terrain using diamond square algorithm.

See retrotile_gen_cb() for details.

Warning
This can be very slow!
This will generate a complete new tilemap!

◆ retrotile_gen_smooth_iter()

MERROR_RETVAL retrotile_gen_smooth_iter ( struct RETROTILE * t,
retroflat_tile_t min_z,
retroflat_tile_t max_z,
uint32_t tuning,
size_t layer_idx,
uint8_t flags,
void * data,
retrotile_ani_cb animation_cb,
void * animation_cb_data )

Average the values in adjacent tiles over an already-generated tilemap.

This is designed to be used with tilemaps that use their tile indexes as Z values rather than indexes in a table of tile definitions.

◆ retrotile_gen_voronoi_iter()

MERROR_RETVAL retrotile_gen_voronoi_iter ( struct RETROTILE * t,
retroflat_tile_t min_z,
retroflat_tile_t max_z,
uint32_t tuning,
size_t layer_idx,
uint8_t flags,
void * data,
retrotile_ani_cb animation_cb,
void * animation_cb_data )

Generate tilemap terrain using voronoi graph.

See retrotile_gen_cb() for details.

This is more suitable for purely 2D tilesets, as the changes between indexes are very abrupt!

Warning
This will generate a complete new tilemap!