ScummVM API documentation
TextManager.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 QDENGINE_MINIGAMES_ADV_TEXT_MANAGER_H
23#define QDENGINE_MINIGAMES_ADV_TEXT_MANAGER_H
24
25#include "qdengine/minigames/adv/ObjectContainer.h"
26
27namespace QDEngine {
28
29enum TextAlign {
30 ALIGN_LEFT,
31 ALIGN_RIGHT,
32 ALIGN_CENTER
33};
34
36public:
39
40 int createStaticText(const mgVect3f& screen_pos, int fontID, TextAlign align);
41 void updateStaticText(int textID, const char *txt);
42
43 void showText(const char *txt, const mgVect2f& pos, int fontID, int escapeID);
44 void showNumber(int num, const mgVect2f& pos, int fontID, int escapeID);
45
46 void quant(float dt);
47 void updateScore(int score);
48 void updateTime(int seconds);
49
50private:
51 struct Font {
52 mgVect2f size;
53 ObjectContainer pool;
54 };
56
57 struct Escape {
58 Escape();
59 int depth;
60 float aliveTime;
61 mgVect2f vel_min;
62 mgVect2f vel_max;
63 mgVect2f accel_min;
64 mgVect2f accel_max;
65 char format[16];
66 };
68
69 struct StaticTextPreset {
70 StaticTextPreset();
71 mgVect3f pos;
72 int font;
73 TextAlign align;
74 char format[16];
75 int textID;
76 };
77 bool getStaticPreset(StaticTextPreset& preset, const char *name) const;
78
79 struct StaticMessage {
80 StaticMessage(MinigameManager *runtime, Font *font = 0, TextAlign _align = ALIGN_CENTER);
81 void release();
82
83 bool empty() const {
84 return _objects.empty();
85 }
86
87 void setText(const char *str);
88
89 int _depth;
90 mgVect2f _pos;
91 TextAlign _align;
92
93 protected:
94 void update();
95 bool validSymbol(unsigned char ch) const {
96 return ch > ' ' && ch != '_';
97 }
98
99 private:
100 Font *_font;
101
102 QDObjects _objects;
103
104 MinigameManager *_runtime;
105 };
107
108 struct Message : public StaticMessage {
109 Message(MinigameManager *runtime, Font *font = 0);
110 void release();
111
112 void quant(float dt);
113
114 float _time;
115 mgVect2f _vel;
116 mgVect2f _accel;
117 };
119
120 Fonts _fonts;
121 Escapes _escapes;
122 StaticTextPreset _show_scores;
123 StaticTextPreset _show_time;
124 StaticMessages _staticMsgs;
125 Messages _flowMsgs;
126
127 int _targetScore;
128 int _currentScore;
129 float _scoreUpdateTime;
130 float _scoreUpdateTimer;
131
132 MinigameManager *_runtime;
133};
134
135} // namespace QDEngine
136
137#endif // QDENGINE_MINIGAMES_ADV_TEXT_MANAGER_H
Definition: RunTime.h:94
Definition: ObjectContainer.h:27
Definition: TextManager.h:35
Базовый класс для игровых ресурсов.
Definition: console.h:28