* Initializes all the elements in the Craft Patrol window. * @param game Pointer to the core game. * @param craft Pointer to the craft to display. * @param globe Pointer to the Geoscape globe. */
| 40 | * @param globe Pointer to the Geoscape globe. |
| 41 | */ |
| 42 | CraftPatrolState::CraftPatrolState(Game *game, Craft *craft, Globe *globe) : State(game), _craft(craft), _globe(globe) |
| 43 | { |
| 44 | _screen = false; |
| 45 | |
| 46 | // Create objects |
| 47 | _window = new Window(this, 224, 168, 16, 16, POPUP_BOTH); |
| 48 | _btnOk = new TextButton(140, 12, 58, 144); |
| 49 | _btnRedirect = new TextButton(140, 12, 58, 160); |
| 50 | _txtDestination = new Text(224, 64, 16, 48); |
| 51 | _txtPatrolling = new Text(224, 17, 16, 120); |
| 52 | |
| 53 | // Set palette |
| 54 | setPalette("PAL_GEOSCAPE", 4); |
| 55 | |
| 56 | add(_window); |
| 57 | add(_btnOk); |
| 58 | add(_btnRedirect); |
| 59 | add(_txtDestination); |
| 60 | add(_txtPatrolling); |
| 61 | |
| 62 | centerAllSurfaces(); |
| 63 | |
| 64 | // Set up objects |
| 65 | _window->setColor(Palette::blockOffset(15)-1); |
| 66 | _window->setBackground(_game->getResourcePack()->getSurface("BACK12.SCR")); |
| 67 | |
| 68 | _btnOk->setColor(Palette::blockOffset(8)+5); |
| 69 | _btnOk->setText(tr("STR_OK")); |
| 70 | _btnOk->onMouseClick((ActionHandler)&CraftPatrolState::btnOkClick); |
| 71 | _btnOk->onKeyboardPress((ActionHandler)&CraftPatrolState::btnOkClick, Options::keyCancel); |
| 72 | |
| 73 | _btnRedirect->setColor(Palette::blockOffset(8)+5); |
| 74 | _btnRedirect->setText(tr("STR_REDIRECT_CRAFT")); |
| 75 | _btnRedirect->onMouseClick((ActionHandler)&CraftPatrolState::btnRedirectClick); |
| 76 | _btnRedirect->onKeyboardPress((ActionHandler)&CraftPatrolState::btnRedirectClick, Options::keyOk); |
| 77 | |
| 78 | _txtDestination->setColor(Palette::blockOffset(15)-1); |
| 79 | _txtDestination->setBig(); |
| 80 | _txtDestination->setAlign(ALIGN_CENTER); |
| 81 | _txtDestination->setWordWrap(true); |
| 82 | _txtDestination->setText(tr("STR_CRAFT_HAS_REACHED_DESTINATION") |
| 83 | .arg(_craft->getName(_game->getLanguage())) |
| 84 | .arg(_craft->getDestination()->getName(_game->getLanguage()))); |
| 85 | |
| 86 | _txtPatrolling->setColor(Palette::blockOffset(15)-1); |
| 87 | _txtPatrolling->setBig(); |
| 88 | _txtPatrolling->setAlign(ALIGN_CENTER); |
| 89 | _txtPatrolling->setText(tr("STR_NOW_PATROLLING")); |
| 90 | } |
| 91 | |
| 92 | /** |
| 93 | * |
nothing calls this directly
no test coverage detected