diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp index 81ab42a067..32ddd29563 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp @@ -353,7 +353,8 @@ void Renderer::ProcessMessages() int left = 25, top = 15; list::iterator it = s_listMsgs.begin(); - while( it != s_listMsgs.end() ) { + while( it != s_listMsgs.end() ) + { DrawText(it->str, left+1, top+1, 0xff000000); DrawText(it->str, left, top, 0xffffff30); top += 15; @@ -368,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->printString(pstr, left * 2.0f / (float)nBackbufferWidth - 1, 1 - top * 2.0f / (float)nBackbufferHeight,0); + s_pfont->printStuff(pstr, left * 2.0f / (float)nBackbufferWidth - 1, 1 - top * 2.0f / (float)nBackbufferHeight,0,nBackbufferHeight); } void Renderer::SetAA(int aa) diff --git a/Source/Plugins/Plugin_VideoOGL/Src/rasterfont.cpp b/Source/Plugins/Plugin_VideoOGL/Src/rasterfont.cpp index 70cdc2817f..9bacf0ca09 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/rasterfont.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/rasterfont.cpp @@ -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); + } +} \ No newline at end of file diff --git a/Source/Plugins/Plugin_VideoOGL/Src/rasterfont.h b/Source/Plugins/Plugin_VideoOGL/Src/rasterfont.h index 93440b4ff1..e18687fe22 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/rasterfont.h +++ b/Source/Plugins/Plugin_VideoOGL/Src/rasterfont.h @@ -34,6 +34,8 @@ public: // and the happy helper functions 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); }; #endif