mirror of
https://github.com/smallmain/cocos-enhance-kit.git
synced 2025-01-14 06:51:08 +00:00
193 lines
14 KiB
YAML
193 lines
14 KiB
YAML
definitions:
|
|
# the names of the functions - we use this to generate the code and to register the functions in
|
|
# the javascript class
|
|
ifunction: "js_${generator.prefix}_${class_name}_${func_name}"
|
|
sfunction: "js_${generator.prefix}_${class_name}_${func_name}"
|
|
constructor: "js_${generator.prefix}_${class_name}_constructor"
|
|
ctor: "js_${generator.prefix}_${class_name}_ctor"
|
|
public_field: "js_${generator.prefix}_${class_name}"
|
|
conversions:
|
|
# some times you want to use a special native type when converting from spidermonkey to native
|
|
# the most common case would be from JS-boolean to bool. Using "bool" will fail here since we
|
|
# pass the address to the conversion method, and a JSBool is defined as an integer in spidermonkey
|
|
native_types:
|
|
# float: "double"
|
|
short: "int16_t"
|
|
"unsigned char": "uint8_t"
|
|
"char": "int8_t"
|
|
ns_map:
|
|
"cocos2d::extension::": "cc."
|
|
"cocos2d::ui::": "ccui."
|
|
"cocos2d::": "cc."
|
|
"spine::": "sp."
|
|
"cocostudio::": "ccs."
|
|
"cocosbuilder::": "cc."
|
|
"CocosDenshion::": "cc."
|
|
to_native:
|
|
# jsval to int
|
|
int32_t: "ok &= seval_to_int32(${in_value}, (int32_t*)&${out_value})"
|
|
# int: "ok &= seval_to_int32(${in_value}, (int32_t*)&${out_value})"
|
|
int: "do { int32_t tmp = 0; ok &= seval_to_int32(${in_value}, &tmp); ${out_value} = (${arg_type})tmp; } while(false)"
|
|
"unsigned int": "ok &= seval_to_uint32(${in_value}, (uint32_t*)&${out_value})"
|
|
"unsigned char": "ok &= seval_to_uint8(${in_value}, (uint8_t*)&${out_value})"
|
|
short: "ok &= seval_to_int16(${in_value}, &${out_value})"
|
|
"unsigned short": "ok &= seval_to_uint16(${in_value}, &${out_value})"
|
|
char: "ok &= seval_to_int8(${in_value}, (int8_t*)&${out_value})"
|
|
bool: "ok &= seval_to_boolean(${in_value}, &${out_value})"
|
|
float: "ok &= seval_to_float(${in_value}, &${out_value})"
|
|
double: "ok &= seval_to_double(${in_value}, &${out_value})"
|
|
long: "ok &= seval_to_long(${in_value}, &${out_value})"
|
|
"unsigned long": "ok &= seval_to_ulong(${in_value}, &${out_value})"
|
|
"ssize_t": "ok &= seval_to_ssize(${in_value}, &${out_value})"
|
|
"size_t": "ok &= seval_to_size(${in_value}, &${out_value})"
|
|
# jsval has to be a TypedArray, a UInt32Array with 2 elements
|
|
"long long": "ok &= seval_to_longlong(${in_value}, &${out_value})"
|
|
"string": "ok &= seval_to_std_string(${in_value}, &${out_value})"
|
|
"char*": "std::string ${out_value}_tmp; ok &= seval_to_std_string(${in_value}, &${out_value}_tmp); ${out_value} = ${out_value}_tmp.c_str()"
|
|
"Point": "ok &= seval_to_Vec2(${in_value}, &${out_value})"
|
|
"Rect": "ok &= seval_to_Rect(${in_value}, &${out_value})"
|
|
"Size": "ok &= seval_to_Size(${in_value}, &${out_value})"
|
|
"Color4B": "ok &= seval_to_Color4B(${in_value}, &${out_value})"
|
|
"Color4F": "ok &= seval_to_Color4F(${in_value}, &${out_value})"
|
|
"Color3B": "ok &= seval_to_Color3B(${in_value}, &${out_value})"
|
|
"Color3F": "ok &= seval_to_Color3F(${in_value}, &${out_value})"
|
|
# "Array*": "ok &= seval_to_ccarray(${in_value}, &${out_value})"
|
|
# "Dictionary*": "ok &= seval_to_ccdictionary(${in_value}, &${out_value})"
|
|
"AffineTransform": "ok &= seval_to_AffineTransform(${in_value}, &${out_value})"
|
|
"FontDefinition": "ok &= seval_to_FontDefinition(${in_value}, &${out_value})"
|
|
"String*": "std::string ${out_value}_tmp; ok &= seval_to_std_string(${in_value}, &${out_value}_tmp); ${out_value} = cocos2d::String::create(${out_value}_tmp)"
|
|
"@Vector<.*>": "ok &= seval_to_Vector(${in_value}, &${out_value})"
|
|
"@Map<std::string.*>": "ok &= seval_to_Map_string_key(${in_value}, &${out_value})"
|
|
"@map<std::string.*,\\s*std::string.*>": "ok &= seval_to_std_map_string_string(${in_value}, &${out_value})"
|
|
"Value": "ok &= seval_to_ccvalue(${in_value}, &${out_value})"
|
|
"ValueMap": "ok &= seval_to_ccvaluemap(${in_value}, &${out_value})"
|
|
"ValueMapIntKey": "ok &= seval_to_ccvaluemapintkey(${in_value}, &${out_value})"
|
|
"ValueVector": "ok &= seval_to_ccvaluevector(${in_value}, &${out_value})"
|
|
"@vector<std::string.*>": "ok &= seval_to_std_vector_string(${in_value}, &${out_value})"
|
|
"@vector<int.*>": "ok &= seval_to_std_vector_int(${in_value}, &${out_value})"
|
|
"@vector<float.*>": "ok &= seval_to_std_vector_float(${in_value}, &${out_value})"
|
|
"@vector<.*Texture.*>": "ok &= seval_to_std_vector_Texture(${in_value}, &${out_value})"
|
|
"@vector<.*RenderTarget.*>": "ok &= seval_to_std_vector_RenderTarget(${in_value}, &${out_value})"
|
|
"vector<std::unordered_map<std::string, cocos2d::Value>>": "ok &= seval_to_EffectDefineTemplate(${in_value}, &${out_value})"
|
|
"unordered_map<std::string, cocos2d::renderer::Technique::Parameter>": "ok &= seval_to_EffectProperty(${in_value}, &${out_value})"
|
|
"Acceleration": "ok &= seval_to_Acceleration(${in_value}, &${out_value})"
|
|
"Parameter": "ok &= seval_to_TechniqueParameter(${in_value}, &${out_value})"
|
|
"vector<cocos2d::renderer::Technique::Parameter>": "ok &= seval_to_std_vector_TechniqueParameter(${in_value}, &${out_value})"
|
|
"vector<cocos2d::renderer::ProgramLib::Template>": "ok &= seval_to_std_vector_ProgramLib_Template(${in_value}, &${out_value})"
|
|
"Mat4": "ok &= seval_to_Mat4(${in_value}, &${out_value})"
|
|
"Vec2": "ok &= seval_to_Vec2(${in_value}, &${out_value})"
|
|
"Vec3": "ok &= seval_to_Vec3(${in_value}, &${out_value})"
|
|
"Vec2*": "std::vector<cocos2d::Vec2> tempData;ok &= seval_to_std_vector_Vec2(${in_value}, &tempData);${out_value}=tempData.data()"
|
|
"BlendFunc": "ok &= seval_to_blendfunc(${in_value}, &${out_value})"
|
|
"_ttfConfig": "ok &= seval_to_TTFConfig(${in_value}, &${out_value})"
|
|
"TTFConfig": "ok &= seval_to_TTFConfig(${in_value}, &${out_value})"
|
|
# "AnimationInfo": "ok &= seval_to_animationInfo(${in_value}, &${out_value})"
|
|
"Quaternion": "ok &= seval_to_Quaternion(${in_value}, &${out_value})"
|
|
# "Ray": "ok &= seval_to_ray(${in_value}, &${out_value})"
|
|
# "NavMeshAgentParam": "ok &= seval_to_NavMeshAgentParam(${in_value}, &${out_value})"
|
|
# "Physics3DRigidBodyDes*": "cocos2d::Physics3DRigidBodyDes tempObj;${out_value}=&tempObj;ok &= seval_to_physics3DRigidBodyDes(${in_value}, ${out_value})"
|
|
# "TerrainData": "ok &= seval_to_TerrainData(${in_value}, &${out_value})"
|
|
"TMXTileFlags_": "ok &= seval_to_uint32(${in_value}, (uint32_t *)&${out_value})"
|
|
"TMXTileFlags_*": "uint32_t tempData;${out_value}=(cocos2d::TMXTileFlags_*)&tempData;ok &= seval_to_uint32(${in_value}, (uint32_t *)&${out_value})"
|
|
"ResourceData": "ok &= seval_to_ResourceData(${in_value}, &${out_value})"
|
|
"ListenerID": "ok &= seval_to_std_string(${in_value}, &${out_value})"
|
|
"DownloaderHints": "ok &= seval_to_DownloaderHints(${in_value}, &${out_value})"
|
|
"Viewport": "ok &= seval_to_Viewport(${in_value}, &${out_value})"
|
|
"Data": "ok &= seval_to_Data(${in_value}, &${out_value})"
|
|
"b2Vec2": "ok &= seval_to_b2Vec2(${in_value}, &${out_value})"
|
|
"b2AABB": "ok &= seval_to_b2AABB(${in_value}, &${out_value})"
|
|
"Options": "ok &= seval_to_TextureOptions(${in_value}, &${out_value})"
|
|
"SubImageOption": "ok &= seval_to_TextureSubImageOption(${in_value}, &${out_value})"
|
|
"ImageOption": "ok &= seval_to_TextureImageOption(${in_value}, &${out_value})"
|
|
"String": "${out_value} = ${in_value}.toStringForce().c_str()"
|
|
"@Vector<spine::String.*>": "ok &= seval_to_spine_Vector_String(${in_value}, &${out_value})"
|
|
"@Vector<spine::((?!String).)*>": "ok &= seval_to_spine_Vector_T_ptr(${in_value}, &${out_value})"
|
|
"se_object_ptr": "${out_value} = ${in_value}.toObject()"
|
|
object: "ok &= seval_to_native_ptr(${in_value}, &${out_value})"
|
|
|
|
from_native:
|
|
# int to jsval
|
|
int32_t: "ok &= int32_to_seval(${in_value}, &${out_value})"
|
|
int: "ok &= int32_to_seval(${in_value}, &${out_value})"
|
|
enum: "ok &= int32_to_seval(${in_value}, &${out_value})"
|
|
"unsigned int": "ok &= uint32_to_seval(${in_value}, &${out_value})"
|
|
"unsigned short": "ok &= int16_to_seval(${in_value}, &${out_value})"
|
|
"unsigned char": "ok &= uint8_to_seval(${in_value}, &${out_value})"
|
|
"char": "ok &= int8_to_seval(${in_value}, &${out_value})"
|
|
"long long": "ok &= longlong_to_seval(${in_value}, &${out_value})"
|
|
"string": "ok &= std_string_to_seval(${in_value}, &${out_value})"
|
|
"string&": "ok &= std_string_to_seval(${in_value}, &${out_value})"
|
|
"char*": "ok &= std_string_to_seval(${in_value}, &${out_value})"
|
|
bool: "ok &= boolean_to_seval(${in_value}, &${out_value})"
|
|
float: "ok &= float_to_seval(${in_value}, &${out_value})"
|
|
double: "ok &= double_to_seval(${in_value}, &${out_value})"
|
|
long: "ok &= long_to_seval(${in_value}, &${out_value})"
|
|
"unsigned long": "ok &= ulong_to_seval(${in_value}, &${out_value})"
|
|
"ssize_t": "ok &= ssize_to_seval(${in_value}, &${out_value})"
|
|
"ssize_t": "ok &= size_to_seval(${in_value}, &${out_value})"
|
|
"Point": "ok &= Vec2_to_seval(${in_value}, &${out_value})"
|
|
"Rect": "ok &= Rect_to_seval(${in_value}, &${out_value})"
|
|
"Size": "ok &= Size_to_seval(${in_value}, &${out_value})"
|
|
"Color4B": "ok &= Color4B_to_seval(${in_value}, &${out_value})"
|
|
"Color4F": "ok &= Color4F_to_seval(${in_value}, &${out_value})"
|
|
"Color3B": "ok &= Color3B_to_seval(${in_value}, &${out_value})"
|
|
"Color3F": "ok &= Color3F_to_seval(${in_value}, &${out_value})"
|
|
# "Array*": "${out_value} = ccarray_to_seval(${in_value})"
|
|
# "Dictionary*": "${out_value} = ccdictionary_to_seval(${in_value})"
|
|
"AffineTransform": "ok &= AffineTransform_to_seval(${in_value}, &${out_value})"
|
|
"FontDefinition": "ok &= FontDefinition_to_seval(${in_value}, &${out_value})"
|
|
# "String*": "${out_value} = std_string_to_seval(${in_value}->getCString())"
|
|
"@Vector<.*>": "ok &= Vector_to_seval(${in_value}, &${out_value})"
|
|
"@Map<std::string.*>": "ok &= Map_string_key_to_seval(${in_value}, &${out_value})"
|
|
"@map<std::string.*,\\s*std::string.*>": "ok &= std_map_string_string_to_seval(${in_value}, &${out_value})"
|
|
"Value": "ok &= ccvalue_to_seval(${in_value}, &${out_value})"
|
|
"ValueMap": "ok &= ccvaluemap_to_seval(${in_value}, &${out_value})"
|
|
"ValueMapIntKey": "ok &= ccvaluemapintkey_to_seval(${in_value}, &${out_value})"
|
|
"ValueVector": "ok &= ccvaluevector_to_seval(${in_value}, &${out_value})"
|
|
"@vector<std::string.*>": "ok &= std_vector_string_to_seval(${in_value}, &${out_value})"
|
|
"@vector<int.*>": "ok &= std_vector_int_to_seval(${in_value}, &${out_value})"
|
|
"@vector<float.*>": "ok &= std_vector_float_to_seval(${in_value}, &${out_value})"
|
|
"@vector<.*Touch.*>": "ok &= std_vector_Touch_to_seval(${in_value}, &${out_value})"
|
|
"@vector<.*RenderTarget.*>": "ok &= std_vector_RenderTarget_to_seval(${in_value}, &${out_value})"
|
|
"Acceleration*": "ok &= Acceleration_to_seval(${in_value}, &${out_value})"
|
|
"Parameter": "ok &= TechniqueParameter_to_seval(${in_value}, &${out_value})"
|
|
"vector<cocos2d::renderer::Technique::Parameter>": "ok &= std_vector_TechniqueParameter_to_seval(${in_value}, &${out_value})"
|
|
"Mat4": "ok &= Mat4_to_seval(${in_value}, &${out_value})"
|
|
"Vec2": "ok &= Vec2_to_seval(${in_value}, &${out_value})"
|
|
"Vec3": "ok &= Vec3_to_seval(${in_value}, &${out_value})"
|
|
"Vec4": "ok &= Vec4_to_seval(${in_value}, &${out_value})"
|
|
"BlendFunc": "ok &= blendfunc_to_seval(${in_value}, &${out_value})"
|
|
"Quaternion": "ok &= Quaternion_to_seval(${in_value}, &${out_value})"
|
|
"spEventData*": "ok &= speventdata_to_seval(${in_value}, &${out_value})"
|
|
"spEvent*": "ok &= spevent_to_seval(${in_value}, &${out_value})"
|
|
"spBoneData*": "ok &= spbonedata_to_seval(${in_value}, &${out_value})"
|
|
"spBone*": "ok &= spbone_to_seval(${in_value}, &${out_value})"
|
|
"spSkeleton*": "ok &= spskeleton_to_seval(${in_value}, &${out_value})"
|
|
"spAttachment*": "ok &= spattachment_to_seval(${in_value}, &${out_value})"
|
|
"spSlotData*": "ok &= spslotdata_to_seval(${in_value}, &${out_value})"
|
|
"spSlot*": "ok &= spslot_to_seval(${in_value}, &${out_value})"
|
|
"spTimeline*": "ok &= sptimeline_to_seval(${in_value}, &${out_value})"
|
|
"spAnimationState*": "ok &= spanimationstate_to_seval(${in_value}, &${out_value})"
|
|
"spAnimation*": "ok &= spanimation_to_seval(${in_value}, &${out_value})"
|
|
"spTrackEntry*": "ok &= sptrackentry_to_seval(${in_value}, &${out_value})"
|
|
# "OffMeshLinkData": "${out_value} = offMeshLinkData_to_seval(${in_value})"
|
|
"TouchEventType": "ok &= int32_to_seval((int32_t)${in_value}, &${out_value})"
|
|
"EventType": "ok &= int32_to_seval((int32_t)${in_value}, &${out_value})"
|
|
"ManifestAsset": "ok &= ManifestAsset_to_seval(${in_value}, &${out_value})"
|
|
"@DownloadTask.*": "ok &= DownloadTask_to_seval(${in_value}, &${out_value})"
|
|
"@shared_ptr<.*DownloadTask.*": "ok &= DownloadTask_to_seval(*${in_value}, &${out_value})"
|
|
"Viewport": "ok &= Viewport_to_seval(${in_value}, &${out_value})"
|
|
"Data": "ok &= Data_to_seval(${in_value}, &${out_value})"
|
|
"b2Vec2": "ok &= b2Vec2_to_seval(${in_value}, &${out_value})"
|
|
"b2Manifold*": "ok &= b2Manifold_to_seval(${in_value}, &${out_value})"
|
|
"b2AABB": "ok &= b2AABB_to_seval(${in_value}, &${out_value})"
|
|
"VertexFormat": "ok &= VertexFormat_to_seval(${in_value}, &${out_value})"
|
|
"se_object_ptr": "${out_value}.setObject(${in_value})"
|
|
"String": "${out_value}.setString(${in_value}.buffer())"
|
|
"@(?:\\bBoneData\\b|\\bSkeleton\\b|\\bColor\\b|\\bEventData\\b|\\bIkConstraintData\\b|\\bPathConstraintData\\b|\\bTransformConstraintData\\b|\\bBone\\b|\\bSlotData\\b)+(?!\\*)+": "ok &= native_ptr_to_rooted_seval<${ntype.replace('const ', '').replace('&', '')}>((${ntype.replace('const ', '').replace('&', '')}*)&${in_value}, &${out_value})"
|
|
"@Vector<spine::((?!String).)*>": "ok &= spine_Vector_T_ptr_to_seval(${in_value}, &${out_value})"
|
|
"@Vector<.*(\\bshort\\b|\\bfloat\\b)+>": "ok &= spine_Vector_T_to_seval(${in_value}, &${out_value})"
|
|
"@Vector<spine::String.*>": "ok &= spine_Vector_String_to_seval(${in_value}, &${out_value})"
|
|
object: "ok &= native_ptr_to_seval<${ntype.replace('*', '').replace('const ', '')}>((${ntype.replace('const ', '')})${in_value}, &${out_value})"
|
|
rooted_object: "ok &= native_ptr_to_rooted_seval<${ntype.replace('*', '').replace('const ', '')}>((${ntype.replace('const ', '')})${in_value}, &${out_value})"
|