summaryrefslogtreecommitdiff
path: root/font.c
diff options
context:
space:
mode:
Diffstat (limited to 'font.c')
-rw-r--r--font.c33
1 files changed, 29 insertions, 4 deletions
diff --git a/font.c b/font.c
index 7c4abd4..1f6d7e5 100644
--- a/font.c
+++ b/font.c
@@ -11,12 +11,37 @@ int font_init(const char *path)
return 0;
}
-void font_draw(int x, int y, const char *s)
+void font_draw(int x, int y, const char *s, int size)
{
- for (; *s != '\0'; s++) {
+ const int ox = x;
+ TZR_DrawSetColor(1, 1, 1, 1);
+ for (; *s != '\0' && size > 0; s++, size--) {
const int ix = *s % 16 * 8;
const int iy = *s / 16 * 16;
- TZR_DrawImage(___font_spr, x*8, y*16, ix, iy, 8, 16);
- x += 1;
+ switch (*s) {
+ case '\n':
+ y += 1;
+ x = ox;
+ break;
+ case 'R':
+ TZR_DrawSetColor(1, 0, 0);
+ break;
+ case 'G':
+ TZR_DrawSetColor(0, 1, 0);
+ break;
+ case 'B':
+ TZR_DrawSetColor(0, 0, 1);
+ break;
+ case 'W':
+ TZR_DrawSetColor(1, 1, 1);
+ break;
+ default:
+ TZR_DrawImage(___font_spr, x*8, y*16, ix, iy, 8, 16);
+ x += 1;
+ break;
+ }
}
+ TZR_DrawSetColor(1, 1, 1);
+ if (TZR_GetTick() / 30 % 2)
+ TZR_DrawRectangle(true, x*8, y*16+1, 1, 14);
}