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