add control over ShadowLength X/Y and ShadowColor
This commit is contained in:
+11
-2
@@ -100,7 +100,9 @@ void Actor::InitState()
|
||||
m_effectColor2 = RageColor(1,1,1,1);
|
||||
|
||||
m_bVisible = true;
|
||||
m_fShadowLength = 0;
|
||||
m_fShadowLengthX = 0;
|
||||
m_fShadowLengthY = 0;
|
||||
m_ShadowColor = RageColor(0,0,0,0.5);
|
||||
m_bIsAnimating = true;
|
||||
m_fHibernateSecondsLeft = 0;
|
||||
m_iDrawOrder = 0;
|
||||
@@ -198,7 +200,8 @@ Actor::Actor( const Actor &cpy ):
|
||||
|
||||
CPY( m_bVisible );
|
||||
CPY( m_fHibernateSecondsLeft );
|
||||
CPY( m_fShadowLength );
|
||||
CPY( m_fShadowLengthX );
|
||||
CPY( m_fShadowLengthY );
|
||||
CPY( m_bIsAnimating );
|
||||
CPY( m_iDrawOrder );
|
||||
|
||||
@@ -1318,6 +1321,9 @@ public:
|
||||
static int pitch( T* p, lua_State *L ) { p->AddRotationP(FArg(1)); return 0; }
|
||||
static int roll( T* p, lua_State *L ) { p->AddRotationR(FArg(1)); return 0; }
|
||||
static int shadowlength( T* p, lua_State *L ) { p->SetShadowLength(FArg(1)); return 0; }
|
||||
static int shadowlengthx( T* p, lua_State *L ) { p->SetShadowLengthX(FArg(1)); return 0; }
|
||||
static int shadowlengthy( T* p, lua_State *L ) { p->SetShadowLengthY(FArg(1)); return 0; }
|
||||
static int shadowcolor( T* p, lua_State *L ) { RageColor c; c.FromStackCompat( L, 1 ); p->SetShadowColor( c ); return 0; }
|
||||
static int horizalign( T* p, lua_State *L ) { p->SetHorizAlign(Enum::Check<HorizAlign>(L, 1)); return 0; }
|
||||
static int vertalign( T* p, lua_State *L ) { p->SetVertAlign(Enum::Check<VertAlign>(L, 1)); return 0; }
|
||||
static int halign( T* p, lua_State *L ) { p->SetHorizAlign(FArg(1)); return 0; }
|
||||
@@ -1519,6 +1525,9 @@ public:
|
||||
ADD_METHOD( pitch );
|
||||
ADD_METHOD( roll );
|
||||
ADD_METHOD( shadowlength );
|
||||
ADD_METHOD( shadowlengthx );
|
||||
ADD_METHOD( shadowlengthy );
|
||||
ADD_METHOD( shadowcolor );
|
||||
ADD_METHOD( horizalign );
|
||||
ADD_METHOD( vertalign );
|
||||
ADD_METHOD( halign );
|
||||
|
||||
@@ -321,7 +321,10 @@ public:
|
||||
//
|
||||
bool GetVisible() const { return m_bVisible; }
|
||||
void SetVisible( bool b ) { m_bVisible = b; }
|
||||
void SetShadowLength( float fLength ) { m_fShadowLength = fLength; }
|
||||
void SetShadowLength( float fLength ) { m_fShadowLengthX = fLength; m_fShadowLengthY = fLength; }
|
||||
void SetShadowLengthX( float fLengthX ) { m_fShadowLengthX = fLengthX; }
|
||||
void SetShadowLengthY( float fLengthY ) { m_fShadowLengthY = fLengthY; }
|
||||
void SetShadowColor( RageColor c ) { m_ShadowColor = c; }
|
||||
// TODO: Implement hibernate as a tween type?
|
||||
void SetHibernate( float fSecs ) { m_fHibernateSecondsLeft = fSecs; }
|
||||
void SetDrawOrder( int iOrder ) { m_iDrawOrder = iOrder; }
|
||||
@@ -463,7 +466,9 @@ protected:
|
||||
bool m_bVisible;
|
||||
bool m_bIsAnimating;
|
||||
float m_fHibernateSecondsLeft;
|
||||
float m_fShadowLength; // 0 == no shadow
|
||||
float m_fShadowLengthX;
|
||||
float m_fShadowLengthY;
|
||||
RageColor m_ShadowColor;
|
||||
int m_iDrawOrder; // lower first
|
||||
|
||||
//
|
||||
|
||||
@@ -528,15 +528,15 @@ void BitmapText::DrawPrimitives()
|
||||
//
|
||||
// render the shadow
|
||||
//
|
||||
if( m_fShadowLength != 0 )
|
||||
if( m_fShadowLengthX != 0 || m_fShadowLengthY != 0 )
|
||||
{
|
||||
DISPLAY->PushMatrix();
|
||||
DISPLAY->TranslateWorld( m_fShadowLength, m_fShadowLength, 0 ); // shift by 5 units
|
||||
|
||||
RageColor dim(0,0,0,0.5f*m_pTempState->diffuse[0].a); // semi-transparent black
|
||||
DISPLAY->TranslateWorld( m_fShadowLengthX, m_fShadowLengthY, 0 ); // shift by 5 units
|
||||
|
||||
RageColor c = m_ShadowColor;
|
||||
c.a *= m_pTempState->diffuse[0].a;
|
||||
for( unsigned i=0; i<m_aVertices.size(); i++ )
|
||||
m_aVertices[i].c = dim;
|
||||
m_aVertices[i].c = c;
|
||||
DrawChars();
|
||||
|
||||
DISPLAY->PopMatrix();
|
||||
|
||||
@@ -357,15 +357,14 @@ void ColorBitmapText::DrawPrimitives( )
|
||||
//
|
||||
// render the shadow
|
||||
//
|
||||
if( m_fShadowLength != 0 )
|
||||
if( m_fShadowLengthX != 0 || m_fShadowLengthY != 0 )
|
||||
{
|
||||
DISPLAY->PushMatrix();
|
||||
DISPLAY->TranslateWorld( m_fShadowLength, m_fShadowLength, 0 ); // shift by 5 units
|
||||
|
||||
RageColor dim(0,0,0,0.5f*m_pTempState->diffuse[0].a); // semi-transparent black
|
||||
|
||||
DISPLAY->TranslateWorld( m_fShadowLengthX, m_fShadowLengthY, 0 ); // shift by 5 units
|
||||
RageColor c = m_ShadowColor;
|
||||
c.a *= m_pTempState->diffuse[0].a;
|
||||
for( unsigned i=0; i<m_aVertices.size(); i++ )
|
||||
m_aVertices[i].c = dim;
|
||||
m_aVertices[i].c = c;
|
||||
DrawChars();
|
||||
|
||||
DISPLAY->PopMatrix();
|
||||
|
||||
@@ -529,11 +529,13 @@ void Sprite::DrawTexture( const TweenState *state )
|
||||
//////////////////////
|
||||
// render the shadow
|
||||
//////////////////////
|
||||
if( m_fShadowLength != 0 )
|
||||
if( m_fShadowLengthX != 0 || m_fShadowLengthY != 0 )
|
||||
{
|
||||
DISPLAY->PushMatrix();
|
||||
DISPLAY->TranslateWorld( m_fShadowLength, m_fShadowLength, 0 ); // shift by 5 units
|
||||
v[0].c = v[1].c = v[2].c = v[3].c = RageColor( 0, 0, 0, 0.5f*state->diffuse[0].a ); // semi-transparent black
|
||||
DISPLAY->TranslateWorld( m_fShadowLengthX, m_fShadowLengthY, 0 ); // shift by 5 units
|
||||
RageColor c = m_ShadowColor;
|
||||
c.a *= state->diffuse[0].a;
|
||||
v[0].c = v[1].c = v[2].c = v[3].c = c; // semi-transparent black
|
||||
DISPLAY->DrawQuad( v );
|
||||
DISPLAY->PopMatrix();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user