aboutsummaryrefslogtreecommitdiff
path: root/src/terrain/inc/terrain.h
blob: d640f1771e92bceacd0561ea1ab4a46a742c0905 (plain) (blame)
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
40
41
42
43
44
45
46
47
48
49
#ifndef TERRAIN_H
#define TERRAIN_H

#include <camera.h>
#include <gfx.h>
#include <util.h>
#include <stddef.h>

#ifdef __cplusplus
extern "C"
{
#endif

enum
{
    MAP_TILES = 64,
    TERRAIN_SZ = 16,
    MAP_W = MAP_TILES * TERRAIN_SZ,
    MAP_H = MAP_TILES * TERRAIN_SZ
};

enum terrain_type
{
    TERRAIN_TYPE_GRASS
};

struct terrain_map
{
    struct terrain_tile
    {
       enum terrain_type t;
       unsigned char bl;
    } m[MAP_TILES][MAP_TILES];

    int nx, ny, last_w, last_h;
};

void terrain_init(struct terrain_map *map);
void terrain_update(struct terrain_map *map);
int terrain_render(const struct terrain_map *map, const struct camera *cam);
void terrain_block_update(const struct util_rect *dim, bool alive, void *p);

extern struct sprite grass_sprite;

#ifdef __cplusplus
}
#endif

#endif /* TERRAIN_H */