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

Method resize

src/Geoscape/GeoscapeState.cpp:2242–2294  ·  view source on GitHub ↗

* Updates the scale. * @param dX delta of X; * @param dY delta of Y; */

Source from the content-addressed store, hash-verified

2240 * @param dY delta of Y;
2241 */
2242void GeoscapeState::resize(int &dX, int &dY)
2243{
2244 if (_game->getSavedGame()->getSavedBattle())
2245 return;
2246 dX = Options::baseXResolution;
2247 dY = Options::baseYResolution;
2248 int divisor = 1;
2249 switch (Options::geoscapeScale)
2250 {
2251 case SCALE_SCREEN_DIV_3:
2252 divisor = 3;
2253 break;
2254 case SCALE_SCREEN_DIV_2:
2255 divisor = 2;
2256 break;
2257 case SCALE_SCREEN:
2258 break;
2259 default:
2260 dX = 0;
2261 dY = 0;
2262 return;
2263 }
2264
2265 Options::baseXResolution = std::max(Screen::ORIGINAL_WIDTH, Options::displayWidth / divisor);
2266 Options::baseYResolution = std::max(Screen::ORIGINAL_HEIGHT, Options::displayHeight / divisor);
2267
2268 dX = Options::baseXResolution - dX;
2269 dY = Options::baseYResolution - dY;
2270
2271 _globe->resize();
2272
2273 for (std::vector<Surface*>::const_iterator i = _surfaces.begin(); i != _surfaces.end(); ++i)
2274 {
2275 if (*i != _globe)
2276 {
2277 (*i)->setX((*i)->getX() + dX);
2278 (*i)->setY((*i)->getY() + dY/2);
2279 }
2280 }
2281
2282 _bg->setX((_globe->getWidth() - _bg->getWidth()) / 2);
2283 _bg->setY((_globe->getHeight() - _bg->getHeight()) / 2);
2284
2285 int height = (Options::baseYResolution - Screen::ORIGINAL_HEIGHT) / 2 + 10;
2286 _sideTop->setHeight(height);
2287 _sideTop->setY(_sidebar->getY() - height - 1);
2288 _sideBottom->setHeight(height);
2289 _sideBottom->setY(_sidebar->getY() + _sidebar->getHeight() + 1);
2290
2291 _sideLine->setHeight(Options::baseYResolution);
2292 _sideLine->setY(0);
2293 _sideLine->drawRect(0, 0, _sideLine->getWidth(), _sideLine->getHeight(), 15);
2294}
2295
2296}

Callers

nothing calls this directly

Calls 10

getSavedBattleMethod · 0.80
getSavedGameMethod · 0.80
drawRectMethod · 0.80
setXMethod · 0.45
getXMethod · 0.45
setYMethod · 0.45
getYMethod · 0.45
getWidthMethod · 0.45
getHeightMethod · 0.45
setHeightMethod · 0.45

Tested by

no test coverage detected