aboutsummaryrefslogtreecommitdiff
path: root/src/building/inc/building.h
blob: 88840f5f98aed6ac025c8934e273c8cea8bef293 (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
#ifndef BUILDING_H
#define BUILDING_H

#include <building_type.h>
#include <camera.h>
#include <gfx.h>
#include <instance.h>
#include <util.h>
#include <stdbool.h>
#include <stddef.h>

#ifdef __cplusplus
extern "C"
{
#endif

struct building
{
    struct instance instance;
    enum building_type type;
};

UTIL_STATIC_ASSERT(!offsetof(struct building, instance), "must be at offset zero");

struct building_cfg
{
    enum building_type type;
    unsigned long x, y;
};

void building_create(const struct building_cfg *cfg, struct building *b);
void building_set_alive_cb(void (*f)(const struct util_rect *dim, bool alive, void *p), void *p);
int building_render(const struct building *b, const struct camera *cam, bool sel);
const char *building_str(const struct building *b);

extern struct sprite building_sprites[1];

#ifdef __cplusplus
}
#endif

#endif /* BUILDING_H */