* Initializes all the elements in the Craft Weapons window. * @param game Pointer to the core game. * @param base Pointer to the base to get info from. * @param craft ID of the selected craft. * @param weapon ID of the selected weapon. */
| 46 | * @param weapon ID of the selected weapon. |
| 47 | */ |
| 48 | CraftWeaponsState::CraftWeaponsState(Game *game, Base *base, size_t craft, size_t weapon) : State(game), _base(base), _craft(craft), _weapon(weapon), _weapons() |
| 49 | { |
| 50 | _screen = false; |
| 51 | |
| 52 | // Create objects |
| 53 | _window = new Window(this, 220, 160, 50, 20, POPUP_BOTH); |
| 54 | _btnCancel = new TextButton(140, 16, 90, 156); |
| 55 | _txtTitle = new Text(208, 17, 56, 28); |
| 56 | _txtArmament = new Text(76, 9, 66, 52); |
| 57 | _txtQuantity = new Text(50, 9, 140, 52); |
| 58 | _txtAmmunition = new Text(68, 17, 200, 44); |
| 59 | _lstWeapons = new TextList(188, 80, 58, 68); |
| 60 | |
| 61 | // Set palette |
| 62 | setPalette("PAL_BASESCAPE", 4); |
| 63 | |
| 64 | add(_window); |
| 65 | add(_btnCancel); |
| 66 | add(_txtTitle); |
| 67 | add(_txtArmament); |
| 68 | add(_txtQuantity); |
| 69 | add(_txtAmmunition); |
| 70 | add(_lstWeapons); |
| 71 | |
| 72 | centerAllSurfaces(); |
| 73 | |
| 74 | // Set up objects |
| 75 | _window->setColor(Palette::blockOffset(15)+6); |
| 76 | _window->setBackground(_game->getResourcePack()->getSurface("BACK14.SCR")); |
| 77 | |
| 78 | _btnCancel->setColor(Palette::blockOffset(15)+6); |
| 79 | _btnCancel->setText(tr("STR_CANCEL_UC")); |
| 80 | _btnCancel->onMouseClick((ActionHandler)&CraftWeaponsState::btnCancelClick); |
| 81 | _btnCancel->onKeyboardPress((ActionHandler)&CraftWeaponsState::btnCancelClick, Options::keyCancel); |
| 82 | |
| 83 | _txtTitle->setColor(Palette::blockOffset(15)+6); |
| 84 | _txtTitle->setBig(); |
| 85 | _txtTitle->setAlign(ALIGN_CENTER); |
| 86 | _txtTitle->setText(tr("STR_SELECT_ARMAMENT")); |
| 87 | |
| 88 | _txtArmament->setColor(Palette::blockOffset(15)+6); |
| 89 | _txtArmament->setText(tr("STR_ARMAMENT")); |
| 90 | |
| 91 | _txtQuantity->setColor(Palette::blockOffset(15)+6); |
| 92 | _txtQuantity->setText(tr("STR_QUANTITY_UC")); |
| 93 | |
| 94 | _txtAmmunition->setColor(Palette::blockOffset(15)+6); |
| 95 | _txtAmmunition->setText(tr("STR_AMMUNITION_AVAILABLE")); |
| 96 | _txtAmmunition->setWordWrap(true); |
| 97 | |
| 98 | _lstWeapons->setColor(Palette::blockOffset(13)+10); |
| 99 | _lstWeapons->setArrowColor(Palette::blockOffset(15)+6); |
| 100 | _lstWeapons->setColumns(3, 94, 50, 36); |
| 101 | _lstWeapons->setSelectable(true); |
| 102 | _lstWeapons->setBackground(_window); |
| 103 | _lstWeapons->setMargin(8); |
| 104 | |
| 105 | _lstWeapons->addRow(1, tr("STR_NONE_UC").c_str()); |
nothing calls this directly
no test coverage detected