MCPcopy Create free account
hub / github.com/OpenXcom/OpenXcom / AlienTerrorState

Method AlienTerrorState

src/Geoscape/AlienTerrorState.cpp:45–96  ·  view source on GitHub ↗

* Initializes all the elements in the Aliens Terrorise window. * @param game Pointer to the core game. * @param terror Pointer to the respective Terror Site. * @param city Terrorized city name. * @param state Pointer to the Geoscape. */

Source from the content-addressed store, hash-verified

43 * @param state Pointer to the Geoscape.
44 */
45AlienTerrorState::AlienTerrorState(Game *game, TerrorSite *terror, const std::string &city, GeoscapeState *state) : State(game), _terror(terror), _state(state)
46{
47 _screen = false;
48
49 // Create objects
50 _window = new Window(this, 256, 200, 0, 0, POPUP_BOTH);
51 _btnIntercept = new TextButton(200, 16, 28, 130);
52 _btnCentre = new TextButton(200, 16, 28, 150);
53 _btnCancel = new TextButton(200, 16, 28, 170);
54 _txtTitle = new Text(246, 32, 5, 48);
55 _txtCity = new Text(246, 17, 5, 80);
56
57 // Set palette
58 setPalette("PAL_GEOSCAPE", 3);
59
60 add(_window);
61 add(_btnIntercept);
62 add(_btnCentre);
63 add(_btnCancel);
64 add(_txtTitle);
65 add(_txtCity);
66
67 centerAllSurfaces();
68
69 // Set up objects
70 _window->setColor(Palette::blockOffset(8)+5);
71 _window->setBackground(_game->getResourcePack()->getSurface("BACK03.SCR"));
72
73 _btnIntercept->setColor(Palette::blockOffset(8)+5);
74 _btnIntercept->setText(tr("STR_INTERCEPT"));
75 _btnIntercept->onMouseClick((ActionHandler)&AlienTerrorState::btnInterceptClick);
76
77 _btnCentre->setColor(Palette::blockOffset(8)+5);
78 _btnCentre->setText(tr("STR_CENTER_ON_SITE_TIME_5_SECONDS"));
79 _btnCentre->onMouseClick((ActionHandler)&AlienTerrorState::btnCentreClick);
80
81 _btnCancel->setColor(Palette::blockOffset(8)+5);
82 _btnCancel->setText(tr("STR_CANCEL_UC"));
83 _btnCancel->onMouseClick((ActionHandler)&AlienTerrorState::btnCancelClick);
84 _btnCancel->onKeyboardPress((ActionHandler)&AlienTerrorState::btnCancelClick, Options::keyCancel);
85
86 _txtTitle->setColor(Palette::blockOffset(8)+5);
87 _txtTitle->setBig();
88 _txtTitle->setAlign(ALIGN_CENTER);
89 _txtTitle->setWordWrap(true);
90 _txtTitle->setText(tr("STR_ALIENS_TERRORISE"));
91
92 _txtCity->setColor(Palette::blockOffset(8)+5);
93 _txtCity->setBig();
94 _txtCity->setAlign(ALIGN_CENTER);
95 _txtCity->setText(tr(city));
96}
97
98/**
99 *

Callers

nothing calls this directly

Calls 10

onMouseClickMethod · 0.80
onKeyboardPressMethod · 0.80
setColorMethod · 0.45
setBackgroundMethod · 0.45
getSurfaceMethod · 0.45
getResourcePackMethod · 0.45
setTextMethod · 0.45
setBigMethod · 0.45
setAlignMethod · 0.45
setWordWrapMethod · 0.45

Tested by

no test coverage detected