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

Function RenderHUDGetTextLineWidth

Descent3/huddisplay.cpp:830–845  ·  view source on GitHub ↗

returns scaled line width

Source from the content-addressed store, hash-verified

828
829// returns scaled line width
830int RenderHUDGetTextLineWidth(const char *string) {
831 float aspect_x;
832 int str_width_curfont = grtext_GetLineWidth(string);
833
834 if (grtext_GetFont() == HUD_FONT) {
835 aspect_x = ((float)grtext_GetLineWidthTemplate(&Hud_font_template, string)) / ((float)str_width_curfont);
836 } else {
837 aspect_x = 1.0f;
838 }
839
840 if (aspect_x == 1.0f) {
841 aspect_x = aspect_x * DEFAULT_HUD_WIDTH / Max_window_w;
842 }
843
844 return (int)((str_width_curfont * aspect_x));
845}
846
847// returns scaled text height
848int RenderHUDGetTextHeight(const char *string) {

Callers 2

RenderHUDScoreFunction · 0.85
RenderHUDMessagesFunction · 0.85

Calls 1

grtext_GetFontFunction · 0.85

Tested by

no test coverage detected