From 94960278e54d68511b5abb4cda73eb0e56d4b84e Mon Sep 17 00:00:00 2001 From: zeromus Date: Mon, 18 Jul 2011 02:31:11 +0000 Subject: [PATCH] slightly improve hud text rendering wrapping --- src/drawing.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/drawing.cpp b/src/drawing.cpp index 46ec6ba1..9c3a2bea 100644 --- a/src/drawing.cpp +++ b/src/drawing.cpp @@ -419,6 +419,9 @@ void DrawTextTransWH(uint8 *dest, uint32 width, uint8 *textmsg, uint8 fgcolor, i ch = FixJoedChar(*textmsg); wid = JoedCharWidth(*textmsg); + int newx = x+wid; + if(newx >= width) { x=beginx; y+=8; } + for(int ny=0; ny<7; ++ny) { uint8 d = Font6x7[ch*8 + 1+ny]; @@ -434,8 +437,8 @@ void DrawTextTransWH(uint8 *dest, uint32 width, uint8 *textmsg, uint8 fgcolor, i target[y+ny][x+nx] = 1; } } - x += wid; - if(x >= width) { x=beginx; y+=8; } + x += wid; + } textoverflow: for(y=0; y<62; ++y) //Max border is 2, so the max safe y is 62 (since 64 is the max for the target array