summaryrefslogtreecommitdiffstats
path: root/src/resources/map.h
blob: 673a01dacc704549140ffdc014c48cb4b6375fe1 (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
28
29
30
31
32
33
34
35
36
37
38
39
#ifndef RESOURCE_MAP_H
#define RESOURCE_MAP_H

#include <SDL_stdinc.h>
#include "resource.h"
#include "image.h"
#include "layer.h"

struct tileset {
	struct resource res;
	char *dirname;
	/* TODO: firstgid shouldn't apply to all uses of a tileset. */
	int firstgid;
	char *name;
	int tilewidth;
	int tileheight;
	struct image *image;
	struct tileset *next;
};
struct map {
	struct resource res;
	char *dirname;
	int width;
	int height;
	int tilewidth;
	int tileheight;
	struct tileset *tilesets_head;
	struct tileset *tilesets_tail;
	struct layer *layers_head;
	struct layer *layers_tail;
	Uint8 *collision;
};

struct map *map_get(const char *path);
void map_free(struct map *map);
void map_add_layer(struct map *m, struct layer *l);
void map_add_tileset(struct map *m, struct tileset *t);

#endif