diff options
Diffstat (limited to 'src/font.c')
-rw-r--r-- | src/font.c | 26 |
1 files changed, 11 insertions, 15 deletions
@@ -1,8 +1,7 @@ -void -font_draw(const char *s, i32 x, i32 y) -{ +void font_draw(const char *s, i32 x, i32 y) { const TZR_Uint res = TZR_RES("res/tset.bmp"); - if (res == 0) return; + if (res == 0) + return; x -= cfg.tile_width; for (i32 i = 0; s[i] != '\0'; i++) { x += cfg.tile_width; @@ -11,13 +10,12 @@ font_draw(const char *s, i32 x, i32 y) const i32 v = s[i] + 800; const i32 ix = v % tileset_width() * cfg.tile_width; const i32 iy = v / tileset_width() * cfg.tile_height; - TZR_DrawImage(res, x, y, ix, iy, cfg.tile_width, cfg.tile_height); + TZR_DrawImage(res, x, y, ix, iy, cfg.tile_width, + cfg.tile_height); } } -void -font_print(i32 x, i32 y, const char *fmt, ...) -{ +void font_print(i32 x, i32 y, const char *fmt, ...) { char buf[256] = {}; va_list va; va_start(va, fmt); @@ -26,18 +24,16 @@ font_print(i32 x, i32 y, const char *fmt, ...) font_draw(buf, x, y); } -void -font_center(i32 x, i32 y, const char *fmt, ...) -{ +void font_center(i32 x, i32 y, const char *fmt, ...) { char buf[256] = {}; va_list va; va_start(va, fmt); vsnprintf(buf, sizeof(buf) - 1, fmt, va); va_end(va); bgcolor(); - TZR_DrawRectangle(x, y, - strlen(buf) * cfg.tile_width, cfg.tile_height, - .fill=true, .center=true); + TZR_DrawRectangle(x, y, strlen(buf) * cfg.tile_width, cfg.tile_height, + .fill = true, .center = true); fgcolor(); - font_draw(buf, x - strlen(buf)*cfg.tile_width/2,y - cfg.tile_height/2); + font_draw(buf, x - strlen(buf) * cfg.tile_width / 2, + y - cfg.tile_height / 2); } |