don't access the low-level texture unnecessarily
This commit is contained in:
@@ -52,7 +52,7 @@ void Banner::Update( float fDeltaTime )
|
|||||||
m_fPercentScrolling += fDeltaTime/2;
|
m_fPercentScrolling += fDeltaTime/2;
|
||||||
m_fPercentScrolling -= (int)m_fPercentScrolling;
|
m_fPercentScrolling -= (int)m_fPercentScrolling;
|
||||||
|
|
||||||
const RectF *pTextureRect = GetTexture()->GetTextureCoordRect(0);
|
const RectF *pTextureRect = GetCurrentTextureCoordRect();
|
||||||
|
|
||||||
float fTexCoords[8] =
|
float fTexCoords[8] =
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -29,8 +29,8 @@ void CourseEntryDisplay::Load()
|
|||||||
SET_XY_AND_ON_COMMAND( &m_sprFrame );
|
SET_XY_AND_ON_COMMAND( &m_sprFrame );
|
||||||
this->AddChild( &m_sprFrame );
|
this->AddChild( &m_sprFrame );
|
||||||
|
|
||||||
this->m_size.x = (float) m_sprFrame.GetTexture()->GetSourceFrameWidth();
|
this->m_size.x = m_sprFrame.GetUnzoomedWidth();
|
||||||
this->m_size.y = (float) m_sprFrame.GetTexture()->GetSourceFrameHeight();
|
this->m_size.y = m_sprFrame.GetUnzoomedHeight();
|
||||||
|
|
||||||
m_textNumber.SetName( "Number" );
|
m_textNumber.SetName( "Number" );
|
||||||
m_textNumber.LoadFromFont( THEME->GetPathF("CourseEntryDisplay","number") );
|
m_textNumber.LoadFromFont( THEME->GetPathF("CourseEntryDisplay","number") );
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ void GradeDisplay::Scroll()
|
|||||||
|
|
||||||
int iFrameNo = GetFrameIndex( m_PlayerNumber, m_Grade );
|
int iFrameNo = GetFrameIndex( m_PlayerNumber, m_Grade );
|
||||||
|
|
||||||
m_frectDestTexCoords = *GetTexture()->GetTextureCoordRect( iFrameNo );
|
m_frectDestTexCoords = *GetTextureCoordRectForState( iFrameNo );
|
||||||
m_frectStartTexCoords = m_frectDestTexCoords;
|
m_frectStartTexCoords = m_frectDestTexCoords;
|
||||||
m_frectStartTexCoords.top += GRADES_TO_SCROLL * GRADE_FRAME_HEIGHT;
|
m_frectStartTexCoords.top += GRADES_TO_SCROLL * GRADE_FRAME_HEIGHT;
|
||||||
m_frectStartTexCoords.bottom += GRADES_TO_SCROLL * GRADE_FRAME_HEIGHT;
|
m_frectStartTexCoords.bottom += GRADES_TO_SCROLL * GRADE_FRAME_HEIGHT;
|
||||||
|
|||||||
@@ -787,11 +787,15 @@ void Sprite::SetCustomImageCoords( float fImageCoords[8] ) // order: top left, b
|
|||||||
|
|
||||||
const RectF *Sprite::GetCurrentTextureCoordRect() const
|
const RectF *Sprite::GetCurrentTextureCoordRect() const
|
||||||
{
|
{
|
||||||
ASSERT_M( m_iCurState < (int) m_States.size(), ssprintf("%d, %d", int(m_iCurState), int(m_States.size())) );
|
return GetTextureCoordRectForState( m_iCurState );
|
||||||
|
|
||||||
return &m_States[m_iCurState].rect;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const RectF *Sprite::GetTextureCoordRectForState( int iState ) const
|
||||||
|
{
|
||||||
|
ASSERT_M( iState < (int) m_States.size(), ssprintf("%d, %d", int(iState), int(m_States.size())) );
|
||||||
|
|
||||||
|
return &m_States[iState].rect;
|
||||||
|
}
|
||||||
|
|
||||||
/* If we're using custom coordinates, return them; otherwise return the coordinates
|
/* If we're using custom coordinates, return them; otherwise return the coordinates
|
||||||
* for the current state. */
|
* for the current state. */
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ public:
|
|||||||
void SetCustomImageRect( RectF rectImageCoords ); // in image pixel space
|
void SetCustomImageRect( RectF rectImageCoords ); // in image pixel space
|
||||||
void SetCustomImageCoords( float fImageCoords[8] );
|
void SetCustomImageCoords( float fImageCoords[8] );
|
||||||
const RectF *GetCurrentTextureCoordRect() const;
|
const RectF *GetCurrentTextureCoordRect() const;
|
||||||
|
const RectF *GetTextureCoordRectForState( int iState ) const;
|
||||||
void StopUsingCustomCoords();
|
void StopUsingCustomCoords();
|
||||||
void GetActiveTextureCoords(float fTexCoordsOut[8]) const;
|
void GetActiveTextureCoords(float fTexCoordsOut[8]) const;
|
||||||
void StretchTexCoords( float fX, float fY );
|
void StretchTexCoords( float fX, float fY );
|
||||||
|
|||||||
Reference in New Issue
Block a user