UfopaediaStartState::UfopaediaStartState() { _screen = false; // set background window _window = new Window(this, 256, 180, 32, 10, POPUP_BOTH); // set title _txtTitle = new Text(224, 17, 48, 33); // Set palette setInterface("ufopaedia"); add(_window, "window", "ufopaedia"); add(_txtTitle, "text", "ufopaedia"); _btnOk = new TextButton(224, 12, 48, 167); add(_btnOk, "button1", "ufopaedia"); // set buttons const std::vector<std::string> &list = _game->getMod()->getUfopaediaCategoryList(); int y = 50; y -= 13 * (list.size() - 9); for (std::vector<std::string>::const_iterator i = list.begin(); i != list.end(); ++i) { TextButton *button = new TextButton(224, 12, 48, y); y += 13; add(button, "button1", "ufopaedia"); button->setText(tr(*i)); button->onMouseClick((ActionHandler)&UfopaediaStartState::btnSectionClick); _btnSections.push_back(button); } if (!_btnSections.empty()) _txtTitle->setY(_btnSections.front()->getY() - _txtTitle->getHeight()); centerAllSurfaces(); _window->setBackground(_game->getMod()->getSurface("BACK01.SCR")); _txtTitle->setBig(); _txtTitle->setAlign(ALIGN_CENTER); _txtTitle->setText(tr("STR_UFOPAEDIA")); _btnOk->setText(tr("STR_OK")); _btnOk->onMouseClick((ActionHandler)&UfopaediaStartState::btnOkClick); _btnOk->onKeyboardPress((ActionHandler)&UfopaediaStartState::btnOkClick, Options::keyCancel); _btnOk->onKeyboardPress((ActionHandler)&UfopaediaStartState::btnOkClick, Options::keyGeoUfopedia); }
/** * Initializes all the elements in the Psi Training screen. * @param game Pointer to the core game. */ PsiTrainingState::PsiTrainingState() { // Create objects _window = new Window(this, 320, 200, 0, 0); _txtTitle = new Text(300, 17, 10, 16); _btnOk = new TextButton(160, 14, 80, 174); // Set palette setPalette("PAL_BASESCAPE", 7); add(_window); add(_btnOk); add(_txtTitle); // Set up objects _window->setColor(Palette::blockOffset(15)+6); _window->setBackground(_game->getResourcePack()->getSurface("BACK01.SCR")); _btnOk->setColor(Palette::blockOffset(13)+10); _btnOk->setText(tr("STR_OK")); _btnOk->onMouseClick((ActionHandler)&PsiTrainingState::btnOkClick); _btnOk->onKeyboardPress((ActionHandler)&PsiTrainingState::btnOkClick, Options::keyCancel); _txtTitle->setColor(Palette::blockOffset(13)+10); _txtTitle->setBig(); _txtTitle->setAlign(ALIGN_CENTER); _txtTitle->setText(tr("STR_PSIONIC_TRAINING")); int buttons = 0; for(std::vector<Base*>::const_iterator b = _game->getSavedGame()->getBases()->begin(); b != _game->getSavedGame()->getBases()->end(); ++b) { if((*b)->getAvailablePsiLabs()) { TextButton *btnBase = new TextButton(160, 14, 80, 40 + 16 * buttons); btnBase->setColor(Palette::blockOffset(15) + 6); btnBase->onMouseClick((ActionHandler)&PsiTrainingState::btnBaseXClick); btnBase->setText((*b)->getName()); add(btnBase); _bases.push_back(*b); _btnBases.push_back(btnBase); ++buttons; if (buttons >= 8) { break; } } } centerAllSurfaces(); }
/** * Initializes all the elements in the Multiple Targets window. * @param game Pointer to the core game. * @param targets List of targets to display. * @param craft Pointer to craft to retarget (NULL if none). * @param state Pointer to the Geoscape state. */ MultipleTargetsState::MultipleTargetsState(Game *game, std::vector<Target*> targets, Craft *craft, GeoscapeState *state) : State(game), _targets(targets), _craft(craft), _state(state) { _screen = false; if (_targets.size() > 1) { int winHeight = BUTTON_HEIGHT * _targets.size() + SPACING * (_targets.size() - 1) + MARGIN * 2; int winY = (200 - winHeight) / 2; int btnY = winY + MARGIN; // Create objects _window = new Window(this, 136, winHeight, 60, winY, POPUP_VERTICAL); // Set palette setPalette("PAL_GEOSCAPE", 7); add(_window); // Set up objects _window->setColor(Palette::blockOffset(8) + 5); _window->setBackground(_game->getResourcePack()->getSurface("BACK15.SCR")); int y = btnY; for (size_t i = 0; i < _targets.size(); ++i) { TextButton *button = new TextButton(116, BUTTON_HEIGHT, 70, y); button->setColor(Palette::blockOffset(8) + 5); button->setText(_targets[i]->getName(_game->getLanguage())); button->onMouseClick((ActionHandler)&MultipleTargetsState::btnTargetClick); add(button); _btnTargets.push_back(button); y += button->getHeight() + SPACING; } _btnTargets[0]->onKeyboardPress((ActionHandler)&MultipleTargetsState::btnCancelClick, Options::keyCancel); centerAllSurfaces(); } }