22 #ifndef QDENGINE_SYSTEM_GRAPHICS_UI_TEXT_PARSER_H 23 #define QDENGINE_SYSTEM_GRAPHICS_UI_TEXT_PARSER_H 26 #include "qdengine/system/graphics/gr_font.h" 48 OutNode() : type(NEW_LINE), width(0) { nl.begin = 0; nl.end = 0; }
49 OutNode(
const char *b,
const char *e,
int wd) : type(TEXT), width(wd) { nl.begin = b; nl.end = e; }
50 OutNode(
int clr) : type(COLOR), width(0), color(clr) {}
62 void setFont(
const grFont *font);
64 void parseString(
const char *text,
int color = 0,
int fitIn = -1);
66 const OutNodes &outNodes()
const {
70 int fontHeight()
const {
71 return _font ? _font->size_y() : 1;
73 const Vect2i &size()
const {
77 int lineCount()
const {
80 OutNodes::const_iterator getLineBegin(
int lineNum)
const;
85 inline int fromHex(
char a) {
86 if (a >=
'0' && a <=
'9')
88 if (a >=
'A' && a <=
'F')
90 if (a >=
'a' && a <=
'f')
95 inline void addChar(byte cc) {
96 int width = _font->char_width(cc);
97 if (testWidth(width) || cc !=
' ')
102 inline void skipNode() {
104 _lastSpace = _lineBegin;
109 inline void putNode(
OutNode &node) {
110 _outNodes.push_back(node);
115 if (_pstr == _lineBegin)
117 _lineWidth += _tagWidth;
118 OutNode node(_lineBegin, _pstr, _tagWidth);
123 _size.x =
MAX(_size.x, _lineWidth);
125 _outNodes[_prevLineIndex].width = _lineWidth;
128 _outNodes.push_back(
OutNode());
129 _prevLineIndex = _outNodes.size() - 1;
134 void getColor(
int defColor);
135 int getStyle(
const char *styleptr,
const char *end);
137 bool testWidth(
int width);
142 const char *_lastSpace;
145 const char *_lineBegin;
161 #endif // QDENGINE_SYSTEM_GRAPHICS_UI_TEXT_PARSER_H
Definition: UI_TextParser.h:31
Базовый класс для игровых ресурсов.
Definition: console.h:28
Definition: UI_TextParser.h:55
T MAX(T a, T b)
Definition: util.h:62