当前位置: 首页>>代码示例>>C++>>正文


C++ MOAILuaState::GetFieldWithType方法代码示例

本文整理汇总了C++中MOAILuaState::GetFieldWithType方法的典型用法代码示例。如果您正苦于以下问题:C++ MOAILuaState::GetFieldWithType方法的具体用法?C++ MOAILuaState::GetFieldWithType怎么用?C++ MOAILuaState::GetFieldWithType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MOAILuaState的用法示例。


在下文中一共展示了MOAILuaState::GetFieldWithType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: SerializeIn

//----------------------------------------------------------------//
void MOAIGlyph::SerializeIn ( MOAILuaState& state ) {

    this->mCode			= state.GetField ( -1, "mCode", this->mCode );
    this->mPageID		= state.GetField ( -1, "mPageID", this->mPageID );

    this->mWidth		= state.GetField ( -1, "mWidth", this->mWidth );
    this->mHeight		= state.GetField ( -1, "mHeight", this->mHeight );
    this->mAdvanceX		= state.GetField ( -1, "mAdvanceX", this->mAdvanceX );
    this->mBearingX		= state.GetField ( -1, "mBearingX", this->mBearingX );
    this->mBearingY		= state.GetField ( -1, "mBearingY", this->mBearingY );

    this->mSrcX			= state.GetField ( -1, "mSrcX", this->mSrcX );
    this->mSrcY			= state.GetField ( -1, "mSrcY", this->mSrcY );

    if ( state.GetFieldWithType ( -1, "mKernTable", LUA_TTABLE )) {

        u32 size = lua_objlen ( state, -1 );
        this->mKernTable.Init ( size );

        for ( u32 i = 0; i < size; ++i ) {

            if ( state.GetFieldWithType ( -1, i + 1, LUA_TTABLE )) {

                this->mKernTable [ i ].mName = state.GetField ( -1, "mName", 0 );
                this->mKernTable [ i ].mX = state.GetField ( -1, "mX", 0.0f );
                this->mKernTable [ i ].mY = state.GetField ( -1, "mY", 0.0f );
            }
            state.Pop ( 1 );
        }
        state.Pop ( 1 );
    }
}
开发者ID:,项目名称:,代码行数:33,代码来源:

示例2: SerializeIn

//----------------------------------------------------------------//
void MOAIGlyphSet::SerializeIn ( MOAILuaState& state ) {
	UNUSED ( state );
	
	this->mSize		= state.GetField ( -1, "mSize", this->mSize );
	this->mHeight	= state.GetField ( -1, "mHeight", this->mHeight );
	this->mAscent	= state.GetField ( -1, "mAscent", this->mAscent );

	if ( state.GetFieldWithType ( -1, "mGlyphMap", LUA_TTABLE )) {

		u32 itr = state.PushTableItr ( -1 );
		while ( state.TableItrNext ( itr )) {
			u32 c = state.GetValue < u32 >( -2, 0 );
			MOAIGlyph& glyph = this->mGlyphMap [ c ];
			glyph.SerializeIn ( state );
		}
		state.Pop ( 1 );
	}
	
	GlyphMapIt glyphMapIt = this->mGlyphMap.begin ();
	for ( ; glyphMapIt != this->mGlyphMap.end (); ++glyphMapIt ) {
		MOAIGlyph& glyph = glyphMapIt->second;
		
		if ( glyph.mPageID == MOAIGlyph::NULL_PAGE_ID ) {
			glyph.mNext = this->mPending;
			this->mPending = &glyph;
		}
		else {
			glyph.mNext = this->mGlyphs;
			this->mGlyphs = &glyph;
		}
	}
}
开发者ID:Inzaghi2012,项目名称:moai-dev,代码行数:33,代码来源:MOAIGlyphSet.cpp


注:本文中的MOAILuaState::GetFieldWithType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。