From e304b0a4acc3f0870f55e6b584c464096333dfdc Mon Sep 17 00:00:00 2001 From: zlago Date: Fri, 27 Sep 2024 18:34:24 +0200 Subject: tilemap collision the 'middle ground' layer is the only layer which is solid, and the boundary between the background and the foreground additionally, the maps now can have a custom sky color --- src/tilemap.h | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src/tilemap.h') diff --git a/src/tilemap.h b/src/tilemap.h index 587bdf6..912b67f 100644 --- a/src/tilemap.h +++ b/src/tilemap.h @@ -4,17 +4,24 @@ extern struct tilemap { void *tileset; void *wang_tileset; + struct { + unsigned char r, g, b, a; + } backdrop; unsigned width; unsigned height; unsigned layers; - unsigned behind; + unsigned middleground; struct parallax { float x, y; } *parallax; collision_T *collision; void **tilemaps; + size_t input_bytes; } *tilemap, *next_tilemap; -void init_tilemap(void); -void free_tilemap(struct tilemap *tilemap); -struct tilemap *load_tilemap(void *data, size_t size); +// render the fore/back ground of the tilemap to `renderer` +void tilemap_background(struct tilemap *tilemap, int x, int y, int w, int h); +void tilemap_foreground(struct tilemap *tilemap, int x, int y, int w, int h); + +void tilemap_free(struct tilemap *tilemap); +struct tilemap *tilemap_load(void *data, size_t size); -- cgit 1.4.1-2-gfad0