slightly improve hud text rendering wrapping

This commit is contained in:
zeromus 2011-07-18 02:31:11 +00:00
parent a1b6392832
commit 94960278e5
1 changed files with 5 additions and 2 deletions

View File

@ -419,6 +419,9 @@ void DrawTextTransWH(uint8 *dest, uint32 width, uint8 *textmsg, uint8 fgcolor, i
ch = FixJoedChar(*textmsg); ch = FixJoedChar(*textmsg);
wid = JoedCharWidth(*textmsg); wid = JoedCharWidth(*textmsg);
int newx = x+wid;
if(newx >= width) { x=beginx; y+=8; }
for(int ny=0; ny<7; ++ny) for(int ny=0; ny<7; ++ny)
{ {
uint8 d = Font6x7[ch*8 + 1+ny]; uint8 d = Font6x7[ch*8 + 1+ny];
@ -435,7 +438,7 @@ void DrawTextTransWH(uint8 *dest, uint32 width, uint8 *textmsg, uint8 fgcolor, i
} }
} }
x += wid; x += wid;
if(x >= width) { x=beginx; y+=8; }
} }
textoverflow: 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 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