ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

textobject.h

Go to the documentation of this file.
00001 /* ResidualVM - A 3D game interpreter
00002  *
00003  * ResidualVM is the legal property of its developers, whose names
00004  * are too numerous to list here. Please refer to the AUTHORS
00005  * file distributed with this source distribution.
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation; either version 2
00010  * of the License, or (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00020  *
00021  */
00022 
00023 #ifndef GRIM_TEXTOBJECT_H
00024 #define GRIM_TEXTOBJECT_H
00025 
00026 #include "engines/grim/pool.h"
00027 #include "engines/grim/color.h"
00028 
00029 #include "common/endian.h"
00030 
00031 namespace Grim {
00032 
00033 class SaveGame;
00034 class Font;
00035 
00036 class TextObjectCommon {
00037 public:
00038     void setX(int x) { _x = x; }
00039     int getX() const { return _x; }
00040 
00041     void setY(int y) { _y = y; }
00042     int getY() const { return _y; }
00043 
00044     void setFont(const Font *font) { _font = font; }
00045     const Font *getFont() const { return _font; }
00046 
00047     void setFGColor(const Color &fgColor) { _fgColor = fgColor; }
00048     Color getFGColor() const { return _fgColor; }
00049 
00050     void setJustify(int justify) { _justify = justify; }
00051     int getJustify() const { return _justify; }
00052 
00053     void setWidth(int width) { _width = width; }
00054     int getWidth() const { return _width; }
00055 
00056     void setHeight(int height) { _height = height; }
00057     int getHeight() const { return _height; }
00058 
00059     void setDuration(int duration) { _duration = duration; }
00060     int getDuration() const { return _duration; }
00061 
00062     void setLayer(int layer);
00063     int getLayer() const { return _layer; }
00064 
00065 protected:
00066     TextObjectCommon();
00067 
00068     const Font *_font;
00069     int _x, _y;
00070     int _width, _height;
00071     int _justify;
00072     int _duration;
00073     int _layer;
00074     Color _fgColor;
00075 };
00076 
00077 class TextObjectDefaults : public TextObjectCommon {
00078 
00079 };
00080 
00081 class TextObject : public PoolObject<TextObject>,
00082                    public TextObjectCommon {
00083 public:
00084     TextObject();
00085     ~TextObject();
00086 
00087     static int32 getStaticTag() { return MKTAG('T', 'E', 'X', 'T'); }
00088 
00089     void setDefaults(const TextObjectDefaults *defaults);
00090     void setText(const Common::String &text, bool delaySetup);
00091     void reset();
00092 
00093     int getBitmapWidth() const;
00094     int getBitmapHeight() const;
00095     int getTextCharPosition(int pos);
00096 
00097     int getLineX(int line) const;
00098     int getLineY(int line) const;
00099 
00100     void setIsSpeech() { _isSpeech = true; }
00101     void setBlastDraw() { _blastDraw = true; }
00102     bool isBlastDraw() { return _blastDraw; }
00103 
00104     const void *getUserData() const { return _userData; }
00105     void setUserData(void *data) { _userData = data; }
00106 
00107     const Common::String *getLines() const { return _lines; }
00108     int getNumLines() const { return _numberLines; }
00109 
00110     const Common::String &getName() const { return _textID; }
00111     void draw();
00112     void update();
00113 
00114     void destroy();
00115 
00116     void saveState(SaveGame *state) const;
00117     bool restoreState(SaveGame *state);
00118 
00119     int getStackLevel() { return _stackLevel; }
00120     void incStackLevel() { _stackLevel++; }
00121     void decStackLevel() { assert(_stackLevel > 0); _stackLevel--; }
00122 
00123     enum Justify {
00124         NONE,
00125         CENTER,
00126         LJUSTIFY,
00127         RJUSTIFY
00128     };
00129 
00130 protected:
00131     void setupText();
00132 
00133     Common::String _textID;
00134 
00135     Common::String *_lines;
00136 
00137     void *_userData;
00138 
00139     int _numberLines;
00140     int _elapsedTime;
00141     int _maxLineWidth;
00142 
00143     bool _blastDraw;
00144     bool _isSpeech;
00145     bool _created;
00146 
00147     int _stackLevel;
00148 };
00149 
00150 } // end of namespace Grim
00151 
00152 #endif


Generated on Sat Mar 23 2019 05:02:16 for ResidualVM by doxygen 1.7.1
curved edge   curved edge