Added framed text menu.

This commit is contained in:
2021-09-10 10:13:39 -07:00
parent 7a121d4f3b
commit f3ecafb4a9
11 changed files with 182 additions and 28 deletions

View File

@ -82,7 +82,7 @@ void fontTextClamp(font_t *font, fonttextinfo_t *info, char *text,
scale = fontGetScale(fontSize);
// Adjust the max width to match the scale, and allow "no max width".
maxWidth = maxWidth == -1 ? 999999 : maxWidth * (1 / scale);
maxWidth = maxWidth == -1 ? 9999999 : maxWidth * (1 / scale);
/** Which index in the original text var is the current word from */
int32_t wordStart = 0;
@ -145,7 +145,8 @@ void fontTextClamp(font_t *font, fonttextinfo_t *info, char *text,
);
// Now measure the width of the line (take the right side of that quad)
if(x > maxWidth) {
// if(x > maxWidth) {
if(quad->x1 > maxWidth) {
// We've exceeded the edge, go back to the start of the word and newline.
x = quad->x1 - wordX;
for(j = wordStart; j <= info->realLength; j++) {
@ -189,6 +190,8 @@ void fontTextClamp(font_t *font, fonttextinfo_t *info, char *text,
info->width = mathMax(info->width, quad->x1);
info->height = mathMax(info->height, quad->y1);
}
printf("Break");
}
int32_t fontGetLineCharCount(fonttextinfo_t *info,int32_t start,int32_t count) {