예제 #1
0
/**	@name	getRoot
	@text	Returns the current root action.

	@out	MOAIAction root
*/
int MOAIActionMgr::_getRoot ( lua_State* L ) {
	
	USLuaState state ( L );
	
	MOAIAction* root = MOAIActionMgr::Get ().AffirmRoot ();
	root->PushLuaUserdata ( state );

	return 1;
}
예제 #2
0
/**	@name	currentThread
	@text	Returns the currently running thread (if any).
	
	@out	MOAICoroutine currentThread	Current thread or nil.
*/
int MOAICoroutine::_currentThread ( lua_State* L ) {
	MOAILuaState state ( L );

	MOAIAction* current = MOAIActionMgr::Get ().GetCurrentAction ();
	if ( !current ) return 0;
	
	current->PushLuaUserdata ( state );
	return 1;
}
예제 #3
0
/**	@name	blockOnAction
	@text	Skip updating current thread until the specified action is
			no longer busy. A little more efficient than spinlocking from
			Lua.

	@in		MOAIAction blocker
	@out	nil
*/
int MOAICoroutine::_blockOnAction ( lua_State* L ) {
	MOAILuaState state ( L );
	if ( !state.CheckParams ( 1, "U" )) return 0;

	MOAIAction* current = MOAIActionMgr::Get ().GetCurrentAction ();
	if ( !current ) return 0;
	
	MOAIAction* blocker = state.GetLuaObject < MOAIAction >( 1, true );
	if ( !blocker || !blocker->IsBusy ()) return 0;
	
	current->SetBlocker ( blocker );
	
	return lua_yield ( state, 0 );
}
예제 #4
0
//----------------------------------------------------------------//
void MOAIActionMgr::Update ( float step ) {

	MOAIAction* root = this->mRoot;

	if ( root ) {

		this->GetNextPass ();
		
		for ( this->mPass = 0; this->mPass < this->mTotalPasses; ++this->mPass ) {
			root->Update ( step, this->mPass, true );
		}

		this->mPass = RESET_PASS;
		this->mCurrentAction = 0;
	}
}
예제 #5
0
//----------------------------------------------------------------//
void MOAIActionMgr::StartAction ( MOAIAction& action ) {

	MOAIAction* root = this->AffirmRoot ();
	root->AddChild ( action );
}