@@ -98,7 +98,7 @@ BattlescapeState::BattlescapeState(Game *game) : State(game), _popups(), _xBefor
9898 int screenWidth = Options::baseXResolution;
9999 int screenHeight = Options::baseYResolution;
100100 int iconsWidth = 320 ;
101- int iconsHeight = 56 ;
101+ int iconsHeight = Map:: ICON_HEIGHT ;
102102 _mouseOverIcons = false ;
103103 // Create buttonbar - this should be on the centerbottom of the screen
104104 _icons = new InteractiveSurface (iconsWidth, iconsHeight, screenWidth/2 - iconsWidth/2 , screenHeight - iconsHeight);
@@ -2044,4 +2044,53 @@ void BattlescapeState::txtTooltipOut(Action *action)
20442044 }
20452045}
20462046
2047+ /* *
2048+ * Updates the scale.
2049+ * @param dX delta of X;
2050+ * @param dY delta of Y;
2051+ */
2052+ void BattlescapeState::resize (int &dX, int &dY)
2053+ {
2054+ dX = Options::baseXResolution;
2055+ dY = Options::baseYResolution;
2056+ int divisor = 1 ;
2057+ switch (Options::battlescapeScale)
2058+ {
2059+ case SCALE_SCREEN_DIV_3 :
2060+ divisor = 3 ;
2061+ break ;
2062+ case SCALE_SCREEN_DIV_2 :
2063+ divisor = 2 ;
2064+ break ;
2065+ case SCALE_SCREEN :
2066+ break ;
2067+ default :
2068+ return ;
2069+ }
2070+
2071+ Options::baseXResolution = std::max (Screen::ORIGINAL_WIDTH , Options::displayWidth / divisor);
2072+ Options::baseYResolution = std::max (Screen::ORIGINAL_HEIGHT , Options::displayHeight / divisor);
2073+
2074+ dX = Options::baseXResolution - dX;
2075+ dY = Options::baseYResolution - dY;
2076+ _map->setWidth (Options::baseXResolution);
2077+ _map->setHeight (Options::baseYResolution);
2078+ _map->getCamera ()->resize ();
2079+ _map->getCamera ()->jumpXY (dX/2 , dY/2 );
2080+
2081+ for (std::vector<Surface*>::const_iterator i = _surfaces.begin (); i != _surfaces.end (); ++i)
2082+ {
2083+ if (*i != _map && (*i) != _btnPsi && *i != _btnLaunch && *i != _txtDebug)
2084+ {
2085+ (*i)->setX ((*i)->getX () + dX / 2 );
2086+ (*i)->setY ((*i)->getY () + dY);
2087+ }
2088+ else if (*i != _map && *i != _txtDebug)
2089+ {
2090+ (*i)->setX ((*i)->getX () + dX);
2091+ }
2092+ }
2093+
2094+ }
2095+
20472096}
0 commit comments