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

Function GetAircraftSpriteSize

src/aircraft_cmd.cpp:247–259  ·  view source on GitHub ↗

* Get the size of the sprite of an aircraft 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 th

Source from the content-addressed store, hash-verified

245 * @param image_type Context the sprite is used in.
246 */
247void GetAircraftSpriteSize(EngineID engine, uint &width, uint &height, int &xoffs, int &yoffs, EngineImageType image_type)
248{
249 VehicleSpriteSeq seq;
250 GetAircraftIcon(engine, image_type, &seq);
251
252 Rect rect;
253 seq.GetBounds(&rect);
254
255 width = UnScaleGUI(rect.Width());
256 height = UnScaleGUI(rect.Height());
257 xoffs = UnScaleGUI(rect.left);
258 yoffs = UnScaleGUI(rect.top);
259}
260
261/**
262 * Build an aircraft.

Callers 2

UpdateWidgetSizeMethod · 0.85
InitBlocksizeForVehiclesFunction · 0.85

Calls 5

GetAircraftIconFunction · 0.85
UnScaleGUIFunction · 0.85
GetBoundsMethod · 0.45
WidthMethod · 0.45
HeightMethod · 0.45

Tested by

no test coverage detected