[Fix] Finaly think I fixed gl_printText properly!!
This commit is contained in:
parent
269de8dcfe
commit
f108df907e
@ -211,7 +211,7 @@ int gl_printText(const glFont* ft_font, const int width, const int height,
|
||||
|
||||
len = (int)strlen(txt);
|
||||
// Limit size per line.
|
||||
lastspace = 0; // Last ' ' or \n int text.
|
||||
lastspace = -1; // Last ' ' or \n int text.
|
||||
n = 0; // Current width.
|
||||
i = 0; // Current position.
|
||||
p = -1; // Where we last drew up to.
|
||||
@ -222,11 +222,12 @@ int gl_printText(const glFont* ft_font, const int width, const int height,
|
||||
|
||||
if((txt[i] == ' ') || (txt[i] == '\n') || (txt[i] == '\0')) lastspace = i;
|
||||
|
||||
if(((n > width) && ((p != lastspace) && (p != -1)))
|
||||
if(((n > width) && ((p != lastspace)))
|
||||
|| (txt[i] == '\n') || (txt[i] == '\0')) {
|
||||
|
||||
// Time to draw the line.
|
||||
m = 0;
|
||||
if(lastspace == -1) lastspace = 0;
|
||||
for(j = 0; j < (lastspace-p-1); j++) {
|
||||
m += ft_font->w[(int)txt[p+j+1]];
|
||||
if(m > width) break;
|
||||
|
Loading…
Reference in New Issue
Block a user