MCPcopy Create free account
hub / github.com/OpenLoco/OpenLoco / drawString

Function drawString

src/OpenLoco/src/Graphics/TextRenderer.cpp:298–394  ·  view source on GitHub ↗

* 0x00451025 * * @param x @ * @param y @ * @param colour @ * @param rt @ * @param text @ */

Source from the content-addressed store, hash-verified

296 * @param text @<esi>
297 */
298 static Ui::Point drawString(TextDrawingState& drawState, DrawingContext& ctx, const RenderTarget& rt, Ui::Point origin, AdvancedColour colour, const char* str)
299 {
300 if (colour.isFE())
301 {
302 return loopNewline(drawState, ctx, &rt, origin, str);
303 }
304
305 if (colour.isFD())
306 {
307 drawState.fontFlags = TextDrawFlags::none;
308 setTextColour(drawState, 0);
309 return loopNewline(drawState, ctx, &rt, origin, str);
310 }
311
312 if (origin.x >= rt.x + rt.width)
313 {
314 return origin;
315 }
316
317 if (origin.x < rt.x - 1280)
318 {
319 return origin;
320 }
321
322 if (origin.y >= rt.y + rt.height)
323 {
324 return origin;
325 }
326
327 if (origin.y < rt.y - 90)
328 {
329 return origin;
330 }
331
332 if (colour.isFF())
333 {
334 return loopNewline(drawState, ctx, &rt, origin, str);
335 }
336
337 drawState.fontFlags = TextDrawFlags::none;
338 if (drawState.font == Font::m1)
339 {
340 drawState.font = Font::medium_bold;
341 drawState.fontFlags |= TextDrawFlags::dark;
342 }
343 else if (drawState.font == Font::m2)
344 {
345 drawState.font = Font::medium_bold;
346 drawState.fontFlags |= TextDrawFlags::dark;
347 drawState.fontFlags |= TextDrawFlags::extraDark;
348 }
349
350 drawState.textColours[PaletteIndex::transparent] = PaletteIndex::transparent;
351 drawState.textColours[PaletteIndex::textRemap0] = Colours::getShade(Colour::mutedDarkPurple, 5);
352 drawState.textColours[PaletteIndex::textRemap1] = Colours::getShade(Colour::mutedRed, 5);
353 drawState.textColours[PaletteIndex::textRemap2] = Colours::getShade(Colour::blue, 5);
354
355 if (colour.isOutline())

Callers 12

drawStringLeftWrappedFunction · 0.85
drawStringLeftFunction · 0.85
drawStringLeftClippedFunction · 0.85
drawStringRightFunction · 0.85
drawStringRightUnderlineFunction · 0.85
drawStringLeftUnderlineFunction · 0.85
drawStringCentredFunction · 0.85
drawStringCentredClippedFunction · 0.85
drawStringCentredWrappedFunction · 0.85
drawStringCentredRawFunction · 0.85
drawStringTickerFunction · 0.85
drawStringMethod · 0.85

Calls 12

loopNewlineFunction · 0.85
setTextColourFunction · 0.85
getShadeFunction · 0.85
setTextColoursFunction · 0.85
isFEMethod · 0.80
isFDMethod · 0.80
isFFMethod · 0.80
isOutlineMethod · 0.80
clearOutlineMethod · 0.80
isInsetMethod · 0.80
clearInsetMethod · 0.80
cMethod · 0.80

Tested by

no test coverage detected