diff options
author | Juan J. Martinez <jjm@usebox.net> | 2023-06-13 22:25:02 +0100 |
---|---|---|
committer | Juan J. Martinez <jjm@usebox.net> | 2023-06-13 22:25:02 +0100 |
commit | e2f2cd904ff134b221a811c4b9dd5548789ff070 (patch) | |
tree | 46ca5c3b5909466e5f57d380bbe5cf0090d65010 /src | |
parent | 69faef284848fc9c0c52b4e9f7011f0f1b76ef2e (diff) | |
download | gold-mine-run-e2f2cd904ff134b221a811c4b9dd5548789ff070.tar.gz gold-mine-run-e2f2cd904ff134b221a811c4b9dd5548789ff070.zip |
Add bitmap font's put_text
Diffstat (limited to 'src')
-rw-r--r-- | src/data.h | 2 | ||||
-rw-r--r-- | src/text.c | 15 | ||||
-rw-r--r-- | src/text.h | 6 |
3 files changed, 23 insertions, 0 deletions
@@ -4,5 +4,7 @@ /* embedded data */ extern const uint8_t binary_palette_start[]; extern const uint8_t binary_sprites_start[]; +extern const uint8_t binary_tiles_start[]; +extern const uint8_t binary_font_start[]; #endif /* _DATA_H */ diff --git a/src/text.c b/src/text.c new file mode 100644 index 0000000..c59b5e6 --- /dev/null +++ b/src/text.c @@ -0,0 +1,15 @@ +#include <stdint.h> + +#include "vga.h" +#include "data.h" + +void put_text(uint16_t x, uint16_t y, const char *text) +{ + Rect dst = { x, y, 8, 8}; + + while (*text) + { + blit(binary_font_start + ((*text++ - ' ') << 6), &dst); + dst.x += 8; + } +} diff --git a/src/text.h b/src/text.h new file mode 100644 index 0000000..c43b199 --- /dev/null +++ b/src/text.h @@ -0,0 +1,6 @@ +#ifndef _TEXT_H +#define _TEXT_H + +void put_text(uint16_t x, uint16_t y, const char *text); + +#endif /* _TEXT_H */ |