aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJuan J. Martinez <jjm@usebox.net>2023-09-19 21:17:56 +0100
committerJuan J. Martinez <jjm@usebox.net>2023-09-19 21:17:56 +0100
commit50d06345810cf849548b95e92973f8466b7d5754 (patch)
tree246b15c123dcc2da25c30f52ed095697ab40c3f2 /src
parent3197befed5cc86b82c92677b5040fd37d9a30974 (diff)
downloaduboxlib-dos-50d06345810cf849548b95e92973f8466b7d5754.tar.gz
uboxlib-dos-50d06345810cf849548b95e92973f8466b7d5754.zip
COnfigurable width and hegith
Diffstat (limited to 'src')
-rw-r--r--src/text.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/text.c b/src/text.c
index 6cec4ad..9946c74 100644
--- a/src/text.c
+++ b/src/text.c
@@ -1,21 +1,25 @@
#include <stdint.h>
#include "ubox_vga.h"
+#include "ubox_text.h"
static const uint8_t *font;
+static uint8_t w, h;
-void ubox_set_font(const uint8_t *pixdata)
+void ubox_set_font(const uint8_t *pixdata, uint8_t width, uint8_t height)
{
font = pixdata;
+ w = width;
+ h = height;
}
void ubox_put_text(uint16_t x, uint16_t y, const char *text, uint8_t color)
{
- ubox_rect dst = { x, y, 8, 8};
+ ubox_rect dst = { x, y, w, h};
while (*text)
{
- ubox_blit_c(font + ((*text++ - ' ') << 6), &dst, color);
- dst.x += 8;
+ ubox_blit_c(font + ((*text++ - ' ') * w * h), &dst, color);
+ dst.x += w;
}
}