add StrokeIsUnder font option
This commit is contained in:
@@ -517,6 +517,18 @@ bool BitmapText::EarlyAbortDraw() const
|
|||||||
return m_wTextLines.empty();
|
return m_wTextLines.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define DRAW_STROKE \
|
||||||
|
bool bUsingStrokeTexture = !!m_vpFontPageTextures[0]->m_pTextureStroke; \
|
||||||
|
if( bUsingStrokeTexture && m_StrokeColor.a > 0 ) \
|
||||||
|
{ \
|
||||||
|
RageColor c = m_StrokeColor; \
|
||||||
|
c.a *= m_pTempState->diffuse[0].a; \
|
||||||
|
for( unsigned i=0; i<m_aVertices.size(); i++ ) \
|
||||||
|
m_aVertices[i].c = c; \
|
||||||
|
DrawChars( true ); \
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// 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()
|
||||||
{
|
{
|
||||||
@@ -543,6 +555,14 @@ void BitmapText::DrawPrimitives()
|
|||||||
DISPLAY->PopMatrix();
|
DISPLAY->PopMatrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// render the stroke
|
||||||
|
//
|
||||||
|
if( m_pFont->GetStrokeIsUnder() )
|
||||||
|
{
|
||||||
|
DRAW_STROKE;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// render the diffuse pass
|
// render the diffuse pass
|
||||||
//
|
//
|
||||||
@@ -633,14 +653,9 @@ void BitmapText::DrawPrimitives()
|
|||||||
//
|
//
|
||||||
// render the stroke
|
// render the stroke
|
||||||
//
|
//
|
||||||
bool bUsingStrokeTexture = !!m_vpFontPageTextures[0]->m_pTextureStroke;
|
if( !m_pFont->GetStrokeIsUnder() )
|
||||||
if( bUsingStrokeTexture && m_StrokeColor.a > 0 )
|
|
||||||
{
|
{
|
||||||
RageColor c = m_StrokeColor;
|
DRAW_STROKE;
|
||||||
c.a *= m_pTempState->diffuse[0].a;
|
|
||||||
for( unsigned i=0; i<m_aVertices.size(); i++ )
|
|
||||||
m_aVertices[i].c = c;
|
|
||||||
DrawChars( true );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -230,6 +230,7 @@ Font::Font()
|
|||||||
m_bRightToLeft = false;
|
m_bRightToLeft = false;
|
||||||
m_fFontBaseZoom = 1;
|
m_fFontBaseZoom = 1;
|
||||||
m_DefaultStrokeColor = RageColor(1,1,1,1);
|
m_DefaultStrokeColor = RageColor(1,1,1,1);
|
||||||
|
m_bStrokeIsUnder = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Font::~Font()
|
Font::~Font()
|
||||||
@@ -695,6 +696,7 @@ void Font::Load( const RString &sIniPath, RString sChars )
|
|||||||
RString s;
|
RString s;
|
||||||
if( ini.GetValue( "main", "DefaultStrokeColor", s ) )
|
if( ini.GetValue( "main", "DefaultStrokeColor", s ) )
|
||||||
m_DefaultStrokeColor.FromString( s );
|
m_DefaultStrokeColor.FromString( s );
|
||||||
|
ini.GetValue( "main", "StrokeIsUnder", m_bStrokeIsUnder );
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -149,6 +149,7 @@ public:
|
|||||||
bool IsRightToLeft() const { return m_bRightToLeft; };
|
bool IsRightToLeft() const { return m_bRightToLeft; };
|
||||||
float GetFontBaseZoom() const { return m_fFontBaseZoom; };
|
float GetFontBaseZoom() const { return m_fFontBaseZoom; };
|
||||||
const RageColor &GetDefaultStrokeColor() const { return m_DefaultStrokeColor; };
|
const RageColor &GetDefaultStrokeColor() const { return m_DefaultStrokeColor; };
|
||||||
|
const bool GetStrokeIsUnder() const { return m_bStrokeIsUnder; };
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/* List of pages and fonts that we use (and are responsible for freeing). */
|
/* List of pages and fonts that we use (and are responsible for freeing). */
|
||||||
@@ -169,6 +170,7 @@ private:
|
|||||||
|
|
||||||
float m_fFontBaseZoom;
|
float m_fFontBaseZoom;
|
||||||
RageColor m_DefaultStrokeColor;
|
RageColor m_DefaultStrokeColor;
|
||||||
|
bool m_bStrokeIsUnder; // draw stroke under if true, over if false
|
||||||
|
|
||||||
/* We keep this around only for reloading. */
|
/* We keep this around only for reloading. */
|
||||||
RString m_sChars;
|
RString m_sChars;
|
||||||
|
|||||||
Reference in New Issue
Block a user