Added missing line break for DrawTextBoxed.

This commit is contained in:
jussi
2024-06-17 12:37:38 +03:00
parent d3e1842203
commit 43a8cc20b5
2 changed files with 6 additions and 2 deletions

View File

@@ -55,7 +55,7 @@ DETAILED CHANGES:
- ADDED: Unload functions clear object to 0 so they would not be ready in Is*Ready. - ADDED: Unload functions clear object to 0 so they would not be ready in Is*Ready.
- CHANGE: DrawTextBoxed uses lineSpacing. - CHANGE: DrawTextBoxed uses lineSpacing.
- ADDED: GetTextLineSpacing. - ADDED: GetTextLineSpacing.
- REMOVED: DrawTextBoxedTinted. DrawTextBoxedEx can do same with much more efficiently. - REMOVED: DrawTextBoxedTinted. DrawTextBoxedEx can do same much more efficiently.
- ADDED: DrawTextBoxedEx. - ADDED: DrawTextBoxedEx.
------------------------------------------------------------------------ ------------------------------------------------------------------------

View File

@@ -48,7 +48,11 @@ float spacing, bool wordWrap, Color tint, Vector2* textOffset, bool getMouseChar
? (float)font.recs[ index ].width * scaleFactor + spacing ? (float)font.recs[ index ].width * scaleFactor + spacing
: (float)font.glyphs[ index ].advanceX * scaleFactor + spacing; : (float)font.glyphs[ index ].advanceX * scaleFactor + spacing;
if ( wordWrap && ( wordWidth < rec.width ) ) { if ( codepoint == '\n' ) {
textOffset->x = 0;
textOffset->y += lineSpacing;
}
else if ( wordWrap && ( wordWidth < rec.width ) ) {
if ( measure && codepoint != ' ' ) { if ( measure && codepoint != ' ' ) {
wordWidth = measureWord( font, &text[i], fontSize, spacing ); wordWidth = measureWord( font, &text[i], fontSize, spacing );
measure = false; measure = false;