Fixed font rendering bleeding effects.

This commit is contained in:
emb 2015-01-12 12:11:13 -06:00
parent 1609cf65ad
commit bce77bba23
2 changed files with 5 additions and 2 deletions

View File

@ -101,6 +101,7 @@ void Text::Draw()
rect.y = static_cast<int>(yOrigin);
SDL_LockMutex(SDL::GetMutex());
SDL_SetTextureBlendMode(t, SDL_BLENDMODE_ADD);
SDL_SetTextureColorMod(t, FontColor.r, FontColor.g, FontColor.b);
SDL_UnlockMutex(SDL::GetMutex());

View File

@ -50,6 +50,7 @@ bool Font::GetRect(unsigned int charCode, GlyphInfo &glyph)
return false;
}
bool Font::Initialize(std::string fontPath)
{
TTF_Font *font = TTF_OpenFont(fontPath.c_str(), 128);
@ -121,7 +122,6 @@ bool Font::Initialize(std::string fontPath)
#endif
SDL_Surface *atlasSurface = SDL_CreateRGBSurface(0, atlasWidth, atlasHeight, 24, rmask, gmask, bmask, amask);
SDL_FillRect(atlasSurface, NULL, SDL_MapRGB(atlasSurface->format, 0, 0, 0));
std::map<unsigned int, GlyphInfoBuild *>::iterator it;
for(it = Atlas.begin(); it != Atlas.end(); it++)
@ -133,7 +133,7 @@ bool Font::Initialize(std::string fontPath)
}
SDL_LockMutex(SDL::GetMutex());
SDL_SetColorKey(atlasSurface, SDL_TRUE, SDL_MapRGB(atlasSurface->format, 0x00, 0x00, 0x00));
Texture = SDL_CreateTextureFromSurface(SDL::GetRenderer(), atlasSurface);
SDL_FreeSurface(atlasSurface);
SDL_UnlockMutex(SDL::GetMutex());
@ -143,6 +143,8 @@ bool Font::Initialize(std::string fontPath)
return true;
}
void Font::DeInitialize()
{
if(Texture)