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

Function DrawText

src/widget.cpp:427–434  ·  view source on GitHub ↗

* Draw text. * @param r Rectangle of the background. * @param colour Colour of the text. * @param str Text to draw. * @param align Alignment of the text. * @param fs Font size of the text. */

Source from the content-addressed store, hash-verified

425 * @param fs Font size of the text.
426 */
427static inline void DrawText(const Rect &r, TextColour colour, std::string_view str, StringAlignment align, FontSize fs)
428{
429 if (str.empty()) return;
430
431 Dimension d = GetStringBoundingBox(str, fs);
432 Point p = GetAlignedPosition(r, d, align);
433 DrawString(r.left, r.right, p.y, str, colour, align, false, fs);
434}
435
436/**
437 * Draw an inset widget.

Callers 1

DrawMethod · 0.85

Calls 4

GetStringBoundingBoxFunction · 0.85
GetAlignedPositionFunction · 0.85
DrawStringFunction · 0.70
emptyMethod · 0.45

Tested by

no test coverage detected