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


C++ USLuaState::CheckParams方法代码示例

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


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

示例1: _setFrameSize

/**	@name	setFrameSize
	@text	Sets the amount of time it takes for one frame to pass.  This in effect can be used to set the FPS limit of the application by passing (1 / FPS).

	@in		number size			The frame size (how long in seconds it takes for one frame to be rendered).
	@out	nil
*/
int MOAISim::_setFrameSize ( lua_State* L ) {

	USLuaState state ( L );
	if ( !state.CheckParams ( 1, "N" )) return 0;
	
	MOAISim& device = MOAISim::Get ();
	device.mStep = state.GetValue < double >( 1, device.mStep );
	
	return 0;
}
开发者ID:mobilehub,项目名称:moai-beta,代码行数:16,代码来源:MOAISim.cpp

示例2: _areaForRect

/**	@name	areaForRect
	@text	Returns the area for the specified rectangle.

	@in		number x1
	@in		number y1
	@in		number x2
	@in		number y2
	@out	number area			The calculated area.
*/
int MOAICpShape::_areaForRect ( lua_State* L ) {
	USLuaState state ( L );
	if ( !state.CheckParams ( 1, "NNNN" )) return 0;

	USMetaRect < cpFloat > rect = state.GetRect < cpFloat >( 1 );
	rect.Bless ();
	
	lua_pushnumber ( L, rect.Area ());
	return 1;
}
开发者ID:,项目名称:,代码行数:19,代码来源:

示例3: _getScale

/**	@name	getScale
	@text	Returns the default size of this font for use with the MOAITextbox:setTextSize function.

	@in		MOAIFont self
	@out	number size				The default point size of the font.
*/
int MOAIFont::_getScale ( lua_State* L ) {

	USLuaState state ( L );
	if ( !state.CheckParams ( 1, "U" )) return 0;
	
	MOAIFont* self = state.GetLuaObject < MOAIFont >( 1 );
	if ( !self ) return 0;
	
	lua_pushnumber ( state, self->GetScale ());
	return 1;
}
开发者ID:mobilehub,项目名称:moai-beta,代码行数:17,代码来源:MOAIFont.cpp

示例4: _framesToTime

/**	@name	framesToTime
	@text	Converts the number of frames to time passed in seconds.

	@in		number frames		The number of frames.
	@out	number time			The equivilant number of seconds for the specified number of frames.
*/
int MOAISim::_framesToTime ( lua_State* L ) {

	USLuaState state ( L );
	if ( !state.CheckParams ( 1, "N" )) return 0;
	
	float frames = state.GetValue < float >( 1, 0.0f );
	
	MOAISim& device = MOAISim::Get ();
	lua_pushnumber ( state, frames * device.mStep );
	
	return 1;
}
开发者ID:mobilehub,项目名称:moai-beta,代码行数:18,代码来源:MOAISim.cpp

示例5: _timeToFrames

/**	@name	timeToFrames
	@text	Converts the number of time passed in seconds to frames.

	@in		number time			The number of seconds.
	@out	number frames		The equivilant number of frames for the specified number of seconds.
*/
int MOAISim::_timeToFrames ( lua_State* L ) {

	USLuaState state ( L );
	if ( !state.CheckParams ( 1, "N" )) return 0;
	
	float time = state.GetValue < float >( 1, 0.0f );
	
	MOAISim& device = MOAISim::Get ();
	lua_pushnumber ( state, time / device.mStep );
	
	return 0;
}
开发者ID:mobilehub,项目名称:moai-beta,代码行数:18,代码来源:MOAISim.cpp

示例6: _showStyle

/**	@name	showStyle
	@text	Enables of disables drawing of a given debug line style.
	
	@in		number styleID		See MOAIDebugLines class documentation for a list of styles.
	@opt	boolean show		Default value is 'true'
	@out	nil
*/
int MOAIDebugLines::_showStyle ( lua_State* L ) {

	USLuaState state ( L );
	if ( !state.CheckParams ( 1, "N" )) return 0;
	
	u32 styleID		= state.GetValue < u32 >( 1, 0 );
	bool show		= state.GetValue < bool >( 2, true );
	
	MOAIDebugLines::Get ().ShowStyle ( styleID, show );
	
	return 0;
}
开发者ID:,项目名称:,代码行数:19,代码来源:

示例7: _pushRenderPass

/**	@name	pushRenderPass
	@text	Pushes the specified prim onto the render stack.

	@in		MOAIProp2D prop		The viewport of the render prim.
	@out	nil
*/
int MOAISim::_pushRenderPass ( lua_State* L ) {

	USLuaState state ( L );
	if ( !state.CheckParams ( 1, "U" )) return 0;
	
	MOAIProp2D* prop = state.GetLuaObject < MOAIProp2D >( 1 );
	if ( !prop ) return 0;
	
	MOAISim& device = MOAISim::Get ();
	device.PushRenderPass ( prop );
	
	return 0;
}
开发者ID:mobilehub,项目名称:moai-beta,代码行数:19,代码来源:MOAISim.cpp

示例8: _areaForPolygon

/**	@name	areaForCircle
	@text	Returns the area for a polygon.
	
	@in		table vertices Array containg vertex coordinate components ( t[1] = x0, t[2] = y0, t[3] = x1, t[4] = y1... )
	@out	number area
*/ 
int MOAICpShape::_areaForPolygon ( lua_State* L ) {
	USLuaState state ( L );
	if ( !state.CheckParams ( 1, "T" )) return 0;

	cpVect verts [ MAX_POLY_VERTS ];
	int numVerts = MOAICpShape::LoadVerts ( state, 1, verts, MAX_POLY_VERTS );
			
	if ( numVerts && cpPolyValidate ( verts, numVerts )) {
		cpFloat area = cpAreaForPoly ( numVerts, verts );
		area = area < 0 ? -area : area;
		lua_pushnumber ( L, area );
		return 1;
	}
	return 0;
}
开发者ID:,项目名称:,代码行数:21,代码来源:

示例9: _serializeToString

/**	@name	serializeToString
	@text	Serializes the specified table or userdata to a string.  Useful for sending data to a remote server.

	@in		MOAISerializer self
	@opt	table data				The table data to serialize.
	@opt	userdata data			The userdata (object) to serialize.  You must provide either a table or userdata, but not both.
	@out	string serialized		The serialized string.
*/
int MOAISerializer::_serializeToString ( lua_State* L ) {

	USLuaState state ( L );
	if ( !state.CheckParams ( 1, "U" )) return 0;
	if ( !( state.IsType ( 1, LUA_TTABLE ) || state.IsType ( 1, LUA_TUSERDATA ))) return 0;

	USLuaSerializer serializer;
	serializer.Affirm ( state, 1 );
	serializer.AddLuaReturn ( state, 1 );
	STLString result = serializer.SerializeToString ();

	lua_pushstring ( state, result );

	return 1;
}
开发者ID:mobilehub,项目名称:moai-beta,代码行数:23,代码来源:MOAISerializer.cpp

示例10: _areaForSegment

/**	@name	areaForSegment
	@text	Returns the area for the specified segment.

	@in		number x1
	@in		number y1
	@in		number x2
	@in		number y2
	@in		number r
	@out	number area			The calculated area.
*/
int MOAICpShape::_areaForSegment ( lua_State* L ) {
	USLuaState state ( L );
	if ( !state.CheckParams ( 1, "UUNNNN" )) return 0;
	
	cpVect a;
	a.x = state.GetValue < cpFloat >( 1, 0 );
	a.y = state.GetValue < cpFloat >( 2, 0 );
	
	cpVect b;
	b.x = state.GetValue < cpFloat >( 3, 0 );
	b.y = state.GetValue < cpFloat >( 4, 0 );

	cpFloat r = state.GetValue < cpFloat >( 5, 0 );

	lua_pushnumber ( L, cpAreaForSegment ( a, b, r ));
	return 1;
}
开发者ID:,项目名称:,代码行数:27,代码来源:

示例11: _openWindow

/**	@name	openWindow
	@text	Opens a new window for the application to render on.  This must be called before any rendering can be done, and it must only be called once.

	@in		string title		The title of the window.
	@in		number width		The width of the window in pixels.
	@in		number height		The height of the window in pixels.
	@out	nil
*/
int MOAISim::_openWindow ( lua_State* L ) {
	
	USLuaState state ( L );
	if ( !state.CheckParams ( 1, "SNN" )) return 0;
	
	cc8* title = lua_tostring ( state, 1 );
	u32 width = state.GetValue < u32 >( 2, 320 );
	u32 height = state.GetValue < u32 >( 3, 480 );
	
	USGfxDevice::Get ().SetSize ( width, height );

	AKUOpenWindowFunc openWindow = AKUGetFunc_OpenWindow ();
	if ( openWindow ) {
		openWindow ( title, width, height );
	}

	return 0;
}
开发者ID:mobilehub,项目名称:moai-beta,代码行数:26,代码来源:MOAISim.cpp

示例12: _setStyle

/**	@name	setStyle
	@text	Sets the particulars of a given debug line style.
	
	@in		number styleID		See MOAIDebugLines class documentation for a list of styles.
	@opt	number size			Pen size (in pixels) for the style. Default value is 1.
	@opt	number r			Red component of line color. Default value is 1.
	@opt	number g			Green component of line color. Default value is 1.
	@opt	number b			Blue component of line color. Default value is 1.
	@opt	number a			Alpha component of line color. Default value is 1.
	@out	nil
*/
int MOAIDebugLines::_setStyle ( lua_State* L ) {
	
	USLuaState state ( L );
	if ( !state.CheckParams ( 1, "N" )) return 0;
	
	u32 styleID		= state.GetValue < u32 >( 1, 0 );
	u32 size		= state.GetValue < u32 >( 2, 1 );
	float r			= state.GetValue < float >( 3, 1.0f );
	float g			= state.GetValue < float >( 4, 1.0f );
	float b			= state.GetValue < float >( 5, 1.0f );
	float a			= state.GetValue < float >( 6, 1.0f );
	
	u32 color = USColor::PackRGBA ( r, g, b, a );
	
	MOAIDebugLines::Get ().SetStyle ( styleID, size, color );
	
	return 0;
}
开发者ID:,项目名称:,代码行数:29,代码来源:

示例13: _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;
}
开发者ID:,项目名称:,代码行数:42,代码来源:

示例14: _load

/**	@name	load
	@text	Attempts to load glyphs from the specified image file or MOAIDataBuffer containing image data.

	@in		MOAIFont self
	@opt	string filename			A string indicating the path to an image file.
	@opt	MOAIDataBuffer data		A MOAIDataBuffer containing image data.  You must provide either a string or a MOAIDataBuffer, but not both.
	@in		string charCodes		A string which defines the characters found in the font.  For example if A and B are the first letters in the image, the first characters in the string would be "AB" and so forth.
	@out	nil
*/
int MOAIFont::_load ( lua_State* L ) {

	USLuaState state ( L );
	if ( !state.CheckParams ( 1, "U" )) return 0;
	
	MOAIFont* self = state.GetLuaObject < MOAIFont >( 1 );
	if ( !self ) return 0;

	STLString charCodes = state.GetValue ( 3, "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.,?!" );

	MOAIDataBuffer *data = state.GetLuaObject < MOAIDataBuffer >( 2 );
	if ( data ) {

		self->LoadFont ( *data, charCodes );
	}
	else {

		STLString imageFile = state.GetValue ( 2, "" );
		self->LoadFont ( imageFile, charCodes );
	}

	return 0;
}
开发者ID:mobilehub,项目名称:moai-beta,代码行数:32,代码来源:MOAIFont.cpp


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