* Initializes all the elements in the Intercept window. * @param game Pointer to the core game. * @param globe Pointer to the Geoscape globe. * @param base Pointer to base to show contained crafts (NULL to show all crafts). * @param target Pointer to target to intercept (NULL to ask user for target). */
| 47 | * @param target Pointer to target to intercept (NULL to ask user for target). |
| 48 | */ |
| 49 | InterceptState::InterceptState(Game *game, Globe *globe, Base *base, Target *target) : State(game), _globe(globe), _base(base), _target(target), _crafts() |
| 50 | { |
| 51 | _screen = false; |
| 52 | |
| 53 | // Create objects |
| 54 | _window = new Window(this, 320, 140, 0, 30, POPUP_HORIZONTAL); |
| 55 | _btnCancel = new TextButton(_base ? 142 : 288, 16, 16, 146); |
| 56 | _btnGotoBase = new TextButton(142, 16, 162, 146); |
| 57 | _txtTitle = new Text(300, 17, 10, 46); |
| 58 | _txtCraft = new Text(86, 9, 14, 70); |
| 59 | _txtStatus = new Text(70, 9, 100, 70); |
| 60 | _txtBase = new Text(80, 9, 170, 70); |
| 61 | _txtWeapons = new Text(80, 17, 238, 62); |
| 62 | _lstCrafts = new TextList(288, 64, 8, 78); |
| 63 | |
| 64 | // Set palette |
| 65 | setPalette("PAL_GEOSCAPE", 4); |
| 66 | |
| 67 | add(_window); |
| 68 | add(_btnCancel); |
| 69 | add(_btnGotoBase); |
| 70 | add(_txtTitle); |
| 71 | add(_txtCraft); |
| 72 | add(_txtStatus); |
| 73 | add(_txtBase); |
| 74 | add(_txtWeapons); |
| 75 | add(_lstCrafts); |
| 76 | |
| 77 | centerAllSurfaces(); |
| 78 | |
| 79 | // Set up objects |
| 80 | _window->setColor(Palette::blockOffset(15)-1); |
| 81 | _window->setBackground(_game->getResourcePack()->getSurface("BACK12.SCR")); |
| 82 | |
| 83 | _btnCancel->setColor(Palette::blockOffset(8)+5); |
| 84 | _btnCancel->setText(tr("STR_CANCEL")); |
| 85 | _btnCancel->onMouseClick((ActionHandler)&InterceptState::btnCancelClick); |
| 86 | _btnCancel->onKeyboardPress((ActionHandler)&InterceptState::btnCancelClick, Options::keyCancel); |
| 87 | _btnCancel->onKeyboardPress((ActionHandler)&InterceptState::btnCancelClick, Options::keyGeoIntercept); |
| 88 | |
| 89 | _btnGotoBase->setColor(Palette::blockOffset(8)+5); |
| 90 | _btnGotoBase->setText(tr("STR_GO_TO_BASE")); |
| 91 | _btnGotoBase->onMouseClick((ActionHandler)&InterceptState::btnGotoBaseClick); |
| 92 | _btnGotoBase->setVisible(_base != 0); |
| 93 | |
| 94 | _txtTitle->setColor(Palette::blockOffset(15)-1); |
| 95 | _txtTitle->setAlign(ALIGN_CENTER); |
| 96 | _txtTitle->setBig(); |
| 97 | _txtTitle->setText(tr("STR_LAUNCH_INTERCEPTION")); |
| 98 | |
| 99 | _txtCraft->setColor(Palette::blockOffset(8)+5); |
| 100 | _txtCraft->setText(tr("STR_CRAFT")); |
| 101 | |
| 102 | _txtStatus->setColor(Palette::blockOffset(8)+5); |
| 103 | _txtStatus->setText(tr("STR_STATUS")); |
| 104 | |
| 105 | _txtBase->setColor(Palette::blockOffset(8)+5); |
| 106 | _txtBase->setText(tr("STR_BASE")); |
nothing calls this directly
no test coverage detected