ScummVM API documentation
font.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef NUVIE_FONTS_FONT_H
23 #define NUVIE_FONTS_FONT_H
24 
25 namespace Ultima {
26 namespace Nuvie {
27 
28 #define FONT_COLOR_U6_NORMAL 0x48
29 #define FONT_COLOR_U6_HIGHLIGHT 0x0c
30 #define FONT_COLOR_WOU_NORMAL 0
31 #define FONT_COLOR_WOU_CONVERSE_INPUT 1
32 
33 #define FONT_COLOR_WOU_HIGHLIGHT 4
34 
35 #define FONT_UP_ARROW_CHAR 19
36 #define FONT_DOWN_ARROW_CHAR 20
37 
38 class Configuration;
39 class Screen;
40 class U6Shape;
41 
42 class Font {
43 protected:
44  uint16 num_chars;
45  uint16 offset;
46  uint8 default_color, default_highlight_color;
47 
48 private:
49 
50 
51 public:
52 
53  Font();
54  virtual ~Font();
55  uint8 getDefaultColor() {
56  return default_color;
57  }
58  void setDefaultColor(uint8 color) {
59  default_color = color;
60  }
61  void setDefaultHighlightColor(uint8 color) {
62  default_highlight_color = color;
63  }
64 
65 // bool drawString(Screen *screen, Std::string str, uint16 x, uint16 y);
66  uint16 drawString(Screen *screen, const char *str, uint16 x, uint16 y);
67  uint16 drawString(Screen *screen, const char *str, uint16 x, uint16 y, uint8 color, uint8 highlight_color);
68  uint16 drawString(Screen *screen, const char *str, uint16 string_len, uint16 x, uint16 y, uint8 color, uint8 highlight_color);
69 
70  uint16 drawChar(Screen *screen, uint8 char_num, uint16 x, uint16 y);
71  virtual uint16 drawChar(Screen *screen, uint8 char_num, uint16 x, uint16 y,
72  uint8 color) = 0;
73 
74  uint16 drawStringToShape(U6Shape *shp, const char *str, uint16 x, uint16 y, uint8 color);
75  uint8 drawCharToShape(U6Shape *shp, uint8 char_num, uint16 x, uint16 y, uint8 color);
76 
77  virtual uint16 getCharWidth(uint8 c) = 0;
78  virtual uint16 getCharHeight() = 0;
79  uint16 getStringWidth(const char *str);
80  virtual uint16 getStringWidth(const char *str, uint16 string_len);
81 
82  void setOffset(uint16 off) {
83  offset = off;
84  }
85 
86 protected:
87 
88  uint8 get_char_num(uint8 c);
89 
90 };
91 
92 } // End of namespace Nuvie
93 } // End of namespace Ultima
94 
95 #endif
Definition: atari-screen.h:60
Definition: screen.h:41
Definition: u6_shape.h:47
Definition: detection.h:27
Definition: font.h:42