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 8 * modify it under the terms of the GNU General Public License 9 * as published by the Free Software Foundation; either version 2 10 * of the License, or (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, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 * 21 */ 22 23 #ifndef ILLUSIONS_SCREENTEXT_H 24 #define ILLUSIONS_SCREENTEXT_H 25 26 #include "illusions/graphics.h" 27 #include "common/list.h" 28 #include "common/rect.h" 29 #include "graphics/surface.h" 30 31 namespace Illusions { 32 33 #define TEXT_FLAG_LEFT_ALIGN 1 34 #define TEXT_FLAG_CENTER_ALIGN 2 35 #define TEXT_FLAG_RIGHT_ALIGN 4 36 #define TEXT_FLAG_BORDER_DECORATION 24 37 38 class IllusionsEngine; 39 class FontResource; 40 41 struct ScreenTextInfo { 42 Common::Point _position; 43 WidthHeight _dimensions; 44 Common::Point _offsPt; 45 uint32 _fontId; 46 uint16 _backgroundColor; 47 uint16 _borderColor; 48 byte _colorR, _colorG, _colorB; 49 uint _flags; 50 }; 51 52 struct ScreenTextEntry { 53 ScreenTextInfo _info; 54 uint16 _text[1024]; 55 }; 56 57 class ScreenText { 58 public: 59 ScreenText(IllusionsEngine *vm); 60 ~ScreenText(); 61 void getTextInfoDimensions(WidthHeight &textInfoDimensions); 62 void getTextInfoPosition(Common::Point &position); 63 void setTextInfoPosition(Common::Point position); 64 void updateTextInfoPosition(Common::Point position); 65 void clipTextInfoPosition(Common::Point &position); 66 bool refreshScreenText(FontResource *font, WidthHeight dimensions, Common::Point offsPt, 67 uint16 *text, uint textFlags, uint16 backgroundColor, uint16 borderColor, uint16 *&outTextPtr); 68 bool insertText(uint16 *text, uint32 fontId, WidthHeight dimensions, Common::Point offsPt, uint flags, 69 uint16 backgroundColor, uint16 borderColor, byte colorR, byte colorG, byte colorB, uint16 *&outTextPtr); 70 void removeText(); 71 void clearText(); 72 public: 73 IllusionsEngine *_vm; 74 Common::Point _position; 75 WidthHeight _dimensions; 76 Graphics::Surface *_surface; 77 Common::List<ScreenTextEntry*> _screenTexts; 78 void freeTextSurface(); 79 }; 80 81 } // End of namespace Illusions 82 83 #endif // ILLUSIONS_SCREENTEXT_H 84