X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Flibgame%2Ftext.h;h=b1f4c91575219b0153e8dba24d7638c5bcbd3983;hb=e300f91a9ee9f6160aff68d3bc50a21b797d9941;hp=44cdbf152ac276d877ac2590a00fc7b7574b3ee6;hpb=c38b8938950533926b72af227c38513fe665a8f6;p=rocksndiamonds.git diff --git a/src/libgame/text.h b/src/libgame/text.h index 44cdbf15..b1f4c915 100644 --- a/src/libgame/text.h +++ b/src/libgame/text.h @@ -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 * @@ -17,61 +17,73 @@ #include "system.h" -/* font types */ -#define FS_INITIAL 0 -#define FS_BIG 1 -#define FS_MEDIUM 2 -#define FS_SMALL 3 -#define FS_TILE 4 +/* default fonts */ +#define FONT_INITIAL_1 0 +#define FONT_INITIAL_2 1 +#define FONT_INITIAL_3 2 +#define FONT_INITIAL_4 3 /* font colors */ -#define FC_RED 0 -#define FC_BLUE 1 -#define FC_GREEN 2 -#define FC_YELLOW 3 -#define FC_SPECIAL1 4 -#define FC_SPECIAL2 5 -#define FC_SPECIAL3 6 - -/* font graphics definitions */ -#define FONT1_XSIZE 32 -#define FONT1_YSIZE 32 -#define FONT2_XSIZE 14 -#define FONT2_YSIZE 14 -#define FONT3_XSIZE 11 -#define FONT3_YSIZE 14 -#define FONT4_XSIZE 16 -#define FONT4_YSIZE 16 -#define FONT5_XSIZE 10 -#define FONT5_YSIZE 14 -#define FONT6_XSIZE 16 -#define FONT6_YSIZE 32 - -#define FONT_CHARS_PER_LINE 16 -#define FONT_LINES_PER_FONT 4 +#define FC_RED FONT_INITIAL_1 +#define FC_BLUE FONT_INITIAL_2 +#define FC_GREEN FONT_INITIAL_3 +#define FC_YELLOW FONT_INITIAL_4 /* text output definitions */ -#define MAX_OUTPUT_LINESIZE 256 +#define MAX_OUTPUT_LINESIZE 1024 + +/* special character mapping for default fonts */ +#define FONT_ASCII_CURSOR ((char)160) +#define FONT_ASCII_BUTTON ((char)128) +#define FONT_ASCII_UP ((char)129) +#define FONT_ASCII_DOWN ((char)130) +#define FONT_ASCII_LEFT ((char)'<') +#define FONT_ASCII_RIGHT ((char)'>') + +#define MAP_FONT_ASCII(c) ((c) >= 'a' && (c) <= 'z' ? 'A' + (c) - 'a' : \ + (c) == '©' ? 96 : \ + (c) == 'ä' || (c) == 'Ä' ? 97 : \ + (c) == 'ö' || (c) == 'Ö' ? 98 : \ + (c) == 'ü' || (c) == 'Ü' ? 99 : \ + (c) == '°' ? 100 : \ + (c) == '®' ? 101 : \ + (c) == FONT_ASCII_CURSOR ? 102 : \ + (c) == FONT_ASCII_BUTTON ? 109 : \ + (c) == FONT_ASCII_UP ? 110 : \ + (c) == FONT_ASCII_DOWN ? 111 : \ + (c)) + +/* 64 regular ordered ASCII characters, 6 special characters, 1 cursor char. */ +#define MIN_NUM_CHARS_PER_FONT 64 +#define DEFAULT_NUM_CHARS_PER_FONT (MIN_NUM_CHARS_PER_FONT + 6 +1) +#define DEFAULT_NUM_CHARS_PER_LINE 16 + /* font structure definitions */ -struct FontInfo -{ - Bitmap *bitmap_initial; - Bitmap *bitmap_big; - Bitmap *bitmap_medium; - Bitmap *bitmap_small; - Bitmap *bitmap_tile; -}; +void InitFontInfo(struct FontBitmapInfo *, int, int (*function)(int)); +void FreeFontInfo(struct FontBitmapInfo *); + +struct FontBitmapInfo *getFontBitmapInfo(int); + +int getFontWidth(int); +int getFontHeight(int); +int getTextWidth(char *, int); +void getFontCharSource(int, char, Bitmap **, int *, int *); -void InitFontInfo(Bitmap *, Bitmap *, Bitmap *, Bitmap *, Bitmap *); -int getFontWidth(int, int); -int getFontHeight(int, int); void DrawInitText(char *, int, int); void DrawTextF(int, int, int, char *, ...); void DrawTextFCentered(int, int, char *, ...); -void DrawText(int, int, char *, int, int); +void DrawTextS(int, int, int, char *); +void DrawTextSCentered(int, int, char *); +void DrawTextSAligned(int, int, char *, int, int); +void DrawTextAligned(int, int, char *, int, int); +void DrawText(int, int, char *, int); void DrawTextExt(DrawBuffer *, int, int, char *, int, int); +void DrawTextToTextArea(int, int, char *, int, int, int, int, int); +boolean RenderLineToBuffer(char **, char *, int *, boolean, int); +void DrawTextWrapped(int, int, char *, int, int, int); +int DrawTextFromFile(int, int, char *, int, int, int, boolean); #endif /* TEXT_H */