summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjacksonmj <mj-pt@jacksonmj.co.uk>2012-06-14 00:04:47 (GMT)
committer jacksonmj <mj-pt@jacksonmj.co.uk>2012-06-14 00:13:17 (GMT)
commit1f05aa7f2147253cbb6113fee155bdb613f6a2e5 (patch)
tree0267c0ce0f70eecbc4c1e242b8757b932007cfd4 /src
parentbf8435bf81a5500fe053399ead3c3fb6c8575d93 (diff)
downloadpowder-1f05aa7f2147253cbb6113fee155bdb613f6a2e5.zip
powder-1f05aa7f2147253cbb6113fee155bdb613f6a2e5.tar.gz
Minor improvement to text wrapping
When text flows onto a new line, don't put the space between words at the start of the new line.
Diffstat (limited to 'src')
-rw-r--r--src/graphics.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/graphics.c b/src/graphics.c
index c82a20a..9b19872 100644
--- a/src/graphics.c
+++ b/src/graphics.c
@@ -1082,6 +1082,8 @@ int drawtextwrap(pixel *vid, int x, int y, int w, const char *s, int r, int g, i
rw = 0;
y+=FONT_H+2;
rh+=FONT_H+2;
+ if (*s==' ')
+ continue;
}
x = drawchar(vid, x, y, *(unsigned char *)s, r, g, b, a);
}
@@ -1194,6 +1196,8 @@ void textnpos(char *s, int n, int w, int *cx, int *cy)
{
x = 0;
y += FONT_H+2;
+ if (*s==' ')
+ continue;
}
n--;
}
@@ -1236,6 +1240,8 @@ int textposxy(char *s, int width, int w, int h)
if (x>=width) {
x = 0;
y += FONT_H+2;
+ if (*s==' ')
+ continue;
}
n++;
}
@@ -1274,6 +1280,8 @@ int textwrapheight(char *s, int width)
{
x = 0;
height += FONT_H+2;
+ if (*s==' ')
+ continue;
}
x += cw;
}