MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / GetShipSpriteSize

Function GetShipSpriteSize

src/ship_cmd.cpp:119–131  ·  view source on GitHub ↗

* Get the size of the sprite of a ship sprite heading west (used for lists). * @param engine The engine to get the sprite from. * @param[out] width The width of the sprite. * @param[out] height The height of the sprite. * @param[out] xoffs Number of pixels to shift the sprite to the right. * @param[out] yoffs Number of pixels to shift the sprite downwards. * @param image_type Context the spr

Source from the content-addressed store, hash-verified

117 * @param image_type Context the sprite is used in.
118 */
119void GetShipSpriteSize(EngineID engine, uint &width, uint &height, int &xoffs, int &yoffs, EngineImageType image_type)
120{
121 VehicleSpriteSeq seq;
122 GetShipIcon(engine, image_type, &seq);
123
124 Rect rect;
125 seq.GetBounds(&rect);
126
127 width = UnScaleGUI(rect.Width());
128 height = UnScaleGUI(rect.Height());
129 xoffs = UnScaleGUI(rect.left);
130 yoffs = UnScaleGUI(rect.top);
131}
132
133void Ship::GetImage(Direction direction, EngineImageType image_type, VehicleSpriteSeq *result) const
134{

Callers 2

UpdateWidgetSizeMethod · 0.85
InitBlocksizeForVehiclesFunction · 0.85

Calls 5

GetShipIconFunction · 0.85
UnScaleGUIFunction · 0.85
GetBoundsMethod · 0.45
WidthMethod · 0.45
HeightMethod · 0.45

Tested by

no test coverage detected