* Initializes all the elements in the Low Fuel window. * @param game Pointer to the core game. * @param craft Pointer to the craft to display. * @param state Pointer to the Geoscape. */
| 39 | * @param state Pointer to the Geoscape. |
| 40 | */ |
| 41 | LowFuelState::LowFuelState(Game *game, Craft *craft, GeoscapeState *state) : State(game), _craft(craft), _state(state) |
| 42 | { |
| 43 | _screen = false; |
| 44 | |
| 45 | // Create objects |
| 46 | _window = new Window(this, 224, 120, 16, 40, POPUP_BOTH); |
| 47 | _btnOk = new TextButton(90, 18, 30, 120); |
| 48 | _btnOk5Secs = new TextButton(90, 18, 136, 120); |
| 49 | _txtTitle = new Text(214, 17, 21, 60); |
| 50 | _txtMessage = new Text(214, 17, 21, 90); |
| 51 | |
| 52 | // Set palette |
| 53 | setPalette("PAL_GEOSCAPE", 4); |
| 54 | |
| 55 | add(_window); |
| 56 | add(_btnOk); |
| 57 | add(_btnOk5Secs); |
| 58 | add(_txtTitle); |
| 59 | add(_txtMessage); |
| 60 | |
| 61 | centerAllSurfaces(); |
| 62 | |
| 63 | // Set up objects |
| 64 | _window->setColor(Palette::blockOffset(15)-1); |
| 65 | _window->setBackground(_game->getResourcePack()->getSurface("BACK12.SCR")); |
| 66 | |
| 67 | _btnOk->setColor(Palette::blockOffset(8)+5); |
| 68 | _btnOk->setText(tr("STR_OK")); |
| 69 | _btnOk->onMouseClick((ActionHandler)&LowFuelState::btnOkClick); |
| 70 | _btnOk->onKeyboardPress((ActionHandler)&LowFuelState::btnOkClick, Options::keyCancel); |
| 71 | |
| 72 | _btnOk5Secs->setColor(Palette::blockOffset(8)+5); |
| 73 | _btnOk5Secs->setText(tr("STR_OK_5_SECONDS")); |
| 74 | _btnOk5Secs->onMouseClick((ActionHandler)&LowFuelState::btnOk5SecsClick); |
| 75 | _btnOk5Secs->onKeyboardPress((ActionHandler)&LowFuelState::btnOk5SecsClick, Options::keyOk); |
| 76 | |
| 77 | _txtTitle->setColor(Palette::blockOffset(8)+10); |
| 78 | _txtTitle->setAlign(ALIGN_CENTER); |
| 79 | _txtTitle->setBig(); |
| 80 | _txtTitle->setText(_craft->getName(_game->getLanguage())); |
| 81 | |
| 82 | _txtMessage->setColor(Palette::blockOffset(8)+10); |
| 83 | _txtMessage->setAlign(ALIGN_CENTER); |
| 84 | _txtMessage->setText(tr("STR_IS_LOW_ON_FUEL_RETURNING_TO_BASE")); |
| 85 | |
| 86 | |
| 87 | } |
| 88 | |
| 89 | /** |
| 90 | * |
nothing calls this directly
no test coverage detected