* Initializes all the elements in the Loading screen. * @param game Pointer to the core game. */
| 54 | * @param game Pointer to the core game. |
| 55 | */ |
| 56 | StartState::StartState(Game *game) : State(game), _anim(0) |
| 57 | { |
| 58 | //updateScale() uses newDisplayWidth/Height and needs to be set ahead of time |
| 59 | Options::newDisplayWidth = Options::displayWidth; |
| 60 | Options::newDisplayHeight = Options::displayHeight; |
| 61 | |
| 62 | Options::baseXResolution = Options::displayWidth; |
| 63 | Options::baseYResolution = Options::displayHeight; |
| 64 | _game->getScreen()->resetDisplay(false); |
| 65 | |
| 66 | // Create objects |
| 67 | _thread = 0; |
| 68 | loading = LOADING_STARTED; |
| 69 | error = ""; |
| 70 | |
| 71 | _font = new Font(); |
| 72 | _font->loadTerminal(); |
| 73 | _lang = new Language(); |
| 74 | |
| 75 | _text = new Text(Options::baseXResolution, Options::baseYResolution, 0, 0); |
| 76 | _cursor = new Text(_font->getWidth(), _font->getHeight(), 0, 0); |
| 77 | _timer = new Timer(150); |
| 78 | |
| 79 | setPalette(_font->getSurface()->getPalette(), 0, 2); |
| 80 | |
| 81 | add(_text); |
| 82 | add(_cursor); |
| 83 | |
| 84 | // Set up objects |
| 85 | _text->initText(_font, _font, _lang); |
| 86 | _text->setColor(0); |
| 87 | _text->setWordWrap(true); |
| 88 | |
| 89 | _cursor->initText(_font, _font, _lang); |
| 90 | _cursor->setColor(0); |
| 91 | _cursor->setText(L"_"); |
| 92 | |
| 93 | _timer->onTimer((StateHandler)&StartState::animate); |
| 94 | _timer->start(); |
| 95 | |
| 96 | // Hide UI |
| 97 | _game->getCursor()->setVisible(false); |
| 98 | _game->getFpsCounter()->setVisible(false); |
| 99 | |
| 100 | if (Options::reload) |
| 101 | { |
| 102 | addLine(L"Restarting..."); |
| 103 | addLine(L""); |
| 104 | } |
| 105 | else |
| 106 | { |
| 107 | addLine(Language::utf8ToWstr(CrossPlatform::getDosPath()) + L">openxcom"); |
| 108 | } |
| 109 | } |
| 110 | |
| 111 | /** |
| 112 | * Kill the thread in case the game is quit early. |
nothing calls this directly
no test coverage detected