summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2018-01-28 11:04:56 -0500
committerJune McEnroe <june@causal.agency>2018-01-28 11:05:48 -0500
commitadfa12d69c0b102a1123cd7fb5a771f85348580c (patch)
treedfe6cfdff2d1ac4f5bada070eb9909131ef8810f
parentAdd fb.c (diff)
downloadsrc-adfa12d69c0b102a1123cd7fb5a771f85348580c.tar.gz
src-adfa12d69c0b102a1123cd7fb5a771f85348580c.zip
Add color.c
-rw-r--r--bin/Makefile2
-rw-r--r--bin/color.c13
2 files changed, 15 insertions, 0 deletions
diff --git a/bin/Makefile b/bin/Makefile
index 7c4f2c8d..1cd8a5e6 100644
--- a/bin/Makefile
+++ b/bin/Makefile
@@ -13,6 +13,8 @@ atch: dtch
 pbcopy pbpaste: pbd
 	ln -f pbd $@
 
+color: color.o fb.o
+
 clean:
 	rm -f $(BINS)
 
diff --git a/bin/color.c b/bin/color.c
new file mode 100644
index 00000000..3e6c3b5a
--- /dev/null
+++ b/bin/color.c
@@ -0,0 +1,13 @@
+#include <stdint.h>
+
+static uint32_t color;
+
+void draw(uint32_t *buf, uint32_t xres, uint32_t yres) {
+    for (uint32_t i = 0; i < xres * yres; ++i) {
+        buf[i] = color;
+    }
+}
+
+void input(char c) {
+    color = color << 4 | (c & 0xF);
+}