Set ItemIndex for each item in an ActorScroller, so commands
can use it.
This commit is contained in:
@@ -6,6 +6,7 @@
|
|||||||
#include "arch/Dialog/Dialog.h"
|
#include "arch/Dialog/Dialog.h"
|
||||||
#include "RageLog.h"
|
#include "RageLog.h"
|
||||||
#include "ActorUtil.h"
|
#include "ActorUtil.h"
|
||||||
|
#include "LuaBinding.h"
|
||||||
|
|
||||||
/* Tricky: We need ActorFrames created in XML to auto delete their children.
|
/* Tricky: We need ActorFrames created in XML 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
|
||||||
@@ -45,6 +46,14 @@ void ActorScroller::Load2(
|
|||||||
m_fNumItemsToDraw = fNumItemsToDraw;
|
m_fNumItemsToDraw = fNumItemsToDraw;
|
||||||
m_bLoop = bLoop;
|
m_bLoop = bLoop;
|
||||||
m_iNumItems = m_SubActors.size();
|
m_iNumItems = m_SubActors.size();
|
||||||
|
|
||||||
|
Lua *L = LUA->Get();
|
||||||
|
for( unsigned i = 0; i < m_SubActors.size(); ++i )
|
||||||
|
{
|
||||||
|
lua_pushnumber( L, i );
|
||||||
|
this->m_SubActors[i]->m_pLuaInstance->Set( L, "ItemIndex" );
|
||||||
|
}
|
||||||
|
LUA->Release( L );
|
||||||
}
|
}
|
||||||
|
|
||||||
void ActorScroller::SetTransformFromExpression( const CString &sTransformFunction )
|
void ActorScroller::SetTransformFromExpression( const CString &sTransformFunction )
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#include "LuaManager.h"
|
#include "LuaManager.h"
|
||||||
#include "ActorUtil.h"
|
#include "ActorUtil.h"
|
||||||
#include "RageUtil.h"
|
#include "RageUtil.h"
|
||||||
|
#include "LuaBinding.h"
|
||||||
|
|
||||||
Actor *DynamicActorScroller::Copy() const { return new DynamicActorScroller(*this); }
|
Actor *DynamicActorScroller::Copy() const { return new DynamicActorScroller(*this); }
|
||||||
|
|
||||||
@@ -98,6 +99,13 @@ void DynamicActorScroller::ShiftSubActors( int iDist )
|
|||||||
else if( iIndex < 0 || iIndex >= m_iNumItems || iItem < 0 || iItem >= m_iNumItems )
|
else if( iIndex < 0 || iIndex >= m_iNumItems || iItem < 0 || iItem >= m_iNumItems )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
{
|
||||||
|
Lua *L = LUA->Get();
|
||||||
|
lua_pushnumber( L, i );
|
||||||
|
m_SubActors[iIndex]->m_pLuaInstance->Set( L, "ItemIndex" );
|
||||||
|
LUA->Release(L);
|
||||||
|
}
|
||||||
|
|
||||||
ConfigureActor( m_SubActors[iIndex], iItem );
|
ConfigureActor( m_SubActors[iIndex], iItem );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user