本文整理汇总了C++中USLuaState::GetTop方法的典型用法代码示例。如果您正苦于以下问题:C++ USLuaState::GetTop方法的具体用法?C++ USLuaState::GetTop怎么用?C++ USLuaState::GetTop使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类USLuaState
的用法示例。
在下文中一共展示了USLuaState::GetTop方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetRef
//----------------------------------------------------------------//
void USLuaRef::SetRef ( USLuaState& state, int idx, bool weak ) {
this->Clear ();
this->mWeak = weak;
int top = state.GetTop ();
if ( lua_isnil ( state, idx ) == false ) {
USLuaRuntime& luaRuntime = USLuaRuntime::Get ();
if ( weak ) {
this->mRef = luaRuntime.mWeakRefTable.Ref ( state, idx );
}
else {
this->mRef = luaRuntime.mStrongRefTable.Ref ( state, idx );
}
this->mOwnsRef = true;
}
assert ( top == state.GetTop ());
}
示例2: _setClearColor
/** @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).
@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
*/
int MOAISim::_setClearColor ( lua_State* L ) {
USLuaState state ( L );
MOAISim& sim = MOAISim::Get ();
if ( state.GetTop () == 0 ) {
sim.mClearFlags &= ~GL_COLOR_BUFFER_BIT;
}
else {
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 );
sim.mClearColor = USColor::PackRGBA ( r, g, b, a );
sim.mClearFlags |= GL_COLOR_BUFFER_BIT;
}
return 0;
}
示例3: _areaForCircle
SUPPRESS_EMPTY_FILE_WARNING
#if USE_CHIPMUNK
//================================================================//
// local
//================================================================//
//----------------------------------------------------------------//
/** @name areaForCircle
@text Returns the area for a ring or circle.
@overload
@in number radius
@out number area
@overload
@in number innerRadius
@in number outerRadius
@out number area
*/
int MOAICpShape::_areaForCircle ( lua_State* L ) {
USLuaState state ( L );
if ( !state.CheckParams ( 1, "N" )) return 0;
cpFloat r1;
cpFloat r2;
if ( state.GetTop () >= 2 ) {
r1 = state.GetValue < cpFloat >( 1, 0 );
r2 = state.GetValue < cpFloat >( 2, 0 );
}
else {
r1 = 0;
r2 = state.GetValue < cpFloat >( 1, 0 );
}
lua_pushnumber ( L, cpAreaForCircle ( r1, r2 ));
return 1;
}
示例4: DrawLuaParams
//----------------------------------------------------------------//
void MOAIDraw::DrawLuaParams ( lua_State* L, u32 primType ) {
MOAIGfxDevice& gfxDevice = MOAIGfxDevice::Get ();
USLuaState state ( L );
u32 total = state.GetTop () >> 1;
gfxDevice.BeginPrim ( primType );
for ( u32 i = 0; i < total; ++i ) {
u32 idx = ( i << 1 ) + 1;
float x = state.GetValue < float >( idx, 0.0f );
float y = state.GetValue < float >( idx + 1, 0.0f );
gfxDevice.WriteVtx ( x, y );
gfxDevice.WritePenColor4b ();
}
gfxDevice.EndPrim ();
}