summary refs log tree commit diff
path: root/src/tilemap.h
blob: 912b67f62e3f631832a93fa8e968aafa57f1def9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#pragma once
#include "collision.h"

extern struct tilemap {
	void *tileset;
	void *wang_tileset;
	struct {
		unsigned char r, g, b, a;
	} backdrop;
	unsigned width;
	unsigned height;
	unsigned layers;
	unsigned middleground;
	struct parallax {
		float x, y;
	} *parallax;
	collision_T *collision;
	void **tilemaps;
	size_t input_bytes;
} *tilemap, *next_tilemap;

// 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);