You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
GetTextWidth only calculates the length of the first line instead of all lines. This also affects GuiMessageBox (and possibly other GUI functions that I haven't gotten around to testing).
Example 1 with GetTextWidth
intmain(void)
{
SetConfigFlags(FLAG_VSYNC_HINT);
InitWindow(800, 450, "Minimal Reproducible Example -- GetTextWidth");
charexampleText[] ="Line 1\nL i n e 2";
while (!WindowShouldClose())
{
// ===== DRAW ====BeginDrawing();
ClearBackground(WHITE);
// ===== GUI =====intwidth=GetTextWidth(exampleText);
// This would ideally draw a box around the example text, but instead the text gets cut offGuiDrawRectangle((Rectangle) {20, 20, width+6, 30}, 2, BLACK, WHITE);
GuiLabel((Rectangle) {22, 20, width, 30}, exampleText);
// ===== END GUI ====EndDrawing();
// ===== END DRAW ====
}
CloseWindow();
}
Example 2 with GuiMessageBox
intmain(void)
{
SetConfigFlags(FLAG_VSYNC_HINT);
InitWindow(800, 450, "Minimal Reproducible Example -- GuiMessageBox");
charexampleText[] ="Line 1\nL i n e 2";
while (!WindowShouldClose())
{
// ===== DRAW ====BeginDrawing();
ClearBackground(WHITE);
// ===== GUI =====// This would ideally draw the example text in the message box, but it instead gets// cut off even though there is plenty of spaceGuiMessageBox((Rectangle) {20, 20, 250, 100}, "#191# Error!", exampleText, "OK");
// ===== END GUI =====EndDrawing();
// ===== END DRAW =====
}
CloseWindow();
}
The text was updated successfully, but these errors were encountered:
raysan5
changed the title
GetTextWidth returns incorrect value for multi-line stringsGetTextWidth() returns incorrect value for multi-line strings
Aug 21, 2024
GetTextWidth
only calculates the length of the first line instead of all lines. This also affectsGuiMessageBox
(and possibly other GUI functions that I haven't gotten around to testing).Example 1 with
GetTextWidth
Example 2 with
GuiMessageBox
The text was updated successfully, but these errors were encountered: