aboutsummaryrefslogtreecommitdiff
path: root/world.h
blob: 6749dbc783fe73a7a224e4d0c1ce6e1a29ad33ae (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
#ifndef world_h
#define world_h

#include "components.h"
#include "config.h"
#include "map.h"
#include "player.h"
#include "wave.h"

typedef int Entity;

typedef struct World World;

/* Keep as POD. */
struct World {
	int entity_count;
	int recycle_bin_count;

	unsigned short bitmask[max_entities];
	Entity recycle_bin[max_entities];

	CSprite        sprites       [max_entities];
	CPosition      positions     [max_entities];
	CAnimated      animateds     [max_entities];
	CBullet        bullets       [max_entities];
	CEnemy         enemies       [max_entities];
	CCollider      colliders     [max_entities];
	CDebris        debris        [max_entities];

	Player player;
	Map map;
	Waver waver;

	int cam_x, cam_y;
	int enemy_count;
	int gmemory, oom;
};

void init_world(World* world);
Entity new_entity(World* world);
void destroy_entity(World* world, Entity e);
void add_components(World* world, Entity e, CType bits);
void remove_components(World* world, Entity e, CType bits);

#endif