1 /* ResidualVM - A 3D game interpreter
2  *
3  * ResidualVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the AUTHORS
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 #include "engines/stark/ui/world/clicktext.h"
24 
25 #include "engines/stark/services/services.h"
26 
27 #include "engines/stark/visual/text.h"
28 
29 namespace Stark {
30 
ClickText(const Common::String & text,const Color & color)31 ClickText::ClickText(const Common::String &text, const Color &color) :
32 		_text(text),
33 		_color(color) {
34 	_visualPassive = new VisualText(StarkGfx);
35 	_visualPassive->setText(_text);
36 	_visualPassive->setColor(_color);
37 	_visualPassive->setFont(FontProvider::kBigFont);
38 	_visualPassive->setTargetWidth(600);
39 
40 	_visualActive = new VisualText(StarkGfx);
41 	_visualActive->setText(_text);
42 	_visualActive->setColor(Color(0x00, 0x00, 0x00));
43 	_visualActive->setBackgroundColor(_color);
44 	_visualActive->setFont(FontProvider::kBigFont);
45 	_visualActive->setTargetWidth(600);
46 
47 	_curVisual = _visualPassive;
48 	_bbox = _curVisual->getRect();
49 }
50 
~ClickText()51 ClickText::~ClickText() {
52 	delete _visualActive;
53 	delete _visualPassive;
54 }
55 
render()56 void ClickText::render() {
57 	_curVisual->render(_position);
58 }
59 
containsPoint(const Common::Point & point) const60 bool ClickText::containsPoint(const Common::Point &point) const {
61 	Common::Rect r = _bbox;
62 	r.translate(_position.x, _position.y);
63 	return r.contains(point);
64 }
65 
66 } // End of namespace Stark
67