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

Method BuildNewBaseState

src/Geoscape/BuildNewBaseState.cpp:50–145  ·  view source on GitHub ↗

* Initializes all the elements in the Build New Base window. * @param game Pointer to the core game. * @param base Pointer to the base to place. * @param globe Pointer to the Geoscape globe. * @param first Is this the first base in the game? */

Source from the content-addressed store, hash-verified

48 * @param first Is this the first base in the game?
49 */
50BuildNewBaseState::BuildNewBaseState(Game *game, Base *base, Globe *globe, bool first) : State(game), _base(base), _globe(globe), _first(first), _oldlat(0), _oldlon(0), _mousex(0), _mousey(0)
51{
52 int dx = _game->getScreen()->getDX();
53 int dy = _game->getScreen()->getDY();
54 _screen = false;
55
56 _oldshowradar = Options::globeRadarLines;
57 if (!_oldshowradar)
58 Options::globeRadarLines = true;
59 // Create objects
60 _btnRotateLeft = new InteractiveSurface(12, 10, 259 + dx * 2, 176 + dy);
61 _btnRotateRight = new InteractiveSurface(12, 10, 283 + dx * 2, 176 + dy);
62 _btnRotateUp = new InteractiveSurface(13, 12, 271 + dx * 2, 162 + dy);
63 _btnRotateDown = new InteractiveSurface(13, 12, 271 + dx * 2, 187 + dy);
64 _btnZoomIn = new InteractiveSurface(23, 23, 295 + dx * 2, 156 + dy);
65 _btnZoomOut = new InteractiveSurface(13, 17, 300 + dx * 2, 182 + dy);
66
67 _window = new Window(this, 256, 28, 0, 0);
68 _window->setX(dx);
69 _window->setDY(0);
70 _btnCancel = new TextButton(54, 12, 186 + dx, 8);
71 _txtTitle = new Text(180, 16, 8 + dx, 6);
72
73 _hoverTimer = new Timer(50);
74 _hoverTimer->onTimer((StateHandler)&BuildNewBaseState::hoverRedraw);
75 _hoverTimer->start();
76
77 // Set palette
78 setPalette("PAL_GEOSCAPE");
79
80 add(_btnRotateLeft);
81 add(_btnRotateRight);
82 add(_btnRotateUp);
83 add(_btnRotateDown);
84 add(_btnZoomIn);
85 add(_btnZoomOut);
86
87 add(_window);
88 add(_btnCancel);
89 add(_txtTitle);
90
91 // Set up objects
92 _globe->onMouseClick((ActionHandler)&BuildNewBaseState::globeClick);
93
94 _btnRotateLeft->onMousePress((ActionHandler)&BuildNewBaseState::btnRotateLeftPress);
95 _btnRotateLeft->onMouseRelease((ActionHandler)&BuildNewBaseState::btnRotateLeftRelease);
96 _btnRotateLeft->onKeyboardPress((ActionHandler)&BuildNewBaseState::btnRotateLeftPress, Options::keyGeoLeft);
97 _btnRotateLeft->onKeyboardRelease((ActionHandler)&BuildNewBaseState::btnRotateLeftRelease, Options::keyGeoLeft);
98
99 _btnRotateRight->onMousePress((ActionHandler)&BuildNewBaseState::btnRotateRightPress);
100 _btnRotateRight->onMouseRelease((ActionHandler)&BuildNewBaseState::btnRotateRightRelease);
101 _btnRotateRight->onKeyboardPress((ActionHandler)&BuildNewBaseState::btnRotateRightPress, Options::keyGeoRight);
102 _btnRotateRight->onKeyboardRelease((ActionHandler)&BuildNewBaseState::btnRotateRightRelease, Options::keyGeoRight);
103
104 _btnRotateUp->onMousePress((ActionHandler)&BuildNewBaseState::btnRotateUpPress);
105 _btnRotateUp->onMouseRelease((ActionHandler)&BuildNewBaseState::btnRotateUpRelease);
106 _btnRotateUp->onKeyboardPress((ActionHandler)&BuildNewBaseState::btnRotateUpPress, Options::keyGeoUp);
107 _btnRotateUp->onKeyboardRelease((ActionHandler)&BuildNewBaseState::btnRotateUpRelease, Options::keyGeoUp);

Callers

nothing calls this directly

Calls 15

getDXMethod · 0.80
getScreenMethod · 0.80
getDYMethod · 0.80
setDYMethod · 0.80
onTimerMethod · 0.80
onMouseClickMethod · 0.80
onMousePressMethod · 0.80
onMouseReleaseMethod · 0.80
onKeyboardPressMethod · 0.80
onKeyboardReleaseMethod · 0.80
setListButtonMethod · 0.80
setXMethod · 0.45

Tested by

no test coverage detected