e01dccdd89833f1372f00de39613982e3a33ae9c
[rocksndiamonds.git] / src / libgame / text.h
1 /***********************************************************
2 * Artsoft Retro-Game Library                               *
3 *----------------------------------------------------------*
4 * (c) 1994-2006 Artsoft Entertainment                      *
5 *               Holger Schemel                             *
6 *               Detmolder Strasse 189                      *
7 *               33604 Bielefeld                            *
8 *               Germany                                    *
9 *               e-mail: info@artsoft.org                   *
10 *----------------------------------------------------------*
11 * text.h                                                   *
12 ***********************************************************/
13
14 #ifndef TEXT_H
15 #define TEXT_H
16
17 #include "system.h"
18
19
20 /* default fonts */
21 #define FONT_INITIAL_1          0
22 #define FONT_INITIAL_2          1
23 #define FONT_INITIAL_3          2
24 #define FONT_INITIAL_4          3
25
26 /* font colors */
27 #define FC_RED                  FONT_INITIAL_1
28 #define FC_BLUE                 FONT_INITIAL_2
29 #define FC_GREEN                FONT_INITIAL_3
30 #define FC_YELLOW               FONT_INITIAL_4
31
32 /* text output definitions */
33 #define MAX_OUTPUT_LINESIZE     1024
34
35 /* special character mapping for default fonts */
36 #define FONT_ASCII_CURSOR       ((char)160)
37 #define FONT_ASCII_BUTTON       ((char)128)
38 #define FONT_ASCII_UP           ((char)129)
39 #define FONT_ASCII_DOWN         ((char)130)
40 #define FONT_ASCII_LEFT         ((char)'<')
41 #define FONT_ASCII_RIGHT        ((char)'>')
42
43 #define MAP_FONT_ASCII(c)       ((c) >= 'a' && (c) <= 'z' ? 'A' + (c) - 'a' : \
44                                  (c) == '©'               ? 96  :             \
45                                  (c) == 'ä' || (c) == 'Ä' ? 97  :             \
46                                  (c) == 'ö' || (c) == 'Ö' ? 98  :             \
47                                  (c) == 'ü' || (c) == 'Ü' ? 99  :             \
48                                  (c) == '°'               ? 100 :             \
49                                  (c) == '®'               ? 101 :             \
50                                  (c) == FONT_ASCII_CURSOR ? 102 :             \
51                                  (c) == FONT_ASCII_BUTTON ? 109 :             \
52                                  (c) == FONT_ASCII_UP     ? 110 :             \
53                                  (c) == FONT_ASCII_DOWN   ? 111 :             \
54                                  (c))
55
56 /* 64 regular ordered ASCII characters, 6 special characters, 1 cursor char. */
57 #define MIN_NUM_CHARS_PER_FONT                  64
58 #define DEFAULT_NUM_CHARS_PER_FONT              (MIN_NUM_CHARS_PER_FONT + 6 +1)
59 #define DEFAULT_NUM_CHARS_PER_LINE              16
60
61
62 /* font structure definitions */
63
64 void InitFontInfo(struct FontBitmapInfo *, int,
65                   int (*function1)(int), int (*function2)(char *));
66 void FreeFontInfo(struct FontBitmapInfo *);
67
68 struct FontBitmapInfo *getFontBitmapInfo(int);
69
70 int getFontWidth(int);
71 int getFontHeight(int);
72 int getTextWidth(char *, int);
73
74 void getFontCharSource(int, char, Bitmap **, int *, int *);
75
76 int maxWordLengthInString(char *);
77
78 void DrawInitText(char *, int, int);
79 void DrawInitTextAlways(char *, int, int);
80 void DrawInitTextIfNeeded(char *, int, int);
81 void DrawInitTextExt(char *, int, int, boolean);
82
83 void DrawTextF(int, int, int, char *, ...);
84 void DrawTextFCentered(int, int, char *, ...);
85 void DrawTextS(int, int, int, char *);
86 void DrawTextSCentered(int, int, char *);
87 void DrawTextCentered(int, int, char *);
88 void DrawTextSAligned(int, int, char *, int, int);
89 void DrawTextAligned(int, int, char *, int, int);
90 void DrawText(int, int, char *, int);
91 void DrawTextExt(DrawBuffer *, int, int, char *, int, int);
92
93 char *GetTextBufferFromFile(char *, int);
94 int DrawTextBuffer(int, int, char *, int, int, int, int, int, int,
95                    boolean, boolean, boolean);
96 int DrawTextBufferVA(int, int, char *, va_list, int, int, int, int, int, int,
97                      boolean, boolean, boolean);
98 int DrawTextFile(int, int, char *, int, int, int, int, int, int,
99                  boolean, boolean, boolean);
100
101 #endif  /* TEXT_H */