aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJuan J. Martinez <jjm@usebox.net>2023-08-29 12:25:49 +0100
committerJuan J. Martinez <jjm@usebox.net>2023-08-29 12:26:01 +0100
commitfac35c2ba1dbc9fbf4e4d2e499bb23586cc19c41 (patch)
tree86c5f73e35155902f8e78c3d43101a3eb4afa944 /src
parent9a75f5b9f691117df12cdf1893e17dcbe09fddeb (diff)
downloaduboxlib-dos-fac35c2ba1dbc9fbf4e4d2e499bb23586cc19c41.tar.gz
uboxlib-dos-fac35c2ba1dbc9fbf4e4d2e499bb23586cc19c41.zip
Add basic bitmap font rendering
Diffstat (limited to 'src')
-rw-r--r--src/text.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/text.c b/src/text.c
new file mode 100644
index 0000000..6cec4ad
--- /dev/null
+++ b/src/text.c
@@ -0,0 +1,21 @@
+#include <stdint.h>
+
+#include "ubox_vga.h"
+
+static const uint8_t *font;
+
+void ubox_set_font(const uint8_t *pixdata)
+{
+ font = pixdata;
+}
+
+void ubox_put_text(uint16_t x, uint16_t y, const char *text, uint8_t color)
+{
+ ubox_rect dst = { x, y, 8, 8};
+
+ while (*text)
+ {
+ ubox_blit_c(font + ((*text++ - ' ') << 6), &dst, color);
+ dst.x += 8;
+ }
+}