MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / grtext_CenteredPrintf

Function grtext_CenteredPrintf

grtext/grtext.cpp:422–437  ·  view source on GitHub ↗

puts a centered string in the text buffer.

Source from the content-addressed store, hash-verified

420
421// puts a centered string in the text buffer.
422void grtext_CenteredPrintf(int xoff, int y, const char *fmt, ...) {
423 int new_x;
424 std::va_list arglist;
425 int len;
426 char buf[512];
427
428 va_start(arglist, fmt);
429 len = std::vsnprintf(buf, 512, fmt, arglist);
430 va_end(arglist);
431 if (len < 0)
432 return;
433
434 new_x = Grtext_left + (Grtext_right - Grtext_left) / 2 - grtext_GetTextLineWidth(buf) / 2;
435
436 grtext_Puts(new_x + xoff, y, buf);
437}
438
439#define GR_STR_LEN 128
440// draws a string

Callers 14

FontKernFunction · 0.85
message_boxFunction · 0.85
ui_DrawCenteredStringFunction · 0.85
DrawPlayerNameOnHudFunction · 0.85
RenderHUDItemsFunction · 0.85
RenderHUDTextFlagsFunction · 0.85
mve_PutsFunction · 0.85
TCGoalsRenderCallbackFunction · 0.85
Credits_RenderFunction · 0.85
TCAMDrawMenuFunction · 0.85
LoadLevelProgressFunction · 0.85

Calls 2

grtext_GetTextLineWidthFunction · 0.85
grtext_PutsFunction · 0.85

Tested by

no test coverage detected