diff options
| author | Xavier Del Campo Romero <xavi.dcr@tutanota.com> | 2021-07-03 00:49:03 +0200 |
|---|---|---|
| committer | Xavier Del Campo Romero <xavi.dcr@tutanota.com> | 2022-03-30 08:20:20 +0200 |
| commit | 6b9f686913efc3725b2690033cd4f398e07076ba (patch) | |
| tree | e9aa91a6b9f617d78123ebe7ad272fc42a60d306 /src/building/inc | |
| parent | c9e6ae44a9aeb89b3f48f3443d6baa80103f7445 (diff) | |
| download | jancity-6b9f686913efc3725b2690033cd4f398e07076ba.tar.gz | |
Add project source code
Diffstat (limited to 'src/building/inc')
| -rw-r--r-- | src/building/inc/building.h | 41 | ||||
| -rw-r--r-- | src/building/inc/building_type.h | 11 |
2 files changed, 52 insertions, 0 deletions
diff --git a/src/building/inc/building.h b/src/building/inc/building.h new file mode 100644 index 0000000..7763b7d --- /dev/null +++ b/src/building/inc/building.h @@ -0,0 +1,41 @@ +#ifndef BUILDING_H +#define BUILDING_H + +#include <building_type.h> +#include <camera.h> +#include <gfx.h> +#include <instance.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); +int building_render(const struct building *b, const struct camera *cam, bool sel); +instance_hp building_maxhp(const struct building *b); +const char *building_str(const struct building *b); + +extern struct sprite building_sprites[MAX_BUILDING_TYPES]; + +#ifdef __cplusplus +} +#endif + +#endif /* BUILDING_H */ diff --git a/src/building/inc/building_type.h b/src/building/inc/building_type.h new file mode 100644 index 0000000..eca76b4 --- /dev/null +++ b/src/building/inc/building_type.h @@ -0,0 +1,11 @@ +#ifndef BUILDING_TYPE_H +#define BUILDING_TYPE_H + +enum building_type +{ + BUILDING_TYPE_BARRACKS, + + MAX_BUILDING_TYPES +}; + +#endif /* BUILDING_TYPE_H */ |
