Mercurial > hg > dmlib
diff dmtext_bm.c @ 634:656332eec724
Add condensed boolean flag to bitmap text rendering functions.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 15 Apr 2013 06:48:02 +0300 |
parents | b842cc92c787 |
children |
line wrap: on
line diff
--- a/dmtext_bm.c Mon Apr 15 06:44:13 2013 +0300 +++ b/dmtext_bm.c Mon Apr 15 06:48:02 2013 +0300 @@ -7,7 +7,7 @@ #include "dmtext.h" -void dmDrawBMTextConst(SDL_Surface *screen, DMBitmapFont *font, int mode, int xc, int yc, const char *fmt) +void dmDrawBMTextConst(SDL_Surface *screen, DMBitmapFont *font, BOOL condensed, int mode, int xc, int yc, const char *fmt) { const char *ptr = fmt; DMUnscaledBlitFunc blit = NULL; @@ -23,7 +23,8 @@ blit = dmGetUnscaledBlitFunc(glyph->format, screen->format, mode); blit(glyph, xc, yc, screen); - xc += glyph->w; + + xc += condensed ? glyph->w : font->width; } else xc += font->width; @@ -31,21 +32,21 @@ } -void dmDrawBMTextVA(SDL_Surface *screen, DMBitmapFont *font, int mode, int xc, int yc, const char *fmt, va_list ap) +void dmDrawBMTextVA(SDL_Surface *screen, DMBitmapFont *font, BOOL condensed, int mode, int xc, int yc, const char *fmt, va_list ap) { char tmp[512]; vsnprintf(tmp, sizeof(tmp), fmt, ap); - dmDrawBMTextConst(screen, font, mode, xc, yc, tmp); + dmDrawBMTextConst(screen, font, condensed, mode, xc, yc, tmp); dmFree(tmp); } -void dmDrawBMText(SDL_Surface *screen, DMBitmapFont *font, int mode, int xc, int yc, const char *fmt, ...) +void dmDrawBMText(SDL_Surface *screen, DMBitmapFont *font, BOOL condensed, int mode, int xc, int yc, const char *fmt, ...) { va_list ap; va_start(ap, fmt); - dmDrawBMTextVA(screen, font, mode, xc, yc, fmt, ap); + dmDrawBMTextVA(screen, font, condensed, mode, xc, yc, fmt, ap); va_end(ap); }