scummvm/engines/grim/textobject.h

104 lines
2.5 KiB
C
Raw Normal View History

2009-05-26 14:13:08 +00:00
/* Residual - A 3D game interpreter
*
* Residual is the legal property of its developers, whose names
2011-04-16 14:12:44 +02:00
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
2006-04-02 14:20:45 +00:00
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*
* $URL$
* $Id$
*
*/
2009-05-26 09:39:42 +00:00
#ifndef GRIM_TEXTOBJECT_H
#define GRIM_TEXTOBJECT_H
#include "engines/grim/gfx_base.h"
2005-01-01 12:27:57 +00:00
2009-05-25 06:49:57 +00:00
namespace Grim {
2009-06-23 05:15:20 +00:00
class SaveGame;
2011-05-13 17:55:14 -07:00
class Font;
2009-06-23 05:15:20 +00:00
struct TextObjectDefaults {
Color *fgColor;
int x, y;
int width, height;
int justify;
bool disabled;
Font *font;
};
#define TEXT_NULL ' '
class TextObject : public Object {
public:
2009-11-16 18:09:51 +00:00
TextObject(bool blastDraw, bool isSpeech = false);
TextObject();
~TextObject();
void createBitmap();
void destroyBitmap();
void setDefaults(TextObjectDefaults *defaults);
2009-10-17 13:25:12 +00:00
void setText(const char *text);
void setX(int x) { _x = x; }
void setY(int y) { _y = y; }
2011-05-13 17:55:14 -07:00
void subBaseOffsetY();
int getBaseOffsetY();
void setWidth(int width) { _width = width; }
void setHeight(int height) { _height = height; }
void setFGColor(Color *fgColor) { _fgColor = fgColor; }
void setFont(Font *font) { _font = font; }
void setJustify(int justify) { _justify = justify; }
void setDisabled(bool disabled) { _disabled = disabled; }
int getBitmapWidth();
int getBitmapHeight();
2005-04-05 04:33:56 +00:00
int getTextCharPosition(int pos);
2011-05-05 11:52:44 +02:00
const char *getName() const { return _textID; }
void draw();
2011-03-21 17:18:04 +01:00
void saveState(SaveGame *state) const;
bool restoreState(SaveGame *state);
enum Justify {
NONE,
CENTER,
LJUSTIFY,
RJUSTIFY
};
protected:
bool _created;
Color *_fgColor;
2004-12-09 23:55:43 +00:00
int _x, _y;
int _width, _height;
int _justify, _numberLines;
bool _disabled;
bool _blastDraw;
2009-11-16 18:09:51 +00:00
bool _isSpeech;
Font *_font;
2005-08-21 13:37:06 +00:00
char _textID[256];
uint8 *_textBitmap;
2007-01-29 18:42:58 +00:00
int *_bitmapWidthPtr;
2009-05-07 19:06:31 +00:00
GfxBase::TextObjectHandle **_textObjectHandle;
friend class GrimEngine;
};
2009-05-25 06:49:57 +00:00
} // end of namespace Grim
#endif