summaryrefslogtreecommitdiff
path: root/font.c
diff options
context:
space:
mode:
Diffstat (limited to 'font.c')
-rw-r--r--font.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/font.c b/font.c
index 0ce87a7..8ae9567 100644
--- a/font.c
+++ b/font.c
@@ -23,12 +23,15 @@ void font_deinit(void)
void font_draw(int x, int y, const char *s)
{
- const int ox = x;
for (; *s != '\0'; s++) {
const char c = toupper(*s);
const int ix = c % 16 * FONT_W;
const int iy = c / 16 * FONT_H;
- x += 1;
+ const SDL_Rect src = { ix, iy, FONT_W, FONT_H };
+ const SDL_Rect dest = { x, y, FONT_W, FONT_H };
+ if (SDL_RenderCopy(renderer, font_tex, &src, &dest))
+ fprintf(stderr, "%s\n", SDL_GetError());
+ x += FONT_W;
}
}