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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
#ifndef components_h
#define components_h
#include "animation.h"
#include "asset.h"
#include "rect.h"
/* Components are POD. If you put a pointer in one of these,
* you're a dumb poo poo head. */
typedef struct {
int x, y;
} CPosition;
typedef struct {
Asset_ID id;
Rectangle rect;
} CSprite;
typedef struct {
Animation_ID id;
int frame;
int timer;
} CAnimated;
typedef struct {
int life;
int vx, vy;
} CBullet;
typedef struct {
int hp;
int backpedal;
int shoot_timer;
} CEnemy;
typedef struct {
int vx, vy;
} CDebris;
typedef struct {
int x, y, w, h;
} CCollider;
typedef enum {
ctype_sprite = 1 << 0,
ctype_position = 1 << 1,
ctype_animated = 1 << 2,
ctype_bullet = 1 << 3,
ctype_player_bullet = 1 << 4,
ctype_enemy_bullet = 1 << 5,
ctype_enemy = 1 << 6,
ctype_skull = 1 << 7,
ctype_debris = 1 << 8,
ctype_collider = 1 << 9,
ctype_player = 1 << 10,
ctype_destroy_on_anim_done = 1 << 11,
ctype_solid = 1 << 12,
ctype_moveable = 1 << 13
} CType;
#endif
|