diff options
Diffstat (limited to 'font.c')
-rw-r--r-- | font.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -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; } } |