MCPcopy Create free account
hub / github.com/OpenRCT2/OpenRCT2 / drawStringCentredRaw

Function drawStringCentredRaw

src/openrct2/drawing/Drawing.String.cpp:294–317  ·  view source on GitHub ↗

* * rct2: 0x006C1DB7 * * left : cx * top : dx * numLines : bp * text : esi * rt : edi */

Source from the content-addressed store, hash-verified

292 * rt : edi
293 */
294 void drawStringCentredRaw(
295 RenderTarget& rt, const ScreenCoordsXY& coords, int32_t numLines, const utf8* text, FontStyle fontStyle)
296 {
297 ScreenCoordsXY screenCoords(rt.x, rt.y);
298 drawText(rt, screenCoords, "", { Colour::black, fontStyle });
299 screenCoords = coords;
300
301 for (int32_t i = 0; i <= numLines; i++)
302 {
303 int32_t width = getStringWidth(text, fontStyle);
304 drawText(rt, screenCoords - ScreenCoordsXY{ width / 2, 0 }, text, { kColourNull, fontStyle });
305
306 const utf8* ch = text;
307 const utf8* nextCh = nullptr;
308
309 while ((UTF8GetNext(ch, &nextCh)) != 0)
310 {
311 ch = nextCh;
312 }
313 text = const_cast<char*>(ch + 1);
314
315 screenCoords.y += FontGetLineHeight(fontStyle);
316 }
317 }
318
319 int32_t getStringHeightRaw(std::string_view text, FontStyle fontStyle)
320 {

Callers 2

onDrawMethod · 0.85
onDrawMethod · 0.85

Calls 4

drawTextFunction · 0.85
getStringWidthFunction · 0.85
UTF8GetNextFunction · 0.85
FontGetLineHeightFunction · 0.85

Tested by

no test coverage detected