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

Method SelectDestinationState

src/Geoscape/SelectDestinationState.cpp:49–145  ·  view source on GitHub ↗

* Initializes all the elements in the Select Destination window. * @param game Pointer to the core game. * @param craft Pointer to the craft to target. * @param globe Pointer to the Geoscape globe. */

Source from the content-addressed store, hash-verified

47 * @param globe Pointer to the Geoscape globe.
48 */
49SelectDestinationState::SelectDestinationState(Game *game, Craft *craft, Globe *globe) : State(game), _craft(craft), _globe(globe)
50{
51 int dx = _game->getScreen()->getDX();
52 int dy = _game->getScreen()->getDY();
53 _screen = false;
54
55 // Create objects
56 _btnRotateLeft = new InteractiveSurface(12, 10, 259 + dx * 2, 176 + dy);
57 _btnRotateRight = new InteractiveSurface(12, 10, 283 + dx * 2, 176 + dy);
58 _btnRotateUp = new InteractiveSurface(13, 12, 271 + dx * 2, 162 + dy);
59 _btnRotateDown = new InteractiveSurface(13, 12, 271 + dx * 2, 187 + dy);
60 _btnZoomIn = new InteractiveSurface(23, 23, 295 + dx * 2, 156 + dy);
61 _btnZoomOut = new InteractiveSurface(13, 17, 300 + dx * 2, 182 + dy);
62
63 _window = new Window(this, 256, 28, 0, 0);
64 _window->setX(dx);
65 _window->setDY(0);
66 _btnCancel = new TextButton(60, 12, 110 + dx, 8);
67 _btnCydonia = new TextButton(60, 12, 180 + dx, 8);
68 _txtTitle = new Text(100, 16, 10 + dx, 6);
69
70 // Set palette
71 setPalette("PAL_GEOSCAPE", 0);
72
73 add(_btnRotateLeft);
74 add(_btnRotateRight);
75 add(_btnRotateUp);
76 add(_btnRotateDown);
77 add(_btnZoomIn);
78 add(_btnZoomOut);
79
80 add(_window);
81 add(_btnCancel);
82 add(_btnCydonia);
83 add(_txtTitle);
84
85 // Set up objects
86 _globe->onMouseClick((ActionHandler)&SelectDestinationState::globeClick);
87
88 _btnRotateLeft->onMousePress((ActionHandler)&SelectDestinationState::btnRotateLeftPress);
89 _btnRotateLeft->onMouseRelease((ActionHandler)&SelectDestinationState::btnRotateLeftRelease);
90 _btnRotateLeft->onKeyboardPress((ActionHandler)&SelectDestinationState::btnRotateLeftPress, Options::keyGeoLeft);
91 _btnRotateLeft->onKeyboardRelease((ActionHandler)&SelectDestinationState::btnRotateLeftRelease, Options::keyGeoLeft);
92
93 _btnRotateRight->onMousePress((ActionHandler)&SelectDestinationState::btnRotateRightPress);
94 _btnRotateRight->onMouseRelease((ActionHandler)&SelectDestinationState::btnRotateRightRelease);
95 _btnRotateRight->onKeyboardPress((ActionHandler)&SelectDestinationState::btnRotateRightPress, Options::keyGeoRight);
96 _btnRotateRight->onKeyboardRelease((ActionHandler)&SelectDestinationState::btnRotateRightRelease, Options::keyGeoRight);
97
98 _btnRotateUp->onMousePress((ActionHandler)&SelectDestinationState::btnRotateUpPress);
99 _btnRotateUp->onMouseRelease((ActionHandler)&SelectDestinationState::btnRotateUpRelease);
100 _btnRotateUp->onKeyboardPress((ActionHandler)&SelectDestinationState::btnRotateUpPress, Options::keyGeoUp);
101 _btnRotateUp->onKeyboardRelease((ActionHandler)&SelectDestinationState::btnRotateUpRelease, Options::keyGeoUp);
102
103 _btnRotateDown->onMousePress((ActionHandler)&SelectDestinationState::btnRotateDownPress);
104 _btnRotateDown->onMouseRelease((ActionHandler)&SelectDestinationState::btnRotateDownRelease);
105 _btnRotateDown->onKeyboardPress((ActionHandler)&SelectDestinationState::btnRotateDownPress, Options::keyGeoDown);
106 _btnRotateDown->onKeyboardRelease((ActionHandler)&SelectDestinationState::btnRotateDownRelease, Options::keyGeoDown);

Callers

nothing calls this directly

Calls 15

getDXMethod · 0.80
getScreenMethod · 0.80
getDYMethod · 0.80
setDYMethod · 0.80
onMouseClickMethod · 0.80
onMousePressMethod · 0.80
onMouseReleaseMethod · 0.80
onKeyboardPressMethod · 0.80
onKeyboardReleaseMethod · 0.80
setListButtonMethod · 0.80
getSpacecraftMethod · 0.80
isResearchedMethod · 0.80

Tested by

no test coverage detected