maug
Quick and dirty C mini-augmentation library.
Modules | Files | Data Structures | Macros | Typedefs | Functions
RetroTile API

Functions and structures for working with tilemaps/grids. More...

Collaboration diagram for RetroTile API:

Modules

 RetroTile Tile Definitions
 
 RetroTile Parser
 
 RetroTile Generators
 Tools for procedurally generating tilemaps.
 

Files

file  retrotil.h
 

Data Structures

struct  RETROTILE_LAYER
 
struct  RETROTILE_COORDS
 This is not currently used for anything, but is provided as a a convenience for game logic. More...
 
struct  RETROTILE
 A struct representing a tilemap. More...
 
struct  RETROTILE_DATA_DS
 Internal data structure used by retrotile_gen_diamond_square_iter(). More...
 
struct  RETROTILE_DATA_BORDER
 

Macros

#define RETROTILE_PRESENT
 
#define RETROTILE_TRACE_CHARS   0
 
#define RETROTILE_NAME_SZ_MAX   10
 Maximum number of chars in a RETROTILE::name.
 
#define RETROTILE_PROP_NAME_SZ_MAX   10
 Maximum number of chars in a parsed property name.
 
#define RETROTILE_TILE_SCALE_DEFAULT   1.0f
 Default value for RETROTILE::tile_scale.
 
#define RETROTILE_TRACE_LVL   0
 If defined, bring debug printf statements up to this level.
 
#define RETROTILE_VORONOI_DEFAULT_SPB   8
 
#define RETROTILE_VORONOI_DEFAULT_DRIFT   4
 
#define retrotile_mstate_name(state)   state
 
#define RETROTILE_CLASS_TABLE(f)
 
#define retrotile_get_tile(tilemap, layer, x, y)    (retrotile_get_tiles_p( layer )[((y) * (tilemap)->tiles_w) + (x)])
 
#define retrotile_set_tile(tilemap, layer, x, y, new_val)    (retrotile_get_tiles_p( layer )[((y) * (tilemap)->tiles_w) + (x)])
 
#define retrotile_get_tiles_p(layer)
 
#define retrotile_clear_tiles(t, layer, i)
 
#define RETROTILE_PARSER_MSTATE_TABLE_CONST(name, idx, tokn, parent, m)    extern MAUG_CONST uint8_t SEG_MCONST name;
 
#define RETROTILE_CLASS_TABLE_CONSTS(A, a, i)    extern MAUG_CONST uint8_t SEG_MCONST RETROTILE_CLASS_ ## A;
 

Typedefs

typedef int16_t retroflat_tile_t
 Value for an individual tile in a RETROTILE_LAYER. More...
 
typedef int16_t retrotile_coord_t
 

Functions

struct RETROTILE_LAYERretrotile_get_layer_p (struct RETROTILE *tilemap, uint32_t layer_idx)
 
MERROR_RETVAL retrotile_alloc (MAUG_MHANDLE *p_tilemap_h, size_t w, size_t h, size_t layers_count, const char *tilemap_name, const char *tileset_name)
 
void retrotile_format_asset_path (retroflat_asset_path path_out, const char *afile, struct RETROTILE_PARSER *parser)
 
MERROR_RETVAL retrotile_clear_refresh (retroflat_pxxy_t y_max)
 
MERROR_RETVAL retrotile_topdown_draw (struct RETROFLAT_BITMAP *target, struct RETROTILE *t, struct MDATA_VECTOR *t_defs)
 

Detailed Description

Functions and structures for working with tilemaps/grids.

Macro Definition Documentation

◆ RETROTILE_CLASS_TABLE

#define RETROTILE_CLASS_TABLE (   f)
Value:
f( TILE, tile, 0 ) \
f( MOBILE, mobile, 1 ) \
f( WARP, warp, 2 ) \
f( ITEM, item, 3 ) \
f( CROP, crop, 4 )

◆ retrotile_clear_tiles

#define retrotile_clear_tiles (   t,
  layer,
 
)
Value:
memset( retrotile_get_tiles_p( layer ), -1, \
(t)->tiles_w * (t)->tiles_h * sizeof( retroflat_tile_t ) )
int16_t retroflat_tile_t
Value for an individual tile in a RETROTILE_LAYER.
Definition: retroflt.h:19

◆ retrotile_get_tiles_p

#define retrotile_get_tiles_p (   layer)
Value:
((retroflat_tile_t*)(((uint8_t*)(layer)) + \
sizeof( struct RETROTILE_LAYER )))
Definition: retrotil.h:198

Typedef Documentation

◆ retroflat_tile_t

typedef int16_t retroflat_tile_t

Value for an individual tile in a RETROTILE_LAYER.

This is defined early on so that it can be used in some other modules.