some more cleanup

This commit is contained in:
AJ Kelly
2010-06-26 20:30:27 -05:00
parent b539c24260
commit 5bc8755090
3 changed files with 21 additions and 23 deletions
+10 -12
View File
@@ -10,9 +10,8 @@
/* Tricky: We need ActorFrames created in Lua to auto delete their children. /* Tricky: We need ActorFrames created in Lua to auto delete their children.
* We don't want classes that derive from ActorFrame to auto delete their * We don't want classes that derive from ActorFrame to auto delete their
* children. The name "ActorFrame" is widely used in Lua, so we'll have * children. The name "ActorFrame" is widely used in Lua, so we'll have
* that string instead create an ActorFrameAutoDeleteChildren object. * that string instead create an ActorFrameAutoDeleteChildren object. */
*/
//REGISTER_ACTOR_CLASS( ActorScroller ) //REGISTER_ACTOR_CLASS( ActorScroller )
REGISTER_ACTOR_CLASS_WITH_NAME( ActorScrollerAutoDeleteChildren, ActorScroller ) REGISTER_ACTOR_CLASS_WITH_NAME( ActorScrollerAutoDeleteChildren, ActorScroller )
ActorScroller *ActorScroller::Copy() const { return new ActorScroller(*this); } ActorScroller *ActorScroller::Copy() const { return new ActorScroller(*this); }
@@ -165,7 +164,7 @@ void ActorScroller::UpdateInternal( float fDeltaTime )
{ {
ActorFrame::UpdateInternal( fDeltaTime ); ActorFrame::UpdateInternal( fDeltaTime );
/* If we have no children, the code below will busy loop. */ // If we have no children, the code below will busy loop.
if( !m_SubActors.size() ) if( !m_SubActors.size() )
return; return;
@@ -219,10 +218,8 @@ void ActorScroller::PositionItems()
PositionItemsAndDrawPrimitives( false ); PositionItemsAndDrawPrimitives( false );
} }
/* /* Shift m_SubActors forward by iDist. This will place item m_iFirstSubActorIndex
* Shift m_SubActors forward by iDist. This will place item m_iFirstSubActorIndex * in m_SubActors[0]. */
* in m_SubActors[0].
*/
void ActorScroller::ShiftSubActors( int iDist ) void ActorScroller::ShiftSubActors( int iDist )
{ {
if( iDist != INT_MAX ) if( iDist != INT_MAX )
@@ -264,7 +261,7 @@ void ActorScroller::PositionItemsAndDrawPrimitives( bool bDrawPrimitives )
vector<Actor*> subs; vector<Actor*> subs;
{ {
/* Shift m_SubActors so iFirstItemToDraw is at the beginning. */ // Shift m_SubActors so iFirstItemToDraw is at the beginning.
int iNewFirstIndex = iFirstItemToDraw; int iNewFirstIndex = iFirstItemToDraw;
int iDist = iNewFirstIndex - m_iFirstSubActorIndex; int iDist = iNewFirstIndex - m_iFirstSubActorIndex;
m_iFirstSubActorIndex = iNewFirstIndex; m_iFirstSubActorIndex = iNewFirstIndex;
@@ -282,9 +279,10 @@ void ActorScroller::PositionItemsAndDrawPrimitives( bool bDrawPrimitives )
else if( iIndex < 0 || iIndex >= (int)m_SubActors.size() ) else if( iIndex < 0 || iIndex >= (int)m_SubActors.size() )
continue; continue;
// Optimization: Zero out unused parameters so that they don't create new, unnecessary // Optimization: Zero out unused parameters so that they don't create new,
// entries in the position cache. On scrollers with lots of items, // unnecessary entries in the position cache. On scrollers with lots of
// especially with Subdivisions > 1, m_exprTransformFunction uses too much memory. // items, especially with Subdivisions > 1, m_exprTransformFunction uses
// too much memory.
if( !m_bFunctionDependsOnPositionOffset ) if( !m_bFunctionDependsOnPositionOffset )
fPosition = 0; fPosition = 0;
if( !m_bFunctionDependsOnItemIndex ) if( !m_bFunctionDependsOnItemIndex )
+7 -7
View File
@@ -31,19 +31,19 @@ public:
void LoadFromNode( const XNode *pNode ); void LoadFromNode( const XNode *pNode );
virtual ActorScroller *Copy() const; virtual ActorScroller *Copy() const;
void SetLoop( bool bLoop ) { m_bLoop = bLoop; } void SetLoop( bool bLoop ) { m_bLoop = bLoop; }
void SetNumItemsToDraw( float fNumItemsToDraw ) { m_fNumItemsToDraw = fNumItemsToDraw; } void SetNumItemsToDraw( float fNumItemsToDraw ) { m_fNumItemsToDraw = fNumItemsToDraw; }
void SetDestinationItem( float fItemIndex ) { m_fDestinationItem = fItemIndex; } void SetDestinationItem( float fItemIndex ) { m_fDestinationItem = fItemIndex; }
void SetCurrentAndDestinationItem( float fItemIndex ) { m_fCurrentItem = m_fDestinationItem = fItemIndex; } void SetCurrentAndDestinationItem( float fItemIndex ) { m_fCurrentItem = m_fDestinationItem = fItemIndex; }
float GetCurrentItem() const { return m_fCurrentItem; } float GetCurrentItem() const { return m_fCurrentItem; }
float GetDestinationItem() const { return m_fDestinationItem; } float GetDestinationItem() const { return m_fDestinationItem; }
void ScrollThroughAllItems(); void ScrollThroughAllItems();
void ScrollWithPadding( float fItemPaddingStart, float fItemPaddingEnd ); void ScrollWithPadding( float fItemPaddingStart, float fItemPaddingEnd );
void SetPauseCountdownSeconds( float fSecs ) { m_fPauseCountdownSeconds = fSecs; } void SetPauseCountdownSeconds( float fSecs ) { m_fPauseCountdownSeconds = fSecs; }
void SetFastCatchup( bool bOn ) { m_bFastCatchup = bOn; } void SetFastCatchup( bool bOn ) { m_bFastCatchup = bOn; }
void SetSecondsPerItem( float fSeconds ) { m_fSecondsPerItem = fSeconds; } void SetSecondsPerItem( float fSeconds ) { m_fSecondsPerItem = fSeconds; }
void SetSecondsPauseBetweenItems( float fSeconds ) { m_fSecondsPauseBetweenItems = fSeconds; } void SetSecondsPauseBetweenItems( float fSeconds ) { m_fSecondsPauseBetweenItems = fSeconds; }
void SetNumSubdivisions( int iNumSubdivisions ) { m_exprTransformFunction.SetNumSubdivisions( iNumSubdivisions ); } void SetNumSubdivisions( int iNumSubdivisions ) { m_exprTransformFunction.SetNumSubdivisions( iNumSubdivisions ); }
float GetSecondsForCompleteScrollThrough() const; float GetSecondsForCompleteScrollThrough() const;
float GetSecondsToDestination() const; float GetSecondsToDestination() const;
int GetNumItems() const { return m_iNumItems; } int GetNumItems() const { return m_iNumItems; }