MCPcopy Create free account
hub / github.com/EasyRPG/Player / TextDraw

Method TextDraw

src/bitmap.cpp:341–364  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

339}
340
341Point Bitmap::TextDraw(Rect const& rect, int color, std::string_view text, Text::Alignment align) {
342 switch (align) {
343 case Text::AlignLeft:
344 return TextDraw(rect.x, rect.y, color, text);
345 break;
346 case Text::AlignCenter: {
347 auto f = font ? font : Font::Default();
348 Rect text_rect = Text::GetSize(*f, text);
349 int dx = rect.x + (rect.width - text_rect.width) / 2;
350 return TextDraw(dx, rect.y, color, text);
351 break;
352 }
353 case Text::AlignRight: {
354 auto f = font ? font : Font::Default();
355 Rect text_rect = Text::GetSize(*f, text);
356 int dx = rect.x + rect.width - text_rect.width;
357 return TextDraw(dx, rect.y, color, text);
358 break;
359 }
360 default: assert(false);
361 }
362
363 return {};
364}
365
366Point Bitmap::TextDraw(int x, int y, int color, std::string_view text, Text::Alignment align) {
367 auto f = font ? font : Font::Default();

Callers 15

DrawCmdLinesMethod · 0.80
DrawLineMethod · 0.80
RefreshMethod · 0.80
RefreshMethod · 0.80
RefreshMethod · 0.80
DrawOptionMethod · 0.80
DrawActorNameMethod · 0.80
DrawActorTitleMethod · 0.80
DrawActorClassMethod · 0.80
DrawActorLevelMethod · 0.80
DrawActorStateMethod · 0.80
DrawActorExpMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected