X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Flibgame%2Ftext.c;h=ccf32e700bbd070d6d753cad2a7d9599db773427;hb=44daf525cec5664a3de0ce6e7516cd6c0081cf5b;hp=94e4c3c9c5d8531319030f5d65a150c72908b06f;hpb=c1dca83f9655759c36e3e5e9e95739d46c55c894;p=rocksndiamonds.git diff --git a/src/libgame/text.c b/src/libgame/text.c index 94e4c3c9..ccf32e70 100644 --- a/src/libgame/text.c +++ b/src/libgame/text.c @@ -1,7 +1,7 @@ /*********************************************************** * Artsoft Retro-Game Library * *----------------------------------------------------------* -* (c) 1994-2002 Artsoft Entertainment * +* (c) 1994-2006 Artsoft Entertainment * * Holger Schemel * * Detmolder Strasse 189 * * 33604 Bielefeld * @@ -130,6 +130,13 @@ void FreeFontInfo(struct FontBitmapInfo *font_bitmap_info) free(font_bitmap_info); } +struct FontBitmapInfo *getFontBitmapInfo(int font_nr) +{ + int font_bitmap_id = gfx.select_font_function(font_nr); + + return &gfx.font_bitmap_info[font_bitmap_id]; +} + int getFontWidth(int font_nr) { int font_bitmap_id = gfx.select_font_function(font_nr); @@ -233,6 +240,18 @@ void DrawTextSCentered(int y, int font_nr, char *text) gfx.sy + y, text, font_nr); } +void DrawTextSAligned(int x, int y, char *text, int font_nr, int align) +{ + DrawText(gfx.sx + ALIGNED_XPOS(x, getTextWidth(text, font_nr), align), + gfx.sx + y, text, font_nr); +} + +void DrawTextAligned(int x, int y, char *text, int font_nr, int align) +{ + DrawText(ALIGNED_XPOS(x, getTextWidth(text, font_nr), align), + y, text, font_nr); +} + void DrawText(int x, int y, char *text, int font_nr) { int mask_mode = BLIT_OPAQUE; @@ -251,8 +270,12 @@ void DrawText(int x, int y, char *text, int font_nr) void DrawTextExt(DrawBuffer *dst_bitmap, int dst_x, int dst_y, char *text, int font_nr, int mask_mode) { +#if 1 + struct FontBitmapInfo *font = getFontBitmapInfo(font_nr); +#else int font_bitmap_id = gfx.select_font_function(font_nr); struct FontBitmapInfo *font = &gfx.font_bitmap_info[font_bitmap_id]; +#endif int font_width = getFontWidth(font_nr); int font_height = getFontHeight(font_nr); #if 0 @@ -272,8 +295,8 @@ void DrawTextExt(DrawBuffer *dst_bitmap, int dst_x, int dst_y, char *text, return; /* add offset for drawing font characters */ - dst_x += font->draw_x; - dst_y += font->draw_y; + dst_x += font->draw_xoffset; + dst_y += font->draw_yoffset; while (*text_ptr) {