cosmetic
This commit is contained in:
@@ -11,6 +11,12 @@
|
|||||||
#include "Font.h"
|
#include "Font.h"
|
||||||
#include "ActorUtil.h" // for BeginHandleArgs
|
#include "ActorUtil.h" // for BeginHandleArgs
|
||||||
|
|
||||||
|
/*
|
||||||
|
* XXX: Changing a whole array of diffuse colors every frame (several times) is a waste,
|
||||||
|
* when we're usually setting them all to the same value. Rainbow and fading are annoying
|
||||||
|
* to optimize, but rarely used. Iterating over every character in Draw() is dumb.
|
||||||
|
*/
|
||||||
|
|
||||||
/* XXX:
|
/* XXX:
|
||||||
* We need some kind of font modifier string for metrics. For example,
|
* We need some kind of font modifier string for metrics. For example,
|
||||||
* "valign=top;spacing = x+5,y+2"
|
* "valign=top;spacing = x+5,y+2"
|
||||||
@@ -76,7 +82,8 @@ bool BitmapText::LoadFromFont( const CString& sFontFilePath )
|
|||||||
{
|
{
|
||||||
CHECKPOINT_M( ssprintf("BitmapText::LoadFromFont(%s)", sFontFilePath.c_str()) );
|
CHECKPOINT_M( ssprintf("BitmapText::LoadFromFont(%s)", sFontFilePath.c_str()) );
|
||||||
|
|
||||||
if( m_pFont ) {
|
if( m_pFont )
|
||||||
|
{
|
||||||
FONT->UnloadFont( m_pFont );
|
FONT->UnloadFont( m_pFont );
|
||||||
m_pFont = NULL;
|
m_pFont = NULL;
|
||||||
}
|
}
|
||||||
@@ -93,7 +100,8 @@ bool BitmapText::LoadFromTextureAndChars( const CString& sTexturePath, const CSt
|
|||||||
{
|
{
|
||||||
CHECKPOINT_M( ssprintf("BitmapText::LoadFromTextureAndChars(\"%s\",\"%s\")", sTexturePath.c_str(), sChars.c_str()) );
|
CHECKPOINT_M( ssprintf("BitmapText::LoadFromTextureAndChars(\"%s\",\"%s\")", sTexturePath.c_str(), sChars.c_str()) );
|
||||||
|
|
||||||
if( m_pFont ) {
|
if( m_pFont )
|
||||||
|
{
|
||||||
FONT->UnloadFont( m_pFont );
|
FONT->UnloadFont( m_pFont );
|
||||||
m_pFont = NULL;
|
m_pFont = NULL;
|
||||||
}
|
}
|
||||||
@@ -124,7 +132,8 @@ void BitmapText::BuildChars()
|
|||||||
verts.clear();
|
verts.clear();
|
||||||
tex.clear();
|
tex.clear();
|
||||||
|
|
||||||
if(m_wTextLines.empty()) return;
|
if( m_wTextLines.empty() )
|
||||||
|
return;
|
||||||
|
|
||||||
m_size.y = float(m_pFont->GetHeight() * m_wTextLines.size());
|
m_size.y = float(m_pFont->GetHeight() * m_wTextLines.size());
|
||||||
int MinSpacing = 0;
|
int MinSpacing = 0;
|
||||||
@@ -390,13 +399,16 @@ bool BitmapText::StringWillUseAlternate(const CString& sText, const CString& sAl
|
|||||||
ASSERT( m_pFont );
|
ASSERT( m_pFont );
|
||||||
|
|
||||||
/* Can't use the alternate if there isn't one. */
|
/* Can't use the alternate if there isn't one. */
|
||||||
if(!sAlternateText.size()) return false;
|
if( !sAlternateText.size() )
|
||||||
|
return false;
|
||||||
|
|
||||||
/* False if the alternate isn't needed. */
|
/* False if the alternate isn't needed. */
|
||||||
if(m_pFont->FontCompleteForString(CStringToWstring(sText))) return false;
|
if( m_pFont->FontCompleteForString(CStringToWstring(sText)) )
|
||||||
|
return false;
|
||||||
|
|
||||||
/* False if the alternate is also incomplete. */
|
/* False if the alternate is also incomplete. */
|
||||||
if(!m_pFont->FontCompleteForString(CStringToWstring(sAlternateText))) return false;
|
if( !m_pFont->FontCompleteForString(CStringToWstring(sAlternateText)) )
|
||||||
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -425,7 +437,6 @@ bool BitmapText::EarlyAbortDraw()
|
|||||||
// draw text at x, y using colorTop blended down to colorBottom, with size multiplied by scale
|
// draw text at x, y using colorTop blended down to colorBottom, with size multiplied by scale
|
||||||
void BitmapText::DrawPrimitives()
|
void BitmapText::DrawPrimitives()
|
||||||
{
|
{
|
||||||
|
|
||||||
Actor::SetRenderStates(); // set Actor-specified render states
|
Actor::SetRenderStates(); // set Actor-specified render states
|
||||||
DISPLAY->SetTextureModeModulate();
|
DISPLAY->SetTextureModeModulate();
|
||||||
|
|
||||||
@@ -492,14 +503,16 @@ void BitmapText::DrawPrimitives()
|
|||||||
/* Rebuild when these change. */
|
/* Rebuild when these change. */
|
||||||
void BitmapText::SetHorizAlign( HorizAlign ha )
|
void BitmapText::SetHorizAlign( HorizAlign ha )
|
||||||
{
|
{
|
||||||
if(ha == m_HorizAlign) return;
|
if( ha == m_HorizAlign )
|
||||||
|
return;
|
||||||
Actor::SetHorizAlign(ha);
|
Actor::SetHorizAlign(ha);
|
||||||
BuildChars();
|
BuildChars();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BitmapText::SetVertAlign( VertAlign va )
|
void BitmapText::SetVertAlign( VertAlign va )
|
||||||
{
|
{
|
||||||
if(va == m_VertAlign) return;
|
if( va == m_VertAlign )
|
||||||
|
return;
|
||||||
Actor::SetVertAlign(va);
|
Actor::SetVertAlign(va);
|
||||||
BuildChars();
|
BuildChars();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user