Skip to content

Commit

Permalink
do not render color codes in renderttf for #199
Browse files Browse the repository at this point in the history
  • Loading branch information
no-lex committed Oct 16, 2022
1 parent 528b2a0 commit 2bce24a
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/engine/render/renderttf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,24 @@ void TTFRenderer::openfont(const char * inpath, int size)
//with a (BGRA) SDL_Color value as passed to its third parameter
void TTFRenderer::renderttf(const char* message, SDL_Color col, int x, int y, float scale, uint wrap)
{
if(!message)
std::string msg = std::string(message);
for(;;)
{
size_t itr = msg.find("^f");
if(itr < msg.size())
{
msg.erase(itr, 3);
}
else
{
break;
}
}
if(!msg.size())
{
return;
}
TTFSurface tex = renderttfgl(message, col, x, y, scale, wrap);
TTFSurface tex = renderttfgl(msg.c_str(), col, x, y, scale, wrap);
if(tex.tex)
{
float w = tex.w*scale,
Expand Down

0 comments on commit 2bce24a

Please sign in to comment.