aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuan J. Martinez <jjm@usebox.net>2023-06-13 22:25:02 +0100
committerJuan J. Martinez <jjm@usebox.net>2023-06-13 22:25:02 +0100
commite2f2cd904ff134b221a811c4b9dd5548789ff070 (patch)
tree46ca5c3b5909466e5f57d380bbe5cf0090d65010
parent69faef284848fc9c0c52b4e9f7011f0f1b76ef2e (diff)
downloadgold-mine-run-e2f2cd904ff134b221a811c4b9dd5548789ff070.tar.gz
gold-mine-run-e2f2cd904ff134b221a811c4b9dd5548789ff070.zip
Add bitmap font's put_text
-rw-r--r--TODO.md8
-rw-r--r--src/data.h2
-rw-r--r--src/text.c15
-rw-r--r--src/text.h6
4 files changed, 26 insertions, 5 deletions
diff --git a/TODO.md b/TODO.md
index 35075cc..31c8dc3 100644
--- a/TODO.md
+++ b/TODO.md
@@ -1,15 +1,13 @@
# TODO
-- drawing
- - bitmap font
-- entity system
- - free/used lists
- - player
- map
- importer
- renderer
- collision detection
- deadly blocks
+- entity system
+ - free/used lists
+ - player
- hud
- lives
- score
diff --git a/src/data.h b/src/data.h
index 46e497f..d7f2f4c 100644
--- a/src/data.h
+++ b/src/data.h
@@ -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 */