diff --git a/src/font.c b/src/font.c index f298e93..0b96ccc 100644 --- a/src/font.c +++ b/src/font.c @@ -1,4 +1,4 @@ -/* $Id: font.c,v 1.8 2003/07/27 13:29:25 stpohle Exp $ */ +/* $Id: font.c,v 1.9 2003/08/29 21:26:47 stpohle Exp $ */ // Using Fonts in SDL #include @@ -35,6 +35,32 @@ font_draw (int x, int y, char *text, int size) }; +void +font_gfxdraw (int x, int y, char *text, int size, int ypos) +{ + int i, + c; + SDL_Rect src, + dest; + + src.y = 0; + dest.w = src.w = font[size].size.x; + dest.h = src.h = font[size].size.y; + dest.x = x; + dest.y = y; + + for (i = 0; text[i] != 0; i++) { + c = text[i]; + src.x = font[size].size.x * (c & 15); + src.y = font[size].size.y * ((c & 240) >> 4); + gfx_blit (font[size].image, &src, gfx.screen, &dest, y); + dest.x += font[size].size.x; + } + + font_lastsize = font[size].size; +}; + + void font_load () { int i; diff --git a/src/font.h b/src/font.h index 614bcde..31081bf 100644 --- a/src/font.h +++ b/src/font.h @@ -15,6 +15,7 @@ extern _font font[3]; extern void font_setcolor (unsigned char r, unsigned char g, unsigned char b, int size); extern void font_draw (int x, int y, char *text, int size); +extern void font_gfxdraw (int x, int y, char *text, int size, int ypos); extern void font_drawbold (int x, int y, char *text, int size, int bold); extern void font_load (); extern void font_free ();