-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathboard.h
59 lines (47 loc) · 1.63 KB
/
board.h
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
#include "figure.h"
typedef
struct board {
field_t field;
figure_t figure;
} board_t;
void board_init(board_t *self, int left, int top, unsigned int width, unsigned int height, char const *space);
void board_free(board_t *self);
void board_figure_set(board_t *self, int id);
void board_figure_new(board_t *self);
int board_figure_move(board_t *self, int dx, int dy, int dang);
int board_figure_drop(board_t *self);
/* -------------------------------------------------------------------------- */
static inline void board_put(board_t *self)
{
field_put(&self->field);
}
/* -------------------------------------------------------------------------- */
static inline void board_refresh(board_t *self)
{
field_refresh(&self->field);
}
/* -------------------------------------------------------------------------- */
static inline void board_figure_draw(board_t *self, int show)
{
figure_draw(&self->figure, &self->field, show);
}
/* -------------------------------------------------------------------------- */
static inline int board_figure_test(board_t *self)
{
return figure_test(&self->figure, &self->field);
}
/* -------------------------------------------------------------------------- */
static inline int board_check_detonations(board_t *self)
{
return field_check_detonations(&self->field);
}
/* -------------------------------------------------------------------------- */
static inline void board_detonate(board_t *self, int phase)
{
field_detonate(&self->field, phase);
}
/* -------------------------------------------------------------------------- */
static inline void board_downfall(board_t *self)
{
field_downfall(&self->field);
}