1 /* 2 * Copyright 2010-2014 OpenXcom Developers. 3 * 4 * This file is part of OpenXcom. 5 * 6 * OpenXcom is free software: you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation, either version 3 of the License, or 9 * (at your option) any later version. 10 * 11 * OpenXcom is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with OpenXcom. If not, see <http://www.gnu.org/licenses/>. 18 */ 19 20 #include "Ufopaedia.h" 21 #include "../Ruleset/ArticleDefinition.h" 22 #include "ArticleStateTextImage.h" 23 #include "../Engine/Game.h" 24 #include "../Engine/Palette.h" 25 #include "../Engine/Surface.h" 26 #include "../Engine/Language.h" 27 #include "../Resource/ResourcePack.h" 28 #include "../Interface/Text.h" 29 #include "../Interface/TextButton.h" 30 31 namespace OpenXcom 32 { 33 ArticleStateTextImage(Game * game,ArticleDefinitionTextImage * defs)34 ArticleStateTextImage::ArticleStateTextImage(Game *game, ArticleDefinitionTextImage *defs) : ArticleState(game, defs->id) 35 { 36 // add screen elements 37 _txtTitle = new Text(defs->text_width, 48, 5, 22); 38 39 // Set palette 40 setPalette("PAL_UFOPAEDIA"); 41 42 ArticleState::initLayout(); 43 44 // add other elements 45 add(_txtTitle); 46 47 // Set up objects 48 _game->getResourcePack()->getSurface(defs->image_id)->blit(_bg); 49 _btnOk->setColor(Palette::blockOffset(5)+3); 50 _btnPrev->setColor(Palette::blockOffset(5)+3); 51 _btnNext->setColor(Palette::blockOffset(5)+3); 52 53 _txtTitle->setColor(Palette::blockOffset(15)+4); 54 _txtTitle->setBig(); 55 _txtTitle->setWordWrap(true); 56 _txtTitle->setText(tr(defs->title)); 57 58 int text_height = _txtTitle->getTextHeight(); 59 60 _txtInfo = new Text(defs->text_width, 162, 5, 23 + text_height); 61 add(_txtInfo); 62 63 _txtInfo->setColor(Palette::blockOffset(15)-1); 64 _txtInfo->setWordWrap(true); 65 _txtInfo->setText(tr(defs->text)); 66 67 centerAllSurfaces(); 68 } 69 ~ArticleStateTextImage()70 ArticleStateTextImage::~ArticleStateTextImage() 71 {} 72 73 } 74