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

Method NewGameState

src/Menu/NewGameState.cpp:40–119  ·  view source on GitHub ↗

* Initializes all the elements in the Difficulty window. * @param game Pointer to the core game. */

Source from the content-addressed store, hash-verified

38 * @param game Pointer to the core game.
39 */
40NewGameState::NewGameState(Game *game) : State(game)
41{
42 // Create objects
43 _window = new Window(this, 192, 180, 64, 10, POPUP_VERTICAL);
44 _btnBeginner = new TextButton(160, 18, 80, 32);
45 _btnExperienced = new TextButton(160, 18, 80, 52);
46 _btnVeteran = new TextButton(160, 18, 80, 72);
47 _btnGenius = new TextButton(160, 18, 80, 92);
48 _btnSuperhuman = new TextButton(160, 18, 80, 112);
49 _btnIronman = new ToggleTextButton(78, 18, 80, 138);
50 _btnOk = new TextButton(78, 16, 80, 164);
51 _btnCancel = new TextButton(78, 16, 162, 164);
52 _txtTitle = new Text(192, 9, 64, 20);
53 _txtIronman = new Text(90, 24, 162, 135);
54
55 _difficulty = _btnBeginner;
56
57 // Set palette
58 setPalette("PAL_GEOSCAPE", 0);
59
60 add(_window);
61 add(_btnBeginner);
62 add(_btnExperienced);
63 add(_btnVeteran);
64 add(_btnGenius);
65 add(_btnSuperhuman);
66 add(_btnIronman);
67 add(_btnOk);
68 add(_btnCancel);
69 add(_txtTitle);
70 add(_txtIronman);
71
72 centerAllSurfaces();
73
74 // Set up objects
75 _window->setColor(Palette::blockOffset(8)+5);
76 _window->setBackground(_game->getResourcePack()->getSurface("BACK01.SCR"));
77
78 _btnBeginner->setColor(Palette::blockOffset(8)+5);
79 _btnBeginner->setText(tr("STR_1_BEGINNER"));
80 _btnBeginner->setGroup(&_difficulty);
81
82 _btnExperienced->setColor(Palette::blockOffset(8)+5);
83 _btnExperienced->setText(tr("STR_2_EXPERIENCED"));
84 _btnExperienced->setGroup(&_difficulty);
85
86 _btnVeteran->setColor(Palette::blockOffset(8)+5);
87 _btnVeteran->setText(tr("STR_3_VETERAN"));
88 _btnVeteran->setGroup(&_difficulty);
89
90 _btnGenius->setColor(Palette::blockOffset(8)+5);
91 _btnGenius->setText(tr("STR_4_GENIUS"));
92 _btnGenius->setGroup(&_difficulty);
93
94 _btnSuperhuman->setColor(Palette::blockOffset(8)+5);
95 _btnSuperhuman->setText(tr("STR_5_SUPERHUMAN"));
96 _btnSuperhuman->setGroup(&_difficulty);
97

Callers

nothing calls this directly

Calls 11

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

Tested by

no test coverage detected