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
|
#pragma once
#include <stdbool.h>
struct Game;
typedef struct Entity Entity;
struct Entity {
unsigned long uuid;
void (*update_begin)(Entity *this, struct Game *g);
void (*update)(Entity *this, struct Game *g);
void (*update_end)(Entity *this, struct Game *g);
void (*draw_begin)(Entity *this, struct Game *g);
void (*draw)(Entity *this, struct Game *g);
void (*draw_end)(Entity *this, struct Game *g);
unsigned int type;
const char *name;
int pos[2];
double vel[2];
double rem[2];
int width;
int height;
bool ignore_solids;
union {
struct {
int life;
} part;
};
};
unsigned int entity_type(const char *typename);
unsigned int entity_type_parent(unsigned int type);
bool entity_is_type(unsigned int type, unsigned int search);
bool entity_collide(Entity *this, int ox, int oy);
bool entity_meet(Entity *this, Entity *other);
Entity *entity_place_meeting(Entity *this, struct Game *g, unsigned int type);
void entity_move(Entity *this, struct Game *g);
Entity *entity_init(Entity *this, unsigned int type, const char *name,
int x, int y, int w, int h);
|