summaryrefslogtreecommitdiff
path: root/demo/demo.c
diff options
context:
space:
mode:
Diffstat (limited to 'demo/demo.c')
-rw-r--r--demo/demo.c35
1 files changed, 22 insertions, 13 deletions
diff --git a/demo/demo.c b/demo/demo.c
index 9784ec2..d82e333 100644
--- a/demo/demo.c
+++ b/demo/demo.c
@@ -2,12 +2,15 @@
#include <agbx/gfx.h>
agbx_err agbx_main(void) {
- agbx_set10(0x4000000u,0x403u);
+ agbx_set10(0x500'0000u,0x0u);
+ agbx_set10(0x500'0002u,0x19u);
+ agbx_set10(0x500'0004u,0xFFFFu);
+ agbx_set10(0x400'0000u,0x404u);
struct {
agbx_i8 x;
agbx_i8 y;
} pos = {.x = 0x0u,.y = 0x0u,};
- agbx_setpx2(0x0u,0xFFFFu);
+ agbx_setpx1(0x600'0000u,0x0u,0x2u);
for (;;) {
agbx_keymap const keymap = agbx_getkeymap();
if (agbx_chkkey(keymap,agbx_key_b)) {
@@ -16,40 +19,46 @@ agbx_err agbx_main(void) {
if (agbx_chkkey(keymap,agbx_key_a)) {
return agbx_err_ok;
}
+ if (agbx_chkkey(keymap,agbx_key_l)) {
+ agbx_plot4(pos.x,pos.y,0x1u);
+ agbx_flip();
+ agbx_plot4(pos.x,pos.y,0x2u);
+ while (agbx_chkkey(agbx_getkeymap(),agbx_key_l)) {}
+ continue;
+ }
typeof (pos) const prevpos = pos;
- agbx_key key;
- if (agbx_chkkey(keymap,agbx_key_pade)) {
+ agbx_key key = agbx_key_pade;
+ if (agbx_chkkey(keymap,key)) {
if (pos.x != 0xEFu) {
- key = agbx_key_pade;
++pos.x;
goto drw;
}
}
- if (agbx_chkkey(keymap,agbx_key_padn)) {
+ key = agbx_key_padn;
+ if (agbx_chkkey(keymap,key)) {
if (pos.y != 0x0u) {
- key = agbx_key_padn;
--pos.y;
goto drw;
}
}
- if (agbx_chkkey(keymap,agbx_key_pads)) {
+ key = agbx_key_pads;
+ if (agbx_chkkey(keymap,key)) {
if (pos.y != 0x9Fu) {
- key = agbx_key_pads;
++pos.y;
goto drw;
}
}
- if (agbx_chkkey(keymap,agbx_key_padw)) {
+ key = agbx_key_padw;
+ if (agbx_chkkey(keymap,key)) {
if (pos.x != 0x0u) {
- key = agbx_key_padw;
--pos.x;
goto drw;
}
}
continue;
drw:;
- agbx_plot3(prevpos.x,prevpos.y,0x19u);
- agbx_plot3(pos.x,pos.y,0xFFFFu);
+ agbx_plot4(prevpos.x,prevpos.y,0x1u);
+ agbx_plot4(pos.x,pos.y,0x2u);
while (agbx_chkkey(agbx_getkeymap(),key)) {}
}
}