add vertspacing

This commit is contained in:
Glenn Maynard
2006-01-24 01:12:54 +00:00
parent 4dfd0d1d7c
commit a40813dec0
2 changed files with 12 additions and 0 deletions
+10
View File
@@ -51,6 +51,7 @@ BitmapText::BitmapText()
m_iWrapWidthPixels = -1; m_iWrapWidthPixels = -1;
m_fMaxWidth = 0; m_fMaxWidth = 0;
m_fMaxHeight = 0; m_fMaxHeight = 0;
m_iVertSpacing = 0;
SetShadowLength( 4 ); SetShadowLength( 4 );
} }
@@ -181,6 +182,7 @@ void BitmapText::BuildChars()
/* The height (from the origin to the baseline): */ /* The height (from the origin to the baseline): */
int iPadding = m_pFont->GetLineSpacing() - m_pFont->GetHeight(); int iPadding = m_pFont->GetLineSpacing() - m_pFont->GetHeight();
iPadding += m_iVertSpacing;
/* There's padding between every line: */ /* There's padding between every line: */
m_size.y += iPadding * (m_wTextLines.size()-1); m_size.y += iPadding * (m_wTextLines.size()-1);
@@ -416,6 +418,12 @@ void BitmapText::SetText( const RString& _sText, const RString& _sAlternateText,
UpdateBaseZoom(); UpdateBaseZoom();
} }
void BitmapText::SetVertSpacing( int iSpacing )
{
m_iVertSpacing = iSpacing;
BuildChars();
}
void BitmapText::SetMaxWidth( float fMaxWidth ) void BitmapText::SetMaxWidth( float fMaxWidth )
{ {
m_fMaxWidth = fMaxWidth; m_fMaxWidth = fMaxWidth;
@@ -848,6 +856,7 @@ public:
static int wrapwidthpixels( T* p, lua_State *L ) { p->SetWrapWidthPixels( IArg(1) ); return 0; } static int wrapwidthpixels( T* p, lua_State *L ) { p->SetWrapWidthPixels( IArg(1) ); return 0; }
static int maxwidth( T* p, lua_State *L ) { p->SetMaxWidth( FArg(1) ); return 0; } static int maxwidth( T* p, lua_State *L ) { p->SetMaxWidth( FArg(1) ); return 0; }
static int maxheight( T* p, lua_State *L ) { p->SetMaxHeight( FArg(1) ); return 0; } static int maxheight( T* p, lua_State *L ) { p->SetMaxHeight( FArg(1) ); return 0; }
static int vertspacing( T* p, lua_State *L ) { p->SetVertSpacing( IArg(1) ); return 0; }
static int settext( T* p, lua_State *L ) static int settext( T* p, lua_State *L )
{ {
RString s = SArg(1); RString s = SArg(1);
@@ -868,6 +877,7 @@ public:
ADD_METHOD( wrapwidthpixels ); ADD_METHOD( wrapwidthpixels );
ADD_METHOD( maxwidth ); ADD_METHOD( maxwidth );
ADD_METHOD( maxheight ); ADD_METHOD( maxheight );
ADD_METHOD( vertspacing );
ADD_METHOD( settext ); ADD_METHOD( settext );
ADD_METHOD( GetText ); ADD_METHOD( GetText );
Luna<T>::Register( L ); Luna<T>::Register( L );
+2
View File
@@ -22,6 +22,7 @@ public:
bool LoadFromFont( const RString& sFontName ); bool LoadFromFont( const RString& sFontName );
bool LoadFromTextureAndChars( const RString& sTexturePath, const RString& sChars ); bool LoadFromTextureAndChars( const RString& sTexturePath, const RString& sChars );
void SetText( const RString& sText, const RString& sAlternateText = "", int iWrapWidthPixels = -1 ); void SetText( const RString& sText, const RString& sAlternateText = "", int iWrapWidthPixels = -1 );
void SetVertSpacing( int iSpacing );
void SetMaxWidth( float fMaxWidth ); void SetMaxWidth( float fMaxWidth );
void SetMaxHeight( float fMaxHeight ); void SetMaxHeight( float fMaxHeight );
void SetWrapWidthPixels( int iWrapWidthPixels ); void SetWrapWidthPixels( int iWrapWidthPixels );
@@ -58,6 +59,7 @@ protected:
float m_fMaxWidth; float m_fMaxWidth;
float m_fMaxHeight; float m_fMaxHeight;
bool m_bRainbow; bool m_bRainbow;
int m_iVertSpacing;
vector<RageSpriteVertex> m_aVertices; vector<RageSpriteVertex> m_aVertices;
vector<RageTexture *> m_pTextures; vector<RageTexture *> m_pTextures;