From 36bf115ed560233b37f5777badb6419985cb3d72 Mon Sep 17 00:00:00 2001 From: Lee Salzman Date: Wed, 27 Jun 2007 05:30:42 +0000 Subject: [PATCH] *** empty log message *** git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@1161 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- source/src/menus.cpp | 2 +- source/src/rendertext.cpp | 19 +++++++++++++------ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/source/src/menus.cpp b/source/src/menus.cpp index 94ebe09b..54cf4210 100644 --- a/source/src/menus.cpp +++ b/source/src/menus.cpp @@ -67,7 +67,7 @@ void drawmenubg(int x1, int y1, int x2, int y2, bool border) static Texture *tex = NULL; if(!tex) tex = textureload("packages/textures/makke/menu.jpg"); blendbox(x1, y1, x2, y2, border, tex->id); -}; +} #define MAXMENU 17 diff --git a/source/src/rendertext.cpp b/source/src/rendertext.cpp index 47c33594..5f943619 100644 --- a/source/src/rendertext.cpp +++ b/source/src/rendertext.cpp @@ -91,7 +91,7 @@ void text_endcolumns() int text_width(const char *str, int limit) { if(!str) return 0; - int x = 0, col = 0; + int x = 0, col = 0, colx = 0; for(int i = 0; str[i] && (limit<0 || i=columns->length()) columns->add(0); - x = max(x, (*columns)[col]); - (*columns)[col] = x; + int w = char_width('\t', x) - colx; + w = max(w, (*columns)[col]); + (*columns)[col] = w; col++; + colx += w; + x = colx; } + else x = char_width('\t', x); break; default: @@ -172,7 +175,7 @@ void draw_text(const char *str, int left, int top) glColor3ub(255, 255, 255); static float colorstack[8][4]; - int colorpos = 0, x = left, y = top, col = 0; + int colorpos = 0, x = left, y = top, col = 0, colx = 0; glBegin(GL_QUADS); for(int i = 0; str[i]; i++) @@ -181,7 +184,11 @@ void draw_text(const char *str, int left, int top) switch(c) { case '\t': - if(columns && collength()) x = left + (*columns)[col++]; + if(columns && collength()) + { + colx += (*columns)[col++]; + x = left + colx; + } else x = (x-left+PIXELTAB)/PIXELTAB*PIXELTAB+left; continue;