summaryrefslogtreecommitdiff
path: root/demo/source/chkkeys.c
diff options
context:
space:
mode:
Diffstat (limited to 'demo/source/chkkeys.c')
-rw-r--r--demo/source/chkkeys.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/demo/source/chkkeys.c b/demo/source/chkkeys.c
index 262d542..2de80bd 100644
--- a/demo/source/chkkeys.c
+++ b/demo/source/chkkeys.c
@@ -4,16 +4,14 @@
#include <ax/gfx.h>
#define axd_chk(_key) \
- curkey = _key; \
- if (ax_chkkey(keymap,_key))
-
-#define axd_wait() \
- while (ax_chkkey(ax_getkeymap(),curkey)) {}
+ if ((upd.keydwn = ax_chkkey(keymap,(upd.key = _key))))
axd_upd axd_chkkeys(axd_dat * _dat) {
axd_upd upd = {};
ax_keymap const keymap = ax_getkeymap();
- ax_key curkey;
+ if (ax_chkkey(keymap,ax_key_a)) {
+ upd.drw = true;
+ }
axd_chk(ax_key_sel) {
upd.done = true;
upd.err = true;
@@ -25,40 +23,39 @@ axd_upd axd_chkkeys(axd_dat * _dat) {
}
axd_chk(ax_key_l) {
axd_chgcol(_dat,0x0u);
- axd_wait()
+ return upd;
}
axd_chk(ax_key_r) {
axd_chgcol(_dat,0x1u);
- axd_wait()
+ return upd;
}
axd_chk(ax_key_pade) {
if (_dat->pos.x != 0xEEu) {
upd.mv = true;
++_dat->pos.x;
- axd_wait()
+ return upd;
}
}
axd_chk(ax_key_padn) {
if (_dat->pos.y != 0x1u) {
upd.mv = true;
--_dat->pos.y;
- axd_wait()
+ return upd;
}
}
axd_chk(ax_key_pads) {
if (_dat->pos.y != 0x9Eu) {
upd.mv = true;
++_dat->pos.y;
- axd_wait()
+ return upd;
}
}
axd_chk(ax_key_padw) {
if (_dat->pos.x != 0x1u) {
upd.mv = true;
--_dat->pos.x;
- axd_wait()
+ return upd;
}
}
- axd_chk(ax_key_a) {upd.drw = true;}
return upd;
}