mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
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:
@ -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);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user