blob: 262d5423b57535a369b9e2084415d2449b0a18c3 (
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
|
#include <ax-demo.h>
#include <ax/key.h>
#include <ax/gfx.h>
#define axd_chk(_key) \
curkey = _key; \
if (ax_chkkey(keymap,_key))
#define axd_wait() \
while (ax_chkkey(ax_getkeymap(),curkey)) {}
axd_upd axd_chkkeys(axd_dat * _dat) {
axd_upd upd = {};
ax_keymap const keymap = ax_getkeymap();
ax_key curkey;
axd_chk(ax_key_sel) {
upd.done = true;
upd.err = true;
return upd;
}
axd_chk(ax_key_start) {
upd.done = true;
return upd;
}
axd_chk(ax_key_l) {
axd_chgcol(_dat,0x0u);
axd_wait()
}
axd_chk(ax_key_r) {
axd_chgcol(_dat,0x1u);
axd_wait()
}
axd_chk(ax_key_pade) {
if (_dat->pos.x != 0xEEu) {
upd.mv = true;
++_dat->pos.x;
axd_wait()
}
}
axd_chk(ax_key_padn) {
if (_dat->pos.y != 0x1u) {
upd.mv = true;
--_dat->pos.y;
axd_wait()
}
}
axd_chk(ax_key_pads) {
if (_dat->pos.y != 0x9Eu) {
upd.mv = true;
++_dat->pos.y;
axd_wait()
}
}
axd_chk(ax_key_padw) {
if (_dat->pos.x != 0x1u) {
upd.mv = true;
--_dat->pos.x;
axd_wait()
}
}
axd_chk(ax_key_a) {upd.drw = true;}
return upd;
}
|