summaryrefslogtreecommitdiff
path: root/demo/source/chgcol.c
diff options
context:
space:
mode:
Diffstat (limited to 'demo/source/chgcol.c')
-rw-r--r--demo/source/chgcol.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/demo/source/chgcol.c b/demo/source/chgcol.c
new file mode 100644
index 0000000..cbd653e
--- /dev/null
+++ b/demo/source/chgcol.c
@@ -0,0 +1,17 @@
+#include <agbx-demo.h>
+
+#include <agbx/gfx.h>
+
+void agbxd_chgcol(agbxd_dat * _dat,agbx_i8 const _dir) {
+ constexpr agbx_i8 maxcol = 0x7u;
+ agbx_i8 col = _dat->col;
+ if (!_dir) {
+ if (!col) {col = maxcol;}
+ else {--col;}
+ }
+ else {
+ if (col == maxcol) {col = 0x0u;}
+ else {++col;}
+ }
+ _dat->col = col;
+}