本文整理汇总了C++中MOAILuaState类的典型用法代码示例。如果您正苦于以下问题:C++ MOAILuaState类的具体用法?C++ MOAILuaState怎么用?C++ MOAILuaState使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MOAILuaState类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: state
int MOAIFmodEventMgr::_playEvent2D ( lua_State* L ) {
MOAILuaState state ( L );
cc8* eventName = state.GetValue < cc8* > ( 1, "" );
if ( eventName[0] != '\0' ) {
const FMODDesigner::Event* pEvent = MOAIFmodEventMgr::Get().GetEvent( eventName );
if ( !pEvent )
{
FMODDesigner::Event actualEvent = FMODDesigner::Event( STLString( eventName ) );
MOAIFmodEventMgr::Get().AddEvent( eventName, actualEvent );
pEvent = MOAIFmodEventMgr::Get().GetEvent( eventName );
}
if ( pEvent->IsValid() ) {
bool bLoop = state.GetValue( 2, false );
// Try to play the sound
FMODDesigner::EventHandle hEventHandle = FMODDesigner::tEventManager.PlayEvent2D( *pEvent, bLoop );
// Create a MOAI Event Instance and push it out
MOAIFmodEventInstance* pEventInstance = new MOAIFmodEventInstance();
pEventInstance->SetEventInstance( hEventHandle );
pEventInstance->PushLuaUserdata ( state );
return 1;
}
}
return 0;
}
示例2: state
/** @name getMaxTextureUnits
@text Returns the frame buffer associated with the device.
@out MOAIFrameBuffer frameBuffer
*/
int MOAIGfxDevice::_getFrameBuffer ( lua_State* L ) {
MOAILuaState state ( L );
state.Push ( MOAIGfxDevice::Get ().GetDefaultBuffer ());
return 1;
}
示例3: state
int GIIHelper::_stepSim( lua_State *L ){
MOAILuaState state (L);
if ( !state.CheckParams ( 1, "N" )) return 0;
double step = state.GetValue< double >( 1, 0.0f );
GIIHelper::Get().stepSim( step );
return 0;
}
示例4: RegisterLuaClass
//----------------------------------------------------------------//
void MOAIFacebookAndroid::RegisterLuaClass ( MOAILuaState& state ) {
state.SetField ( -1, "DIALOG_DID_COMPLETE", ( u32 ) DIALOG_DID_COMPLETE );
state.SetField ( -1, "DIALOG_DID_NOT_COMPLETE", ( u32 ) DIALOG_DID_NOT_COMPLETE );
state.SetField ( -1, "SESSION_DID_LOGIN", ( u32 ) SESSION_DID_LOGIN );
state.SetField ( -1, "SESSION_DID_NOT_LOGIN", ( u32 ) SESSION_DID_NOT_LOGIN );
luaL_Reg regTable [] = {
{ "getExpirationDate", _getExpirationDate },
{ "getToken", _getToken },
{ "graphRequest", _graphRequest },
{ "init", _init },
{ "login", _login },
{ "logout", _logout },
{ "postToFeed", _postToFeed },
{ "sendRequest", _sendRequest },
{ "sessionValid", _sessionValid },
{ "setListener", _setListener },
{ "setToken", _setToken },
{ "extendToken", _extendToken },
{ "setExpirationDate", _setExpirationDate },
{ NULL, NULL }
};
luaL_register ( state, 0, regTable );
}
示例5: state
/**
* Create a jobjectArray from the Lua stack
* @param lua_state The lua Stack
* @param index The index to convert
*/
jobjectArray JniUtils::arrayFromLua ( lua_State* L, int index ) {
MOAILuaState state ( L );
JNI_GET_ENV ( jvm, env );
int numEntries = 0;
for ( int key = 1; ; ++key ) {
state.GetField ( 1, key );
cc8* value = JniUtils::parseLuaTable ( state, -1 );
lua_pop ( state, 1 );
if ( !value ) {
numEntries = key - 1;
break;
}
}
jobjectArray array = env->NewObjectArray ( numEntries, env->FindClass( "java/lang/String" ), 0 );
for ( int key = 1; ; ++key ) {
state.GetField ( 1, key );
cc8* value = JniUtils::parseLuaTable ( state, -1 );
lua_pop ( state, 1 );
if ( value ) {
JNI_GET_JSTRING ( value, jvalue );
env->SetObjectArrayElement ( array, key - 1, jvalue );
}
else {
break;
}
}
return array;
}
示例6: AffirmMemberID
//----------------------------------------------------------------//
uintptr MOAISerializer::AffirmMemberID ( MOAILuaState& state, int idx ) {
// if we're an object, affirm as such...
if ( state.IsType ( idx, LUA_TUSERDATA )) {
return this->AffirmMemberID ( state.GetLuaObject < MOAILuaObject >( -1 ));
}
// bail if we're not a table
if ( !state.IsType ( idx, LUA_TTABLE )) return 0;
// get the table's address
uintptr memberID = ( uintptr )lua_topointer ( state, idx );
// bail if the table's already been added
if ( this->mTableMap.contains ( memberID )) return memberID;
// add the ref now to avoid cycles
this->mTableMap [ memberID ].SetStrongRef ( state, idx );
// follow the table's refs to make sure everything gets added
u32 itr = state.PushTableItr ( idx );
while ( state.TableItrNext ( itr )) {
this->AffirmMemberID ( state, -1 );
}
return memberID;
}
示例7: off
/** @name setClearColor
@text At the start of each frame the device will by default automatically render a background color. Using this function you can set the background color that is drawn each frame. If you specify no arguments to this function, then automatic redraw of the background color will be turned off (i.e. the previous render will be used as the background).
@overload
@opt number red The red value of the color.
@opt number green The green value of the color.
@opt number blue The blue value of the color.
@opt number alpha The alpha value of the color.
@out nil
@overload
@in MOAIColor color
@out nil
*/
int MOAIGfxDevice::_setClearColor ( lua_State* L ) {
MOAILuaState state ( L );
MOAIGfxDevice& device = MOAIGfxDevice::Get ();
MOAIColor* color = state.GetLuaObject < MOAIColor >( 1 );
if ( color ) {
device.SetClearColor ( color );
device.mClearFlags |= GL_COLOR_BUFFER_BIT;
return 0;
}
// don't clear the color
device.mClearFlags &= ~GL_COLOR_BUFFER_BIT;
device.SetClearColor ( 0 );
if ( state.GetTop () > 0 ) {
float r = state.GetValue < float >( 1, 0.0f );
float g = state.GetValue < float >( 2, 0.0f );
float b = state.GetValue < float >( 3, 0.0f );
float a = state.GetValue < float >( 4, 1.0f );
device.mClearColor = USColor::PackRGBA ( r, g, b, a );
device.mClearFlags |= GL_COLOR_BUFFER_BIT;
}
return 0;
}
示例8: state
//----------------------------------------------------------------//
void MOAILogMgr::LogVar ( lua_State *L, u32 messageID, va_list args ) {
if ( this->mLevel ) {
MessageMapIt messageMapIt = this->mMessageMap.find ( messageID );
if ( messageMapIt != this->mMessageMap.end ()) {
MOAILogMessage& message = messageMapIt->second;
if ( message.mLevel <= this->mLevel ) {
if ( L ) {
this->Print ( "----------------------------------------------------------------\n" );
}
this->PrintVar ( message.mFormatString, args );
this->Print ( "\n" );
if ( L ) {
MOAILuaState state ( L );
state.PrintStackTrace ( this->mFile, 0 );
this->Print ( "\n" );
}
}
}
}
}
示例9: RegisterLuaClass
//----------------------------------------------------------------//
void MOAIApp::RegisterLuaClass ( MOAILuaState& state ) {
state.SetField ( -1, "PAYMENT_QUEUE_TRANSACTION", ( u32 )PAYMENT_QUEUE_TRANSACTION );
state.SetField ( -1, "PAYMENT_QUEUE_ERROR", ( u32 )PAYMENT_QUEUE_ERROR );
state.SetField ( -1, "PRODUCT_REQUEST_RESPONSE", ( u32 )PRODUCT_REQUEST_RESPONSE );
state.SetField ( -1, "DOMAIN_DOCUMENTS", ( u32 )DOMAIN_DOCUMENTS );
state.SetField ( -1, "DOMAIN_APP_SUPPORT", ( u32 )DOMAIN_APP_SUPPORT );
state.SetField ( -1, "TRANSACTION_STATE_PURCHASING",( u32 )TRANSACTION_STATE_PURCHASING );
state.SetField ( -1, "TRANSACTION_STATE_PURCHASED", ( u32 )TRANSACTION_STATE_PURCHASED );
state.SetField ( -1, "TRANSACTION_STATE_FAILED", ( u32 )TRANSACTION_STATE_FAILED );
state.SetField ( -1, "TRANSACTION_STATE_RESTORED", ( u32 )TRANSACTION_STATE_RESTORED );
state.SetField ( -1, "TRANSACTION_STATE_CANCELLED", ( u32 )TRANSACTION_STATE_CANCELLED );
luaL_Reg regTable[] = {
{ "alert", _alert },
{ "canMakePayments", _canMakePayments },
{ "restoreCompletedTransactions", _restoreCompletedTransactions },
{ "requestPaymentForProduct", _requestPaymentForProduct },
{ "requestProductIdentifiers", _requestProductIdentifiers },
{ "setListener", _setListener },
{ "getDirectoryInDomain", _getDirectoryInDomain },
{ "openURL", _openURL },
{ "openURLPOP", _openURLPOP },
{ NULL, NULL }
};
luaL_register( state, 0, regTable );
}
示例10: SerializeIn
//----------------------------------------------------------------//
void MOAIMesh::SerializeIn ( MOAILuaState& state, MOAIDeserializer& serializer ) {
MOAIVertexArray::SerializeIn ( state, serializer );
this->SetIndexBuffer ( serializer.MemberIDToObject < MOAIIndexBuffer >( state.GetField < MOAISerializer::ObjID >( -1, "mIndexBuffer", 0 )));
this->mTotalElements = state.GetField < u32 >( -1, "mTotalElements", 0 );
this->mHasBounds = state.GetField < bool >( -1, "mHasBounds", 0 );
if ( state.GetFieldWithType ( -1, "mBounds", LUA_TTABLE )) {
this->mBounds.mMin.mX = state.GetField < float >( -1, "mMinX", 0 );
this->mBounds.mMin.mY = state.GetField < float >( -1, "mMinY", 0 );
this->mBounds.mMin.mZ = state.GetField < float >( -1, "mMinZ", 0 );
this->mBounds.mMax.mX = state.GetField < float >( -1, "mMaxX", 0 );
this->mBounds.mMax.mY = state.GetField < float >( -1, "mMaxY", 0 );
this->mBounds.mMax.mZ = state.GetField < float >( -1, "mMaxZ", 0 );
state.Pop ();
}
this->mPenWidth = state.GetField < float >( -1, "mPenWidth", 0 );
}
示例11: RegisterLuaClass
//----------------------------------------------------------------//
void MOAIParticleForce::RegisterLuaClass ( MOAILuaState& state ) {
this->MOAITransform::RegisterLuaClass ( state );
state.SetField ( -1, "FORCE", ( u32 )FORCE );
state.SetField ( -1, "GRAVITY", ( u32 )GRAVITY );
state.SetField ( -1, "OFFSET", ( u32 )OFFSET );
}
示例12: state
//----------------------------------------------------------------//
int MOAILuaRuntime::_debugCall ( lua_State* L ) {
MOAILuaState state ( L );
state.DebugCall ( 0, 0 );
return 0;
}
示例13: state
//----------------------------------------------------------------//
// TODO: doxygen
int MOAIVertexFormatMgr::_getFormat ( lua_State* L ) {
MOAILuaState state ( L );
u32 formatID = state.GetValue < u32 >( 1, 0xffffffff );
state.Push ( MOAIVertexFormatMgr::Get ().GetFormat ( formatID ));
return 1;
}
示例14: RegisterLuaClass
//----------------------------------------------------------------//
void MOAIVertexFormat::RegisterLuaClass ( MOAILuaState& state ) {
state.SetField ( -1, "GL_BYTE", ( u32 )ZGL_TYPE_BYTE );
//state.SetField ( -1, "GL_FIXED", ( u32 )GL_FIXED );
state.SetField ( -1, "GL_FLOAT", ( u32 )ZGL_TYPE_FLOAT );
state.SetField ( -1, "GL_SHORT", ( u32 )ZGL_TYPE_SHORT );
state.SetField ( -1, "GL_UNSIGNED_BYTE", ( u32 )ZGL_TYPE_UNSIGNED_BYTE );
state.SetField ( -1, "GL_UNSIGNED_SHORT", ( u32 )ZGL_TYPE_UNSIGNED_SHORT );
}
示例15: RegisterLuaClass
//----------------------------------------------------------------//
void MOAIAnimCurve::RegisterLuaClass ( MOAILuaState& state ) {
state.SetField ( -1, "ATTR_TIME", MOAIAnimCurveAttr::Pack ( ATTR_TIME ));
state.SetField ( -1, "ATTR_VALUE", MOAIAnimCurveAttr::Pack ( ATTR_VALUE ));
state.SetField ( -1, "CLAMP", ( u32 ) CLAMP );
state.SetField ( -1, "WRAP", ( u32 ) WRAP );
state.SetField ( -1, "MIRROR", ( u32 ) MIRROR );
state.SetField ( -1, "APPEND", ( u32 ) APPEND );
}