Пример #1
0
/* If we're using custom coordinates, return them; otherwise return the
 * coordinates for the current state. */
void Sprite::GetActiveTextureCoords( float fTexCoordsOut[8] ) const
{
	if(m_bUsingCustomTexCoords) 
	{
		// GetCustomTextureCoords
		for( int i=0; i<8; i++ )
			fTexCoordsOut[i] = m_CustomTexCoords[i]; 
	}
	else
	{
		// GetCurrentTextureCoords
		const RectF *pTexCoordRect = GetCurrentTextureCoordRect();
		TexCoordArrayFromRect( fTexCoordsOut, *pTexCoordRect );
	}
}
Пример #2
0
void Banner::Update( float fDeltaTime )
{
	Sprite::Update( fDeltaTime );

	if( m_bScrolling )
	{
		m_fPercentScrolling += fDeltaTime/(float)SCROLL_SPEED_DIVISOR;
		m_fPercentScrolling -= (int)m_fPercentScrolling;

		const RectF *pTextureRect = GetCurrentTextureCoordRect();
 
		float fTexCoords[8] = 
		{
			0+m_fPercentScrolling, pTextureRect->top,		// top left
			0+m_fPercentScrolling, pTextureRect->bottom,	// bottom left
			1+m_fPercentScrolling, pTextureRect->bottom,	// bottom right
			1+m_fPercentScrolling, pTextureRect->top,		// top right
		};
		Sprite::SetCustomTextureCoords( fTexCoords );
	}
}
Пример #3
0
void Banner::Update(float fDeltaTime)
{
    Sprite::Update(fDeltaTime);

    if (m_bScrolling)
    {
        m_fPercentScrolling += fDeltaTime / 2;
        m_fPercentScrolling -= (int)m_fPercentScrolling;

        const RectF* pTextureRect = GetCurrentTextureCoordRect();

        float fTexCoords[8] =
        {
            0 + m_fPercentScrolling, pTextureRect->top,
            0 + m_fPercentScrolling, pTextureRect->bottom,
            1 + m_fPercentScrolling, pTextureRect->bottom,
            1 + m_fPercentScrolling, pTextureRect->top,
        };
        Sprite::SetCustomTextureCoords(fTexCoords);
    }
}