MCPcopy Create free account
hub / github.com/ClassiCube/ClassiCube / InputWidget_CalculateLineSizes

Function InputWidget_CalculateLineSizes

src/Widgets.c:1124–1143  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1122}
1123
1124static void InputWidget_CalculateLineSizes(struct InputWidget* w) {
1125 cc_string line; char lineBuffer[STRING_SIZE];
1126 struct DrawTextArgs args;
1127 int y;
1128
1129 for (y = 0; y < INPUTWIDGET_MAX_LINES; y++) {
1130 w->lineWidths[y] = 0;
1131 }
1132 w->lineWidths[0] = w->prefixWidth;
1133 DrawTextArgs_MakeEmpty(&args, w->font, true);
1134
1135 String_InitArray(line, lineBuffer);
1136 for (y = 0; y < w->GetMaxLines(); y++) {
1137 line.length = 0;
1138 InputWidget_FormatLine(w, y, &line);
1139
1140 args.text = line;
1141 w->lineWidths[y] += Drawer2D_TextWidth(&args);
1142 }
1143}
1144
1145static char InputWidget_GetLastCol(struct InputWidget* w, int x, int y) {
1146 cc_string line; char lineBuffer[STRING_SIZE];

Callers 1

InputWidget_UpdateTextFunction · 0.85

Calls 3

DrawTextArgs_MakeEmptyFunction · 0.85
InputWidget_FormatLineFunction · 0.85
Drawer2D_TextWidthFunction · 0.85

Tested by

no test coverage detected