Added a method to rasterfont, to parse strings for newlines. Fixes the statistics overlay in opengl plugin.

The string stuff is somewhat WIP, as I want to add support for TAB character handling (and maybe others).

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@156 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
gigaherz
2008-08-08 22:04:02 +00:00
parent 627695c667
commit a1f48fee94
3 changed files with 42 additions and 2 deletions

View File

@ -172,3 +172,40 @@ 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)
{
double y=start_y;
static char temp[1024];
char* t = temp;
while(*text)
{
if(*text=='\n')
{
*t=0;
printString(temp,x,y,z);
y-=char_height * 2.0f / bbHeight;
t=temp;
}
else if(*text=='\r')
{
t=temp;
}
else if(*text=='\t')
{
//todo: add tabs every something like 4*char_width
*(t++)=' ';
}
else
{
*(t++)=*text;
}
text++;
}
if(t!=text)
{
*t=0;
printString(temp,x,y,z);
}
}