* Initializes all the elements in the Psi Training screen. * @param game Pointer to the core game. */
| 41 | * @param game Pointer to the core game. |
| 42 | */ |
| 43 | PsiTrainingState::PsiTrainingState(Game *game) : State(game) |
| 44 | { |
| 45 | // Create objects |
| 46 | _window = new Window(this, 320, 200, 0, 0); |
| 47 | _txtTitle = new Text(300, 17, 10, 16); |
| 48 | _btnOk = new TextButton(160, 14, 80, 174); |
| 49 | |
| 50 | // Set palette |
| 51 | setPalette("PAL_BASESCAPE", 7); |
| 52 | |
| 53 | add(_window); |
| 54 | add(_btnOk); |
| 55 | add(_txtTitle); |
| 56 | |
| 57 | // Set up objects |
| 58 | _window->setColor(Palette::blockOffset(15)+6); |
| 59 | _window->setBackground(_game->getResourcePack()->getSurface("BACK01.SCR")); |
| 60 | |
| 61 | _btnOk->setColor(Palette::blockOffset(13)+10); |
| 62 | _btnOk->setText(tr("STR_OK")); |
| 63 | _btnOk->onMouseClick((ActionHandler)&PsiTrainingState::btnOkClick); |
| 64 | _btnOk->onKeyboardPress((ActionHandler)&PsiTrainingState::btnOkClick, Options::keyCancel); |
| 65 | |
| 66 | _txtTitle->setColor(Palette::blockOffset(13)+10); |
| 67 | _txtTitle->setBig(); |
| 68 | _txtTitle->setAlign(ALIGN_CENTER); |
| 69 | _txtTitle->setText(tr("STR_PSIONIC_TRAINING")); |
| 70 | |
| 71 | int buttons = 0; |
| 72 | for(std::vector<Base*>::const_iterator b = _game->getSavedGame()->getBases()->begin(); b != _game->getSavedGame()->getBases()->end(); ++b) |
| 73 | { |
| 74 | if((*b)->getAvailablePsiLabs()) |
| 75 | { |
| 76 | TextButton *btnBase = new TextButton(160, 14, 80, 40 + 16 * buttons); |
| 77 | btnBase->setColor(Palette::blockOffset(15) + 6); |
| 78 | btnBase->onMouseClick((ActionHandler)&PsiTrainingState::btnBaseXClick); |
| 79 | btnBase->setText((*b)->getName()); |
| 80 | add(btnBase); |
| 81 | _bases.push_back(*b); |
| 82 | _btnBases.push_back(btnBase); |
| 83 | ++buttons; |
| 84 | if (buttons >= 8) |
| 85 | { |
| 86 | break; |
| 87 | } |
| 88 | } |
| 89 | } |
| 90 | |
| 91 | centerAllSurfaces(); |
| 92 | } |
| 93 | /** |
| 94 | * |
| 95 | */ |
nothing calls this directly
no test coverage detected