aboutsummaryrefslogtreecommitdiff
path: root/sprite.c
blob: ca72f44148f02cd0cdd8f1a5b2721612f0e1c920 (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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#include "sprite.h"

static const Sprite sprites[] = {
	/* sprite_player_bullet_left */
	{
		asset_id_bullet,
		{ 9, 0, 9, 14 }
	},
	/* sprite_player_bullet_right */
	{
		asset_id_bullet,
		{ 0, 0, 9, 14 }
	},
	/* sprite_player_bullet_up */
	{
		asset_id_bullet,
		{ 0, 14, 14, 9 }
	},
	/* sprite_player_bullet_down */
	{
		asset_id_bullet,
		{ 14, 14, 14, 9 }
	},
	/* sprite_skull_left */
	{
		asset_id_enemy,
		{ 16, 0, 16, 16 }
	},
	/* sprite_skull_right */
	{
		asset_id_enemy,
		{ 0, 0, 16, 16 }
	},
	/* sprite_skull_debris_1 */
	{
		asset_id_enemy,
		{ 32, 0, 5, 8 }
	},
	/* sprite_skull_debris_2 */
	{
		asset_id_enemy,
		{ 38, 0, 6, 6 }
	},
	/* sprite_skull_debris_3 */
	{
		asset_id_enemy,
		{ 32, 8, 5, 8 }
	},
	/* sprite_skull_debris_4 */
	{
		asset_id_enemy,
		{ 38, 11, 5, 5 }
	},
	/* sprite_skull_debris_5 */
	{
		asset_id_enemy,
		{ 44, 10, 3, 6 }
	},
	/* sprite_enemy_bullet */
	{
		asset_id_bullet,
		{ 18, 0, 5, 5 }
	},
	/* sprite_author */
	{
		asset_id_usr,
		{ 0, 70, 70, 10 }
	},
	/* sprite_free */
	{
		asset_id_usr,
		{ 0, 80, 171, 10 }
	}
};

void init_csprite(CSprite* sprite, Sprite_ID id) {
	const Sprite* s;

	s = &sprites[id];
	sprite->id   = s->bitmap;
	sprite->rect = s->rect;
}

const Sprite* get_sprite(Sprite_ID id) {
	return &sprites[id];
}