diff options
| author | Jakob Fries <jakob.fries@gmail.com> | 2007-08-10 11:03:16 +0000 |
|---|---|---|
| committer | Jakob Fries <jakob.fries@gmail.com> | 2007-08-10 11:03:16 +0000 |
| commit | 3d0c6b7f980566373448dcbc247245fedabf6392 (patch) | |
| tree | 35e3b21c3ac349b19440ae9edb45d22c9de339a5 /src/engine/client/gfx.cpp | |
| parent | 8bda737f24b293e7c08ee1014f7690e3154928f9 (diff) | |
| download | zcatch-3d0c6b7f980566373448dcbc247245fedabf6392.tar.gz zcatch-3d0c6b7f980566373448dcbc247245fedabf6392.zip | |
generic line wrapping
Diffstat (limited to 'src/engine/client/gfx.cpp')
| -rw-r--r-- | src/engine/client/gfx.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/engine/client/gfx.cpp b/src/engine/client/gfx.cpp index 1c871e28..dafdfa06 100644 --- a/src/engine/client/gfx.cpp +++ b/src/engine/client/gfx.cpp @@ -790,7 +790,7 @@ double extra_kerning[256*256] = {0}; pretty_font *current_font = &default_font; -void gfx_pretty_text(float x, float y, float size, const char *text) +void gfx_pretty_text(float x, float y, float size, const char *text, int max_width) { const float spacing = 0.05f; gfx_texture_set(current_font->font_texture); @@ -826,6 +826,12 @@ void gfx_pretty_text(float x, float y, float size, const char *text) x_nudge = extra_kerning[text[0] + text[1] * 256]; x += (width + current_font->m_CharStartTable[c] + spacing + x_nudge) * size; + + if (max_width != -1 && x - startx > max_width) + { + x = startx; + y += size - 2; + } } text++; |