diff options
author | frosch <frosch@openttd.org> | 2015-02-01 20:54:24 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2015-02-01 20:54:24 +0000 |
commit | a8080b62563dcb9f3e3bf5180ebf2de6cf6b68ae (patch) | |
tree | 3ac628ab264823257073f281ce7e692f07e5c651 /src/ship_cmd.cpp | |
parent | 3bc7ee3ab731c7a855f811b36356ed907b42989a (diff) | |
download | openttd-a8080b62563dcb9f3e3bf5180ebf2de6cf6b68ae.tar.xz |
(svn r27134) -Codechange: Simplify GUI scaling by adding UnScaleGUI() and ScaleGUITrad().
Diffstat (limited to 'src/ship_cmd.cpp')
-rw-r--r-- | src/ship_cmd.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/ship_cmd.cpp b/src/ship_cmd.cpp index fddff0b4f..a24fb3510 100644 --- a/src/ship_cmd.cpp +++ b/src/ship_cmd.cpp @@ -90,7 +90,9 @@ void DrawShipEngine(int left, int right, int preferred_x, int y, EngineID engine { SpriteID sprite = GetShipIcon(engine, image_type); const Sprite *real_sprite = GetSprite(sprite, ST_NORMAL); - preferred_x = Clamp(preferred_x, left - UnScaleByZoom(real_sprite->x_offs, ZOOM_LVL_GUI), right - UnScaleByZoom(real_sprite->width, ZOOM_LVL_GUI) - UnScaleByZoom(real_sprite->x_offs, ZOOM_LVL_GUI)); + preferred_x = Clamp(preferred_x, + left - UnScaleGUI(real_sprite->x_offs), + right - UnScaleGUI(real_sprite->width) - UnScaleGUI(real_sprite->x_offs)); DrawSprite(sprite, pal, preferred_x, y); } @@ -107,10 +109,10 @@ void GetShipSpriteSize(EngineID engine, uint &width, uint &height, int &xoffs, i { const Sprite *spr = GetSprite(GetShipIcon(engine, image_type), ST_NORMAL); - width = UnScaleByZoom(spr->width, ZOOM_LVL_GUI); - height = UnScaleByZoom(spr->height, ZOOM_LVL_GUI); - xoffs = UnScaleByZoom(spr->x_offs, ZOOM_LVL_GUI); - yoffs = UnScaleByZoom(spr->y_offs, ZOOM_LVL_GUI); + width = UnScaleGUI(spr->width); + height = UnScaleGUI(spr->height); + xoffs = UnScaleGUI(spr->x_offs); + yoffs = UnScaleGUI(spr->y_offs); } SpriteID Ship::GetImage(Direction direction, EngineImageType image_type) const |