Example #1
0
void MOAISim::ShouldPause () {

	MOAILuaStateHandle state = MOAILuaRuntime::Get ().State ();
	if ( this->PushListener ( EVENT_WILL_PAUSE, state )) {
		state.DebugCall ( 0, 0 );
	}
}
Example #2
0
//----------------------------------------------------------------//
void MOAISim::SendResumeEvent () {

	MOAILuaStateHandle state = MOAILuaRuntime::Get ().State ();
	if ( this->PushListener ( EVENT_RESUME, state )) {
		state.DebugCall ( 0, 0 );
	}
}
Example #3
0
//----------------------------------------------------------------//
void MOAISim::SendFinalizeEvent () {

	MOAILuaStateHandle state = MOAILuaRuntime::Get ().State ();
	if ( this->PushListener ( EVENT_FINALIZE, state )) {
		state.DebugCall ( 0, 0 );
	}
}
Example #4
0
//----------------------------------------------------------------//
void MOAISim::PauseMOAI () {

	MOAILuaStateHandle state = MOAILuaRuntime::Get ().State ();
	if ( this->PushListener ( EVENT_PAUSED, state )) {
		state.DebugCall ( 0, 0 );
	}

	this->mLoopState = PAUSED;
}
Example #5
0
//----------------------------------------------------------------//
void MOAIApp::WillEndSession( ) {
	MOAILuaRef& callback = this->mListeners [ SESSION_END ];
	
	if ( callback ) {
		MOAILuaStateHandle state = callback.GetSelf ();
		
		state.DebugCall ( 0, 0 );
	}
}
Example #6
0
//----------------------------------------------------------------//
void AKURunString ( const char* script ) {

	int status;
	MOAILuaStateHandle state = MOAILuaRuntime::Get ().State ();
	
	status = luaL_loadstring ( state, script );
	if ( state.PrintErrors ( USLog::CONSOLE, status )) return;
	
	state.DebugCall ( 0, 0 );
}
Example #7
0
//----------------------------------------------------------------//
void MOAIApp::NotifyDialogDismissed ( int dialogResult ) {

	if ( ! mDialogCallback.IsNil() ) {
		MOAILuaStateHandle state = mDialogCallback.GetSelf ();
		
		state.Push ( dialogResult );
		state.DebugCall ( 1, 0 );
		
		mDialogCallback.Clear();
	}
}
Example #8
0
//----------------------------------------------------------------//
void MOAIApp::NotifyRestoreResponseReceived ( int code ) {
	MOAILuaRef& callback = this->mListeners [ RESTORE_RESPONSE_RECEIVED ];
	
	if ( callback ) {
		MOAILuaStateHandle state = callback.GetSelf ();

		lua_pushinteger ( state, code );	
		
		state.DebugCall ( 1, 0 );
	}
}
Example #9
0
//----------------------------------------------------------------//
void MOAIApp::NotifyBillingSupported ( bool supported ) {	
	MOAILuaRef& callback = this->mListeners [ CHECK_BILLING_SUPPORTED ];
	
	if ( callback ) {
		MOAILuaStateHandle state = callback.GetSelf ();
		
		lua_pushboolean ( state, supported );
			
		state.DebugCall ( 1, 0 );
	}
}
Example #10
0
//----------------------------------------------------------------//
void MOAIChartBoostAndroid::NotifyInterstitialDismissed () {	
	
	MOAILuaRef& callback = this->mListeners [ INTERSTITIAL_DISMISSED ];
	
	if ( callback ) {
		
		MOAILuaStateHandle state = callback.GetSelf ();
		
		state.DebugCall ( 0, 0 );
	}
}
Example #11
0
//----------------------------------------------------------------//
void MOAIApp::NotifyDialogDismissed ( int code ) {
	MOAILuaRef& callback = this->mListeners [ DIALOG_DISMISSED ];
	
	if ( callback ) {
		MOAILuaStateHandle state = callback.GetSelf ();

		lua_pushinteger ( state, code );	
		
		state.DebugCall ( 1, 0 );
	}
}
Example #12
0
//----------------------------------------------------------------//
void MOAIChartBoostAndroid::NotifyInterstitialLoadFailed () {	
	
	MOAILuaRef& callback = this->mListeners [ INTERSTITIAL_LOAD_FAILED ];
	
	if ( callback ) {
		
		MOAILuaStateHandle state = callback.GetSelf ();
		
		state.DebugCall ( 0, 0 );
	}
}
Example #13
0
//----------------------------------------------------------------//
void MOAIApp::NotifyPurchaseResponseReceived ( cc8* identifier, int code ) {
	MOAILuaRef& callback = this->mListeners [ PURCHASE_RESPONSE_RECEIVED ];
	
	if ( callback ) {
		MOAILuaStateHandle state = callback.GetSelf ();
		
		lua_pushstring ( state, identifier );
		lua_pushinteger ( state, code );	
		
		state.DebugCall ( 2, 0 );
	}
}
//----------------------------------------------------------------//
void MOAIJoystickSensor::HandleEvent ( USStream& eventStream ) {

	this->mX = eventStream.Read < float >( 0.0f );
	this->mY = eventStream.Read < float >( 0.0f );
	
	if ( this->mOnStick ) {
		MOAILuaStateHandle state = this->mOnStick.GetSelf ();
		lua_pushnumber ( state, this->mX );
		lua_pushnumber ( state, this->mY );
		state.DebugCall ( 2, 0 );
	}
}
Example #15
0
//----------------------------------------------------------------//
void AKURunScript ( const char* filename ) {

	if ( !USFileSys::CheckFileExists ( filename )) return;

	int status;
	MOAILuaStateHandle state = MOAILuaRuntime::Get ().State ();
	
	status = luaL_loadfile ( state, filename );
	if ( state.PrintErrors ( USLog::CONSOLE, status )) return;
	
	state.DebugCall ( 0, 0 );
}
Example #16
0
//----------------------------------------------------------------//
void MOAIScriptNode::OnDepNodeUpdate () {

	if ( this->mOnUpdate ) {
		
		MOAILuaStateHandle state = MOAILuaRuntime::Get ().State ();
		
		this->PushLocal ( state, this->mOnUpdate );
		this->PushLuaUserdata ( state );

		state.DebugCall ( 1, 0 );
	}
}
Example #17
0
//----------------------------------------------------------------//
void MOAISim::ResumeMOAI() {

	if ( this->mLoopState == PAUSED ) {
		this->mLoopState = START;

		MOAILuaStateHandle state = MOAILuaRuntime::Get ().State ();
		if ( this->PushListener ( EVENT_RESUMED, state )) {
			state.DebugCall ( 0, 0 );
		}
	}

}
Example #18
0
//----------------------------------------------------------------//
void MOAIGfxDevice::SetSize ( u32 width, u32 height ) {

	this->mWidth = width;
	this->mHeight = height;
	
	MOAILuaStateHandle state = MOAILuaRuntime::Get ().State ();
	if ( this->PushListener ( EVENT_RESIZE, state )) {
		lua_pushnumber ( state, width );
		lua_pushnumber ( state, height );
		state.DebugCall ( 2, 0 );
	}
}
Example #19
0
//----------------------------------------------------------------//
void MOAIAppAndroid::NotifyDidStartSession ( bool resumed ) {

	MOAILuaRef& callback = this->mListeners [ SESSION_START ];
	
	if ( callback ) {
		
		MOAILuaStateHandle state = callback.GetSelf ();

		lua_pushboolean ( state, resumed );
			
		state.DebugCall ( 1, 0 );
	}
}
//----------------------------------------------------------------//
void MOAITstoreWallAndroid::NotifyCurrencyAwarded ( int amount ) {
	
	MOAILuaRef& callback = this->mListeners [ TSTORE_CURRENCY_AWARDED ];
	
	if ( callback ) {
		
		MOAILuaStateHandle state = callback.GetSelf ();
		
		lua_pushinteger ( state, amount );
		
		state.DebugCall ( 1, 0 );
	}
}
//----------------------------------------------------------------//
void MOAIDialogAndroid::NotifyDialogDismissed ( int dialogResult ) {

	if ( !mDialogCallback.IsNil ()) {
		
		MOAILuaStateHandle state = mDialogCallback.GetSelf ();

		lua_pushinteger ( state, dialogResult );
		
		state.DebugCall ( 1, 0 );
		
		mDialogCallback.Clear ();
	}
}
Example #22
0
//----------------------------------------------------------------//
bool MOAIApp::NotifyBackButtonPressed () {
	MOAILuaRef& callback = this->mListeners [ BACK_BUTTON_PRESSED ];
	
	if ( callback ) {
		MOAILuaStateHandle state = callback.GetSelf ();

		state.DebugCall ( 0, 1 );

		return lua_toboolean ( state, -1 );
	} else {
		return false;
	}
}
Example #23
0
//----------------------------------------------------------------//
void MOAIDataIOTask::Publish () {

	if ( this->mInflateOnLoad && ( !this->mInflateOnTaskThread )) {
		this->mData->Inflate ( this->mWindowBits );
	}

	if ( this->mOnFinish ) {
	
		MOAILuaStateHandle state = MOAILuaRuntime::Get ().State ();
		this->PushLocal ( state, this->mOnFinish );
		this->mData->PushLuaUserdata ( state );
		state.DebugCall ( 1, 0 );
	}
}
Example #24
0
//----------------------------------------------------------------//
void MOAIFacebookAndroid::NotifyDialogComplete ( int code ) {
	
	MOAILuaRef& callback = this->mListeners [ DIALOG_DID_NOT_COMPLETE ];
	if ( code == DIALOG_RESULT_SUCCESS ) {
		
		callback = this->mListeners [ DIALOG_DID_COMPLETE ];
	}

	if ( callback ) {
	
		MOAILuaStateHandle state = callback.GetSelf ();
	
		state.DebugCall ( 0, 0 );
	}
}
//----------------------------------------------------------------//
void MOAIPointerSensor::HandleEvent ( ZLStream& eventStream ) {

	int x = eventStream.Read < int >( 0 );
	int y = eventStream.Read < int >( 0 );

	this->mX = x;
	this->mY = y;
	
	if ( this->mOnMove ) {
		MOAILuaStateHandle state = this->mOnMove.GetSelf ();
		lua_pushnumber ( state, this->mX );
		lua_pushnumber ( state, this->mY );
		state.DebugCall ( 2, 0 );
	}
}
Example #26
0
//----------------------------------------------------------------//
void MOAIApp::NotifyPurchaseStateChanged ( cc8* identifier, int code, cc8* order, cc8* notification, cc8* payload ) {
	MOAILuaRef& callback = this->mListeners [ PURCHASE_STATE_CHANGED ];
	
	if ( callback ) {
		MOAILuaStateHandle state = callback.GetSelf ();
		
		lua_pushstring ( state, identifier );
		lua_pushinteger ( state, code );	
		lua_pushstring ( state, order );
		lua_pushstring ( state, notification );
		lua_pushstring ( state, payload );
		
		state.DebugCall ( 5, 0 );
	}
}
Example #27
0
//----------------------------------------------------------------//
void MOAIFacebookAndroid::NotifyLoginComplete ( int code ) {

	MOAILuaRef& callback = this->mListeners [ SESSION_DID_NOT_LOGIN ];
	if ( code == DIALOG_RESULT_SUCCESS ) {
		
		callback = this->mListeners [ SESSION_DID_LOGIN ];
	}

	if ( callback ) {
	
		MOAILuaStateHandle state = callback.GetSelf ();
	
		state.DebugCall ( 0, 0 );
	}
}
Example #28
0
//----------------------------------------------------------------//
cc8* MOAILuaObject::GetLuaClassName () {

	MOAILuaStateHandle state = MOAILuaRuntime::Get ().State ();
	cc8* classname = this->TypeName ();
	
	if ( this->mMemberTable ) {
		state.Push ( this );
		lua_getfield ( state, -1, "getClassName" );
		
		if ( state.IsType ( -1, LUA_TFUNCTION )) {
			lua_pushvalue ( state, -2 );
			state.DebugCall ( 1, 1 );
			classname = state.GetValue < cc8* >( -1, "" );
		}
	}
	return classname;
}
Example #29
0
//----------------------------------------------------------------//
void MOAIButtonSensor::HandleEvent ( USStream& eventStream ) {

	bool down = eventStream.Read < bool >();
	
	if ( down ) {
		this->mState |= IS_DOWN | DOWN;
	}
	else {
		this->mState &= ~IS_DOWN;
		this->mState |= UP;
	}
	
	if ( this->mOnButton ) {
		MOAILuaStateHandle state = this->mOnButton.GetSelf ();
		lua_pushboolean ( state, down );
		state.DebugCall ( 1, 0 );
	}
}
Example #30
0
//----------------------------------------------------------------//
void AKUSetViewSize ( int width, int height ) {
	
	MOAIGfxDevice& device = MOAIGfxDevice::Get ();
	
	u32 currentWidth = device.GetWidth ();
	u32 currentHeight = device.GetHeight ();
	
	if (( currentWidth != ( u32 )width ) || ( currentHeight != ( u32 )height )) {
	
		MOAIGfxDevice::Get ().SetBufferSize ( width, height );
		
		MOAILuaStateHandle state = MOAILuaRuntime::Get ().State ();
		if ( device.PushListener ( MOAIGfxDevice::EVENT_RESIZE, state )) {
			lua_pushnumber ( state, width );
			lua_pushnumber ( state, height );
			state.DebugCall ( 2, 0 );
		}
	}
}