I implemented "tabs" in the string handling, but it's not working right, so I made the statistics use spaces instead.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@157 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
gigaherz 2008-08-08 22:17:03 +00:00
parent a1f48fee94
commit 8731021466
3 changed files with 30 additions and 15 deletions

View File

@ -369,7 +369,7 @@ void Renderer::ProcessMessages()
void Renderer::DrawText(const char* pstr, int left, int top, u32 color)
{
glColor3f(((color>>16) & 0xff)/255.0f, ((color>>8) & 0xff)/255.0f, (color & 0xff)/255.0f);
s_pfont->printStuff(pstr, left * 2.0f / (float)nBackbufferWidth - 1, 1 - top * 2.0f / (float)nBackbufferHeight,0,nBackbufferHeight);
s_pfont->printStuff(pstr, left * 2.0f / (float)nBackbufferWidth - 1, 1 - top * 2.0f / (float)nBackbufferHeight,0,nBackbufferWidth,nBackbufferHeight);
}
void Renderer::SetAA(int aa)

View File

@ -172,8 +172,9 @@ void RasterFont::printCenteredString(const char *s, double y, int screen_width,
printString(s, x, y, z);
}
void RasterFont::printStuff(const char *text, double x, double start_y, double z, int bbHeight)
void RasterFont::printStuff(const char *text, double start_x, double start_y, double z, int bbWidth, int bbHeight)
{
double x=start_x;
double y=start_y;
static char temp[1024];
@ -186,6 +187,7 @@ void RasterFont::printStuff(const char *text, double x, double start_y, double z
*t=0;
printString(temp,x,y,z);
y-=char_height * 2.0f / bbHeight;
x=start_x;
t=temp;
}
else if(*text=='\r')
@ -195,6 +197,19 @@ void RasterFont::printStuff(const char *text, double x, double start_y, double z
else if(*text=='\t')
{
//todo: add tabs every something like 4*char_width
*t=0;
int cpos = strlen(temp);
int newpos = cpos+4&(~3);
printString(temp,x,y,z);
x =start_x + (char_width*newpos) * 2.0f / bbWidth;
t=temp;
*(t++)=' ';
}
else

View File

@ -35,7 +35,7 @@ public:
void printString(const char *s, double x, double y, double z=0.0);
void printCenteredString(const char *s, double y, int screen_width, double z=0.0);
void printStuff(const char *text, double x, double y, double z, int bbHeight);
void printStuff(const char *text, double x, double y, double z, int bbWidth, int bbHeight);
};
#endif