* Initializes all the elements in the Confirm Load screen. * @param game Pointer to the core game. * @param origin Game section that originated this state. * @param fileName Name of the save file without extension. */
| 37 | * @param fileName Name of the save file without extension. |
| 38 | */ |
| 39 | ConfirmLoadState::ConfirmLoadState(Game *game, OptionsOrigin origin, std::string fileName) : State(game), _origin(origin), _fileName(fileName) |
| 40 | { |
| 41 | _screen = false; |
| 42 | |
| 43 | // Create objects |
| 44 | _window = new Window(this, 216, 100, 52, 50, POPUP_BOTH); |
| 45 | _btnYes = new TextButton(50, 20, 70, 120); |
| 46 | _btnNo = new TextButton(50, 20, 200, 120); |
| 47 | _txtText = new Text(204, 58, 58, 60); |
| 48 | |
| 49 | // Set palette |
| 50 | if (_origin == OPT_BATTLESCAPE) |
| 51 | { |
| 52 | setPalette("PAL_BATTLESCAPE"); |
| 53 | } |
| 54 | else |
| 55 | { |
| 56 | setPalette("PAL_GEOSCAPE", 6); |
| 57 | } |
| 58 | |
| 59 | add(_window); |
| 60 | add(_btnYes); |
| 61 | add(_btnNo); |
| 62 | add(_txtText); |
| 63 | |
| 64 | centerAllSurfaces(); |
| 65 | |
| 66 | // Set up objects |
| 67 | _window->setColor(Palette::blockOffset(15)-1); |
| 68 | _window->setBackground(_game->getResourcePack()->getSurface("BACK01.SCR")); |
| 69 | |
| 70 | _btnYes->setColor(Palette::blockOffset(15)-1); |
| 71 | _btnYes->setText(tr("STR_YES")); |
| 72 | _btnYes->onMouseClick((ActionHandler)&ConfirmLoadState::btnYesClick); |
| 73 | _btnYes->onKeyboardPress((ActionHandler)&ConfirmLoadState::btnYesClick, Options::keyOk); |
| 74 | |
| 75 | _btnNo->setColor(Palette::blockOffset(15)-1); |
| 76 | _btnNo->setText(tr("STR_NO")); |
| 77 | _btnNo->onMouseClick((ActionHandler)&ConfirmLoadState::btnNoClick); |
| 78 | _btnNo->onKeyboardPress((ActionHandler)&ConfirmLoadState::btnNoClick, Options::keyCancel); |
| 79 | |
| 80 | _txtText->setColor(Palette::blockOffset(15)-1); |
| 81 | _txtText->setAlign(ALIGN_CENTER); |
| 82 | _txtText->setBig(); |
| 83 | _txtText->setWordWrap(true); |
| 84 | _txtText->setText(tr("STR_MISSING_CONTENT_PROMPT")); |
| 85 | |
| 86 | if (_origin == OPT_BATTLESCAPE) |
| 87 | { |
| 88 | applyBattlescapeTheme(); |
| 89 | } |
| 90 | } |
| 91 | |
| 92 | /// Cleans up the confirmation state. |
| 93 | ConfirmLoadState::~ConfirmLoadState() |
nothing calls this directly
no test coverage detected