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

Method PauseState

src/Menu/PauseState.cpp:43–135  ·  view source on GitHub ↗

* Initializes all the elements in the Pause window. * @param game Pointer to the core game. * @param origin Game section that originated this state. */

Source from the content-addressed store, hash-verified

41 * @param origin Game section that originated this state.
42 */
43PauseState::PauseState(Game *game, OptionsOrigin origin) : State(game), _origin(origin)
44{
45 _screen = false;
46
47 int x;
48 if (_origin == OPT_GEOSCAPE)
49 {
50 x = 20;
51 }
52 else
53 {
54 x = 52;
55 }
56
57 // Create objects
58 _window = new Window(this, 216, 160, x, 20, POPUP_BOTH);
59 _btnLoad = new TextButton(180, 18, x+18, 52);
60 _btnSave = new TextButton(180, 18, x+18, 74);
61 _btnAbandon = new TextButton(180, 18, x+18, 96);
62 _btnOptions = new TextButton(180, 18, x+18, 122);
63 _btnCancel = new TextButton(180, 18, x+18, 150);
64 _txtTitle = new Text(206, 17, x+5, 32);
65
66 // Set palette
67 if (_origin == OPT_BATTLESCAPE)
68 {
69 setPalette("PAL_BATTLESCAPE");
70 }
71 else
72 {
73 setPalette("PAL_GEOSCAPE", 0);
74 }
75
76 add(_window);
77 add(_btnLoad);
78 add(_btnSave);
79 add(_btnAbandon);
80 add(_btnOptions);
81 add(_btnCancel);
82 add(_txtTitle);
83
84 centerAllSurfaces();
85
86 // Set up objects
87 _window->setColor(Palette::blockOffset(15)-1);
88 _window->setBackground(_game->getResourcePack()->getSurface("BACK01.SCR"));
89
90 _btnLoad->setColor(Palette::blockOffset(15)-1);
91 _btnLoad->setText(tr("STR_LOAD_GAME"));
92 _btnLoad->onMouseClick((ActionHandler)&PauseState::btnLoadClick);
93
94 _btnSave->setColor(Palette::blockOffset(15)-1);
95 _btnSave->setText(tr("STR_SAVE_GAME"));
96 _btnSave->onMouseClick((ActionHandler)&PauseState::btnSaveClick);
97
98 _btnAbandon->setColor(Palette::blockOffset(15)-1);
99 _btnAbandon->setText(tr("STR_ABANDON_GAME"));
100 _btnAbandon->onMouseClick((ActionHandler)&PauseState::btnAbandonClick);

Callers

nothing calls this directly

Calls 12

onMouseClickMethod · 0.80
onKeyboardPressMethod · 0.80
isIronmanMethod · 0.80
getSavedGameMethod · 0.80
setColorMethod · 0.45
setBackgroundMethod · 0.45
getSurfaceMethod · 0.45
getResourcePackMethod · 0.45
setTextMethod · 0.45
setAlignMethod · 0.45
setBigMethod · 0.45
setVisibleMethod · 0.45

Tested by

no test coverage detected