summaryrefslogtreecommitdiff
path: root/inc/game.h
blob: 25e1def72697bcb5827bdca3ea1a071b43b46c2f (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
40
41
42
43
44
#pragma once

enum { MAX_ENTITIES = 1024 };

typedef struct {
	Entity entities[MAX_ENTITIES];
	u64 uuid;
	VecMap *maps;
	usize map_id;

	i32 shake;
	u32 room_next;
	u32 room_restart;
	bool debug;

	struct {
		bool jump;
		bool djump;
		bool death;
		bool lastkey;
	} ev;
} Game;

extern Game *g;

void g_init();
void g_push_map(const Tiled2cMap *t2c);
void g_map_next();
void g_map_restart();
Map *g_map();
void g_update();
void g_draw();
Entity *g_new_entity(const char *type, bool init);
Entity *g_new_entity_t2c(const Tiled2cObject *t2c);
Entity *g_get_entity(const char *type);
Entity *g_get_entity_t2c(u32 id);
void g_clear_entities();
void g_spawn_entities();
u32 g_count(const char *type);
void g_shake(i32 duration);
u32 g_group_count(u32 gid);
void g_group_set_visibility(u32 gid, bool visible);
void g_group_set_flip(u32 gid, bool flip_x, bool flip_y);
VecEntityP *g_group(u32 gid);