simplify textglowmode check
This commit is contained in:
+16
-22
@@ -136,7 +136,6 @@ void BitmapText::LoadFromNode( const XNode* pNode )
|
|||||||
Actor::LoadFromNode( pNode );
|
Actor::LoadFromNode( pNode );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool BitmapText::LoadFromFont( const RString& sFontFilePath )
|
bool BitmapText::LoadFromFont( const RString& sFontFilePath )
|
||||||
{
|
{
|
||||||
CHECKPOINT_M( ssprintf("BitmapText::LoadFromFont(%s)", sFontFilePath.c_str()) );
|
CHECKPOINT_M( ssprintf("BitmapText::LoadFromFont(%s)", sFontFilePath.c_str()) );
|
||||||
@@ -156,7 +155,6 @@ bool BitmapText::LoadFromFont( const RString& sFontFilePath )
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool BitmapText::LoadFromTextureAndChars( const RString& sTexturePath, const RString& sChars )
|
bool BitmapText::LoadFromTextureAndChars( const RString& sTexturePath, const RString& sChars )
|
||||||
{
|
{
|
||||||
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()) );
|
||||||
@@ -345,7 +343,7 @@ void BitmapText::DrawChars( bool bUseStrokeTexture )
|
|||||||
else
|
else
|
||||||
DISPLAY->SetTexture( TextureUnit_1, m_vpFontPageTextures[start]->m_pTextureMain->GetTexHandle() );
|
DISPLAY->SetTexture( TextureUnit_1, m_vpFontPageTextures[start]->m_pTextureMain->GetTexHandle() );
|
||||||
|
|
||||||
/* Don't bother setting texture render states for text. We never go outside of 0..1. */
|
/* Don't bother setting texture render states for text. We never go outside of 0..1. */
|
||||||
/* We should call SetTextureRenderStates because it does more than just setting
|
/* We should call SetTextureRenderStates because it does more than just setting
|
||||||
* the texture wrapping state. If setting the wrapping state is found to be slow,
|
* the texture wrapping state. If setting the wrapping state is found to be slow,
|
||||||
* there should probably be a "don't care" texture wrapping mode set in Actor. -Chris */
|
* there should probably be a "don't care" texture wrapping mode set in Actor. -Chris */
|
||||||
@@ -360,8 +358,8 @@ void BitmapText::DrawChars( bool bUseStrokeTexture )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* sText is UTF-8. If not all of the characters in sText are available in the
|
/* sText is UTF-8. If not all of the characters in sText are available in the
|
||||||
* font, sAlternateText will be used instead. If there are unavailable characters
|
* font, sAlternateText will be used instead. If there are unavailable characters
|
||||||
* in sAlternateText, too, just use sText. */
|
* in sAlternateText, too, just use sText. */
|
||||||
void BitmapText::SetText( const RString& _sText, const RString& _sAlternateText, int iWrapWidthPixels )
|
void BitmapText::SetText( const RString& _sText, const RString& _sAlternateText, int iWrapWidthPixels )
|
||||||
{
|
{
|
||||||
@@ -396,13 +394,13 @@ void BitmapText::SetTextInternal()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Break sText into lines that don't exceed iWrapWidthPixels
|
// Break sText into lines that don't exceed iWrapWidthPixels. (if only
|
||||||
// (if only one word fits on the line, it may be larger than iWrapWidthPixels).
|
// one word fits on the line, it may be larger than iWrapWidthPixels).
|
||||||
|
|
||||||
// This does not work in all languages:
|
// This does not work in all languages:
|
||||||
/* "...I can add Japanese wrapping, at least. We could handle hyphens
|
/* "...I can add Japanese wrapping, at least. We could handle hyphens
|
||||||
* and soft hyphens and pretty easily, too." -glenn */
|
* and soft hyphens and pretty easily, too." -glenn */
|
||||||
// TODO: Move this wrapping logic into Font
|
// TODO: Move this wrapping logic into Font.
|
||||||
vector<RString> asLines;
|
vector<RString> asLines;
|
||||||
split( m_sText, "\n", asLines, false );
|
split( m_sText, "\n", asLines, false );
|
||||||
|
|
||||||
@@ -695,15 +693,9 @@ void BitmapText::DrawPrimitives()
|
|||||||
/* Draw glow using the base texture and the glow texture. Otherwise,
|
/* Draw glow using the base texture and the glow texture. Otherwise,
|
||||||
* glow looks too tame on BitmapText that has a stroke. - Chris Danford */
|
* glow looks too tame on BitmapText that has a stroke. - Chris Danford */
|
||||||
/* This doesn't work well if the font is using an invisible stroke, as
|
/* This doesn't work well if the font is using an invisible stroke, as
|
||||||
* the invisible stroke will glow as well. Time for TextGlowMode. -aj */
|
* the invisible stroke will glow as well. Time for TextGlowMode.
|
||||||
if(m_TextGlowMode == TextGlowMode_Inner || m_TextGlowMode == TextGlowMode_Both)
|
* Only draw the strokes if the glow mode is not inner only. -aj */
|
||||||
{
|
DrawChars(m_TextGlowMode != TextGlowMode_Inner);
|
||||||
DrawChars( false );
|
|
||||||
}
|
|
||||||
if(m_TextGlowMode == TextGlowMode_Stroke || m_TextGlowMode == TextGlowMode_Both)
|
|
||||||
{
|
|
||||||
DrawChars( true );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -813,11 +805,11 @@ public:
|
|||||||
{
|
{
|
||||||
RString s = SArg(1);
|
RString s = SArg(1);
|
||||||
RString sAlt;
|
RString sAlt;
|
||||||
// XXX: Lua strings should simply use "\n" natively. However, some
|
/* XXX: Lua strings should simply use "\n" natively. However, some
|
||||||
// settext calls may be made from GetMetric() calls to other strings,
|
* settext calls may be made from GetMetric() calls to other strings, and
|
||||||
// and it's confusing for :: to work in some strings and not others.
|
* it's confusing for :: to work in some strings and not others.
|
||||||
// Eventually, all strings should be Lua expressions, but until then
|
* Eventually, all strings should be Lua expressions, but until then,
|
||||||
// continue to support this.
|
* continue to support this. */
|
||||||
s.Replace("::","\n");
|
s.Replace("::","\n");
|
||||||
FontCharAliases::ReplaceMarkers( s );
|
FontCharAliases::ReplaceMarkers( s );
|
||||||
|
|
||||||
@@ -863,6 +855,8 @@ public:
|
|||||||
ADD_METHOD( strokecolor );
|
ADD_METHOD( strokecolor );
|
||||||
ADD_METHOD( uppercase );
|
ADD_METHOD( uppercase );
|
||||||
ADD_METHOD( textglowmode );
|
ADD_METHOD( textglowmode );
|
||||||
|
//ADD_METHOD( LoadFromFont );
|
||||||
|
//ADD_METHOD( LoadFromTextureAndChars );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user