fix in ZFont crash when drawing empty string

This commit is contained in:
James Turk 2003-10-05 19:59:29 +00:00
parent b3bc3e7182
commit 251ec931f9
2 changed files with 7 additions and 2 deletions

View File

@ -1,5 +1,5 @@
ZEngine Version Log for Version 0.8.5
$Id: changelog.txt,v 1.51 2003/10/03 21:54:42 cozman Exp $
$Id: changelog.txt,v 1.52 2003/10/05 19:59:29 cozman Exp $
Changes are marked with symbols that describe them:
! is code that breaks backwards compatibility (used after 0.8.0-rc1, previous versions broke compatibility)
@ -24,6 +24,7 @@ Changes are marked with symbols that describe them:
- Removal of VC6 project files and official support.
- Removal of SDL_net support in favour of external library.
# Sweep of non-used legacy code.
# Fix crash in drawing blank string with ZFont.
# Tests modified to show off loading of compressed files.
# Moved image,sound,music and font loading code from legacy ZEngine location to respective classes.
# Tiny optimizations within newer ZImage code.

View File

@ -13,7 +13,7 @@
\brief Source file for ZFont.
Implementation of ZFont, the basic Font class for ZEngine.
<br>$Id: ZE_ZFont.cpp,v 1.13 2003/09/24 02:03:18 cozman Exp $<br>
<br>$Id: ZE_ZFont.cpp,v 1.14 2003/10/05 19:59:29 cozman Exp $<br>
\author James Turk
**/
@ -85,12 +85,16 @@ void ZFont::Release()
void ZFont::DrawText(std::string text, ZImage &image) const
{
if(text.length() == 0)
text = " ";
image.Attach(TTF_RenderText_Blended(rFont, text.c_str(), rColor));
image.SetAlpha(rColor.unused); //the images alpha comes from the SetColor a parameter
}
void ZFont::DrawShadedText(std::string text, ZImage &image) const
{
if(text.length() == 0)
text = " ";
image.Attach(TTF_RenderText_Shaded(rFont, text.c_str(), rColor, rBGColor));
image.SetAlpha(rColor.unused);
}