From e6d5379a7240909dda863260bfef59503c9835a8 Mon Sep 17 00:00:00 2001 From: Jakob Fries Date: Sat, 28 Jul 2007 17:44:12 +0000 Subject: editbox is now easier to edit --- src/engine/client/gfx.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/engine/client/gfx.cpp') diff --git a/src/engine/client/gfx.cpp b/src/engine/client/gfx.cpp index f6295620..7b0b421e 100644 --- a/src/engine/client/gfx.cpp +++ b/src/engine/client/gfx.cpp @@ -731,12 +731,18 @@ void gfx_pretty_text(float x, float y, float size, const char *text) gfx_quads_end(); } -float gfx_pretty_text_width(float size, const char *text) +float gfx_pretty_text_width(float size, const char *text, int length) { const float spacing = 0.05f; float w = 0.0f; - while (*text) + const char *stop; + if (length == -1) + stop = text + strlen(text); + else + stop = text + length; + + while (text < stop) { const int c = *text; const float width = current_font->m_CharEndTable[c] - current_font->m_CharStartTable[c]; -- cgit 1.4.1