ScummVM API documentation
messager.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 * Based on the original sources
22 * Faery Tale II -- The Halls of the Dead
23 * (c) 1993-1996 The Wyrmkeep Entertainment Co.
24 */
25
26#ifndef SAGA2_MESSAGER_H
27#define SAGA2_MESSAGER_H
28
29namespace Saga2 {
30
31class gDisplayPort;
32
33// max filename length
34#define MAX_LOG_NAME_LENGTH 260
35
36/****** messager.cpp/Messager [class] *******************************
37*
38* NAME
39* Messager [class] -- classes for handling text messages
40*
41* FUNCTION
42* The Messager classes are intended to handle text messages
43* generated by the program. Debugging text, status lines,
44* warning and error messages, and log files are some of the
45* implementations of these classes.
46*
47*
48*
49*
50* SEE ALSO
51* gError [class]
52*
53*******************************************************************/
54
55//-------------------------------------------------------------------
56// This is the base messager class
57// Note the constructor which takes a string argument. Most of the
58// Messager classes can be enabled based on the value of an
59// entry in the INI file.
60// Carriage returns are automatically appended to lines that don't
61// already have them.
62
63class Messager {
64protected:
65 bool _enabled;
66 virtual int dumpit(char *, size_t) = 0;
67
68public:
69 Messager() {
70 _enabled = true;
71 }
72 Messager(const char *entry) {
73 _enabled = true;
74 }
75 virtual ~Messager() {}
76
77 size_t operator()(const char *format, ...);
78 size_t va(const char *format, va_list argptr);
79
80 void enable() {
81 _enabled = true;
82 }
83 void disable() {
84 _enabled = false;
85 }
86 bool active() {
87 return _enabled;
88 }
89};
90
91typedef Messager *pMessager;
92
93//-------------------------------------------------------------------
94// This messager writes text on a gDisplayPort (usually mainPort).
95// If you have seen the debugging lines in FTA2, this class acts
96// like a single one of those lines. Generally you will have several
97// of these. By default the lines will be in the lower right corner,
98// but you can specify any location you like. The positions of
99// multiple lines are automatically accounted for.
100
102private:
103 int _line;
104 int32 _atX, _atY, _atW;
105 int16 _atColor;
106 gDisplayPort *_textPort;
107
108protected:
109 int dumpit(char *s, size_t size) ;
110
111public:
112 StatusLineMessager(int line, gDisplayPort *mp, int32 x = -1, int32 y = -1, int32 w = -1, int16 color = -1);
113 StatusLineMessager(const char *entry, int line, gDisplayPort *mp, int32 x = -1, int32 y = -1, int32 w = -1, int16 color = -1);
115};
116
117
118} // end of namespace Saga2
119
120#endif
Definition: messager.h:63
Definition: messager.h:101
Definition: vdraw.h:33