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) 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); 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) void Renderer::SetAA(int aa)
@ -666,23 +666,23 @@ void Renderer::Swap(const TRectangle& rc)
char st[2048]; char st[2048];
char *p = st; char *p = st;
p+=sprintf(p,"Num textures created: %i\n",stats.numTexturesCreated); p+=sprintf(p,"Num textures created: %i\n",stats.numTexturesCreated);
p+=sprintf(p,"Num textures alive: %i\n",stats.numTexturesAlive); p+=sprintf(p,"Num textures alive: %i\n",stats.numTexturesAlive);
p+=sprintf(p,"Num pshaders created: %i\n",stats.numPixelShadersCreated); p+=sprintf(p,"Num pshaders created: %i\n",stats.numPixelShadersCreated);
p+=sprintf(p,"Num pshaders alive: %i\n",stats.numPixelShadersAlive); p+=sprintf(p,"Num pshaders alive: %i\n",stats.numPixelShadersAlive);
p+=sprintf(p,"Num vshaders created: %i\n",stats.numVertexShadersCreated); p+=sprintf(p,"Num vshaders created: %i\n",stats.numVertexShadersCreated);
p+=sprintf(p,"Num vshaders alive: %i\n",stats.numVertexShadersAlive); p+=sprintf(p,"Num vshaders alive: %i\n",stats.numVertexShadersAlive);
p+=sprintf(p,"Num dlists called: %i\n",stats.numDListsCalled); p+=sprintf(p,"Num dlists called: %i\n",stats.numDListsCalled);
p+=sprintf(p,"Num dlists created: %i\n",stats.numDListsCreated); p+=sprintf(p,"Num dlists created: %i\n",stats.numDListsCreated);
p+=sprintf(p,"Num dlists alive: %i\n",stats.numDListsAlive); p+=sprintf(p,"Num dlists alive: %i\n",stats.numDListsAlive);
p+=sprintf(p,"Num strip joins: %i\n",stats.numJoins); p+=sprintf(p,"Num strip joins: %i\n",stats.numJoins);
p+=sprintf(p,"Num primitives: %i\n",stats.thisFrame.numPrims); p+=sprintf(p,"Num primitives: %i\n",stats.thisFrame.numPrims);
p+=sprintf(p,"Num primitives (DL): %i\n",stats.thisFrame.numDLPrims); p+=sprintf(p,"Num primitives (DL): %i\n",stats.thisFrame.numDLPrims);
p+=sprintf(p,"Num bad commands: %i%s\n",stats.thisFrame.numBadCommands,stats.thisFrame.numBadCommands?"!!!":""); p+=sprintf(p,"Num bad commands: %i%s\n",stats.thisFrame.numBadCommands,stats.thisFrame.numBadCommands?"!!!":"");
p+=sprintf(p,"Num XF loads: %i\n",stats.thisFrame.numXFLoads); p+=sprintf(p,"Num XF loads: %i\n",stats.thisFrame.numXFLoads);
p+=sprintf(p,"Num XF loads (DL): %i\n",stats.thisFrame.numXFLoadsInDL); p+=sprintf(p,"Num XF loads (DL): %i\n",stats.thisFrame.numXFLoadsInDL);
p+=sprintf(p,"Num CP loads: %i\n",stats.thisFrame.numCPLoads); p+=sprintf(p,"Num CP loads: %i\n",stats.thisFrame.numCPLoads);
p+=sprintf(p,"Num CP loads (DL): %i\n",stats.thisFrame.numCPLoadsInDL); p+=sprintf(p,"Num CP loads (DL): %i\n",stats.thisFrame.numCPLoadsInDL);
p+=sprintf(p,"Num BP loads: %i\n",stats.thisFrame.numBPLoads); p+=sprintf(p,"Num BP loads: %i\n",stats.thisFrame.numBPLoads);
p+=sprintf(p,"Num BP loads (DL): %i\n",stats.thisFrame.numBPLoadsInDL); p+=sprintf(p,"Num BP loads (DL): %i\n",stats.thisFrame.numBPLoadsInDL);
Renderer::DrawText(st, 20, 20, 0xFF00FFFF); Renderer::DrawText(st, 20, 20, 0xFF00FFFF);

View File

@ -172,8 +172,9 @@ void RasterFont::printCenteredString(const char *s, double y, int screen_width,
printString(s, x, y, z); 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; double y=start_y;
static char temp[1024]; static char temp[1024];
@ -186,6 +187,7 @@ void RasterFont::printStuff(const char *text, double x, double start_y, double z
*t=0; *t=0;
printString(temp,x,y,z); printString(temp,x,y,z);
y-=char_height * 2.0f / bbHeight; y-=char_height * 2.0f / bbHeight;
x=start_x;
t=temp; t=temp;
} }
else if(*text=='\r') 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') else if(*text=='\t')
{ {
//todo: add tabs every something like 4*char_width //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++)=' '; *(t++)=' ';
} }
else else

View File

@ -35,7 +35,7 @@ public:
void printString(const char *s, double x, double y, double z=0.0); 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 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 #endif