add SpritePolygon binding && js tests

This commit is contained in:
joshuastray 2015-05-11 15:44:36 +08:00
parent 38b0cf7bf1
commit 234f4db8a0
12 changed files with 727 additions and 13 deletions

View File

@ -0,0 +1,253 @@
/****************************************************************************
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2011 Zynga Inc.
Copyright (c) 2013-2014 Chukong Technologies Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include "jsb_cocos2dx_experimental_manual.h"
#include "cocos2d_specifics.hpp"
#include "2d/SpritePolygon.h"
bool jsval_to_vector_vec2(JSContext* cx, JS::HandleValue v, std::vector<cocos2d::Vec2>* ret)
{
JS::RootedObject jsArr(cx);
bool ok = v.isObject() && JS_ValueToObject( cx, v, &jsArr );
JSB_PRECONDITION3( ok, cx, false, "Error converting value to object");
JSB_PRECONDITION3( jsArr && JS_IsArrayObject( cx, jsArr), cx, false, "Object must be an array");
uint32_t len = 0;
JS_GetArrayLength(cx, jsArr, &len);
ret->reserve(len);
for (uint32_t i=0; i < len; i++)
{
JS::RootedValue value(cx);
if (JS_GetElement(cx, jsArr, i, &value))
{
cocos2d::Vec2 vec2;
ok &= jsval_to_vector2(cx, value, &vec2);
ret->push_back(vec2);
}
}
return ok;
}
bool jsval_to_vector_unsigned_short(JSContext* cx, JS::HandleValue v, std::vector<unsigned short>* ret)
{
JS::RootedObject jsArr(cx);
bool ok = v.isObject() && JS_ValueToObject( cx, v, &jsArr );
JSB_PRECONDITION3( ok, cx, false, "Error converting value to object");
JSB_PRECONDITION3( jsArr && JS_IsArrayObject( cx, jsArr), cx, false, "Object must be an array");
uint32_t len = 0;
JS_GetArrayLength(cx, jsArr, &len);
ret->reserve(len);
for (uint32_t i=0; i < len; i++)
{
JS::RootedValue value(cx);
if (JS_GetElement(cx, jsArr, i, &value))
{
unsigned short index;
ok &= jsval_to_uint16(cx, value, &index);
ret->push_back(index);
}
}
return ok;
}
bool jsval_to_cctex2f(JSContext* cx, JS::HandleValue vp, cocos2d::Tex2F* ret)
{
JS::RootedObject tmp(cx);
JS::RootedValue jsx(cx);
JS::RootedValue jsy(cx);
double x, y;
bool ok = vp.isObject() &&
JS_ValueToObject(cx, vp, &tmp) &&
JS_GetProperty(cx, tmp, "x", &jsx) &&
JS_GetProperty(cx, tmp, "y", &jsy) &&
JS::ToNumber(cx, jsx, &x) &&
JS::ToNumber(cx, jsy, &y) &&
!isnan(x) && !isnan(y);
JSB_PRECONDITION3(ok, cx, false, "Error processing arguments");
ret->u = (GLfloat)x;
ret->v = (GLfloat)y;
return true;
}
bool jsval_to_v3fc4bt2f(JSContext* cx, JS::HandleValue v, cocos2d::V3F_C4B_T2F* ret)
{
JS::RootedObject object(cx, v.toObjectOrNull());
cocos2d::Vec3 v3;
cocos2d::Color4B color;
cocos2d::Tex2F t2;
JS::RootedValue jsv3(cx);
JS::RootedValue jscolor(cx);
JS::RootedValue jst2(cx);
bool ok = JS_GetProperty(cx, object, "v3f", &jsv3) &&
JS_GetProperty(cx, object, "c4b", &jscolor) &&
JS_GetProperty(cx, object, "t2f", &jst2) &&
jsval_to_vector3(cx, jsv3, &v3) &&
jsval_to_cccolor4b(cx, jscolor, &color) &&
jsval_to_cctex2f(cx, jst2, &t2);
JSB_PRECONDITION3(ok, cx, false, "Error processing arguments");
ret->vertices = v3;
ret->colors = color;
ret->texCoords = t2;
return true;
}
bool jsval_to_vector_v3fc4bt2f(JSContext* cx, JS::HandleValue v, std::vector<cocos2d::V3F_C4B_T2F>* ret)
{
JS::RootedObject jsArr(cx);
bool ok = v.isObject() && JS_ValueToObject( cx, v, &jsArr );
JSB_PRECONDITION3( ok, cx, false, "Error converting value to object");
JSB_PRECONDITION3( jsArr && JS_IsArrayObject( cx, jsArr), cx, false, "Object must be an array");
uint32_t len = 0;
JS_GetArrayLength(cx, jsArr, &len);
ret->reserve(len);
for (uint32_t i=0; i < len; i++)
{
JS::RootedValue value(cx);
if (JS_GetElement(cx, jsArr, i, &value))
{
cocos2d::V3F_C4B_T2F vert;
ok &= jsval_to_v3fc4bt2f(cx, value, &vert);
ret->push_back(vert);
}
}
return ok;
}
bool js_cocos2dx_SpritePolygon_create(JSContext *cx, uint32_t argc, jsval *vp)
{
if(argc == 1)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
std::string file;
bool ok = jsval_to_std_string(cx, args.get(0), &file);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SpritePolygon_create : Error processing arguments");
auto sprite = cocos2d::experimental::SpritePolygon::create(file);
js_proxy_t *jsProxy = js_get_or_create_proxy<cocos2d::experimental::SpritePolygon>(cx, sprite);
JS::RootedValue ret(cx, OBJECT_TO_JSVAL(jsProxy->obj));
args.rval().set(ret);
return true;
}
if(argc == 2)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
std::string file;
std::vector<cocos2d::Vec2> verts;
bool ok = jsval_to_std_string(cx, args.get(0), &file);
ok &= jsval_to_vector_vec2(cx, args.get(1), &verts);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SpritePolygon_create : Error processing arguments");
auto sprite = cocos2d::experimental::SpritePolygon::create(file, verts);
js_proxy_t *jsProxy = js_get_or_create_proxy<cocos2d::experimental::SpritePolygon>(cx, sprite);
JS::RootedValue ret(cx, OBJECT_TO_JSVAL(jsProxy->obj));
args.rval().set(ret);
return true;
}
if(argc == 3)
{
do
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
std::string file;
std::vector<cocos2d::Vec2> verts;
std::vector<unsigned short> indices;
bool ok = jsval_to_std_string(cx, args.get(0), &file);
ok &= jsval_to_vector_vec2(cx, args.get(1), &verts);
ok &= jsval_to_vector_unsigned_short(cx, args.get(2), &indices);
if(!ok)
break;
auto sprite = cocos2d::experimental::SpritePolygon::create(file, verts, indices);
js_proxy_t *jsProxy = js_get_or_create_proxy<cocos2d::experimental::SpritePolygon>(cx, sprite);
JS::RootedValue ret(cx, OBJECT_TO_JSVAL(jsProxy->obj));
args.rval().set(ret);
return true;
}while (0);
do
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
std::string file;
std::vector<cocos2d::V3F_C4B_T2F> verts;
std::vector<unsigned short> indices;
bool ok = jsval_to_std_string(cx, args.get(0), &file);
ok &= jsval_to_vector_v3fc4bt2f(cx, args.get(1), &verts);
ok &= jsval_to_vector_unsigned_short(cx, args.get(2), &indices);
if(!ok)
break;
auto sprite = cocos2d::experimental::SpritePolygon::create(file, verts, indices);
js_proxy_t *jsProxy = js_get_or_create_proxy<cocos2d::experimental::SpritePolygon>(cx, sprite);
JS::RootedValue ret(cx, OBJECT_TO_JSVAL(jsProxy->obj));
args.rval().set(ret);
return true;
}while(0);
JS_ReportError(cx, "js_cocos2dx_SpritePolygon_create : Error processing arguments");
}
JS_ReportError(cx, "js_cocos2dx_SpritePolygon_create : wrong number of arguments: %d", argc);
return false;
}
void register_all_cocos2dx_experimental_manual(JSContext *cx, JS::HandleObject global)
{
JS::RootedObject ccObj(cx);
get_or_create_js_obj(cx, global, "ccexp", &ccObj);
JS::RootedValue tmpVal(cx);
JS_GetProperty(cx, ccObj, "SpritePolygon", &tmpVal);
JS::RootedObject tmpObj(cx, tmpVal.toObjectOrNull());
JS_DefineFunction(cx, tmpObj, "create", js_cocos2dx_SpritePolygon_create, 1, JSPROP_READONLY | JSPROP_PERMANENT);
}

View File

@ -0,0 +1,35 @@
/****************************************************************************
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2011 Zynga Inc.
Copyright (c) 2013-2014 Chukong Technologies Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#ifndef __jsb_cococs2dx_experimental_h__
#define __jsb_cococs2dx_experimental_h__
#include "jsapi.h"
void register_all_cocos2dx_experimental_manual(JSContext *cx, JS::HandleObject global);
#endif

View File

@ -1445,7 +1445,8 @@ bool jsval_to_vector2(JSContext *cx, JS::HandleValue vp, cocos2d::Vec2* ret)
JS_GetProperty(cx, tmp, "x", &jsx) &&
JS_GetProperty(cx, tmp, "y", &jsy) &&
JS::ToNumber(cx, jsx, &x) &&
JS::ToNumber(cx, jsy, &y);
JS::ToNumber(cx, jsy, &y) &&
!isnan(x) && !isnan(y);
JSB_PRECONDITION3(ok, cx, false, "Error processing arguments");

View File

@ -146,6 +146,14 @@
420BBCF81AA48EE900493976 /* jsb_cocos2dx_3d_manual.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 420BBCF51AA48EE900493976 /* jsb_cocos2dx_3d_manual.cpp */; };
420BBCF91AA48EE900493976 /* jsb_cocos2dx_3d_manual.h in Headers */ = {isa = PBXBuildFile; fileRef = 420BBCF61AA48EE900493976 /* jsb_cocos2dx_3d_manual.h */; };
420BBCFA1AA48EE900493976 /* jsb_cocos2dx_3d_manual.h in Headers */ = {isa = PBXBuildFile; fileRef = 420BBCF61AA48EE900493976 /* jsb_cocos2dx_3d_manual.h */; };
42AD256C1AFF9D1A000176E2 /* jsb_cocos2dx_experimental.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 42AD256A1AFF9D1A000176E2 /* jsb_cocos2dx_experimental.cpp */; };
42AD256D1AFF9D1A000176E2 /* jsb_cocos2dx_experimental.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 42AD256A1AFF9D1A000176E2 /* jsb_cocos2dx_experimental.cpp */; };
42AD256E1AFF9D1A000176E2 /* jsb_cocos2dx_experimental.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 42AD256B1AFF9D1A000176E2 /* jsb_cocos2dx_experimental.hpp */; };
42AD256F1AFF9D1A000176E2 /* jsb_cocos2dx_experimental.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 42AD256B1AFF9D1A000176E2 /* jsb_cocos2dx_experimental.hpp */; };
42AD25731AFF9E17000176E2 /* jsb_cocos2dx_experimental_manual.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 42AD25711AFF9E17000176E2 /* jsb_cocos2dx_experimental_manual.cpp */; };
42AD25741AFF9E17000176E2 /* jsb_cocos2dx_experimental_manual.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 42AD25711AFF9E17000176E2 /* jsb_cocos2dx_experimental_manual.cpp */; };
42AD25751AFF9E17000176E2 /* jsb_cocos2dx_experimental_manual.h in Headers */ = {isa = PBXBuildFile; fileRef = 42AD25721AFF9E17000176E2 /* jsb_cocos2dx_experimental_manual.h */; };
42AD25761AFF9E17000176E2 /* jsb_cocos2dx_experimental_manual.h in Headers */ = {isa = PBXBuildFile; fileRef = 42AD25721AFF9E17000176E2 /* jsb_cocos2dx_experimental_manual.h */; };
83A5661918DA878400FC31A0 /* jsb_socketio.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83A5661718DA878400FC31A0 /* jsb_socketio.cpp */; };
83A5661A18DA878400FC31A0 /* jsb_socketio.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83A5661718DA878400FC31A0 /* jsb_socketio.cpp */; };
83A5661B18DA878400FC31A0 /* jsb_socketio.h in Headers */ = {isa = PBXBuildFile; fileRef = 83A5661818DA878400FC31A0 /* jsb_socketio.h */; };
@ -255,6 +263,10 @@
420BBCEF1AA48EDE00493976 /* jsb_cocos2dx_3d_auto.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = jsb_cocos2dx_3d_auto.hpp; sourceTree = "<group>"; };
420BBCF51AA48EE900493976 /* jsb_cocos2dx_3d_manual.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = jsb_cocos2dx_3d_manual.cpp; sourceTree = "<group>"; };
420BBCF61AA48EE900493976 /* jsb_cocos2dx_3d_manual.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = jsb_cocos2dx_3d_manual.h; sourceTree = "<group>"; };
42AD256A1AFF9D1A000176E2 /* jsb_cocos2dx_experimental.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = jsb_cocos2dx_experimental.cpp; sourceTree = "<group>"; };
42AD256B1AFF9D1A000176E2 /* jsb_cocos2dx_experimental.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = jsb_cocos2dx_experimental.hpp; sourceTree = "<group>"; };
42AD25711AFF9E17000176E2 /* jsb_cocos2dx_experimental_manual.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = jsb_cocos2dx_experimental_manual.cpp; path = experimental/jsb_cocos2dx_experimental_manual.cpp; sourceTree = "<group>"; };
42AD25721AFF9E17000176E2 /* jsb_cocos2dx_experimental_manual.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = jsb_cocos2dx_experimental_manual.h; path = experimental/jsb_cocos2dx_experimental_manual.h; sourceTree = "<group>"; };
83A5661718DA878400FC31A0 /* jsb_socketio.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = jsb_socketio.cpp; sourceTree = "<group>"; };
83A5661818DA878400FC31A0 /* jsb_socketio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = jsb_socketio.h; sourceTree = "<group>"; };
BA4095C01A6F730A005E53F6 /* jsb_cocos2dx_studio_conversions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = jsb_cocos2dx_studio_conversions.cpp; sourceTree = "<group>"; };
@ -322,6 +334,8 @@
1A119E2E18BDF19200352BAA /* auto */ = {
isa = PBXGroup;
children = (
42AD256A1AFF9D1A000176E2 /* jsb_cocos2dx_experimental.cpp */,
42AD256B1AFF9D1A000176E2 /* jsb_cocos2dx_experimental.hpp */,
420BBCEE1AA48EDE00493976 /* jsb_cocos2dx_3d_auto.cpp */,
420BBCEF1AA48EDE00493976 /* jsb_cocos2dx_3d_auto.hpp */,
BAEE4D6F1AC3FFAD003BEB0F /* jsb_cocos2dx_3d_extension_auto.cpp */,
@ -348,6 +362,7 @@
1A119E4118BDF19200352BAA /* manual */ = {
isa = PBXGroup;
children = (
42AD25701AFF9DFC000176E2 /* experimental */,
420BBCF41AA48EE900493976 /* 3d */,
0541A74C1973876100E45470 /* ios */,
1A119E4218BDF19200352BAA /* chipmunk */,
@ -523,6 +538,15 @@
path = 3d;
sourceTree = "<group>";
};
42AD25701AFF9DFC000176E2 /* experimental */ = {
isa = PBXGroup;
children = (
42AD25711AFF9E17000176E2 /* jsb_cocos2dx_experimental_manual.cpp */,
42AD25721AFF9E17000176E2 /* jsb_cocos2dx_experimental_manual.h */,
);
name = experimental;
sourceTree = "<group>";
};
BA623DFB191A192700761F37 /* pluginx */ = {
isa = PBXGroup;
children = (
@ -575,8 +599,10 @@
1A119EEF18BDF19200352BAA /* js_bindings_system_functions.h in Headers */,
1A119EDD18BDF19200352BAA /* js_manual_conversions.h in Headers */,
1A119EFD18BDF19200352BAA /* XMLHTTPRequest.h in Headers */,
42AD25751AFF9E17000176E2 /* jsb_cocos2dx_experimental_manual.h in Headers */,
1AB5E63518D05BF30088DAA4 /* jsb_cocos2dx_ui_manual.h in Headers */,
1A119EE318BDF19200352BAA /* jsb_opengl_functions.h in Headers */,
42AD256E1AFF9D1A000176E2 /* jsb_cocos2dx_experimental.hpp in Headers */,
0541A74F1973876100E45470 /* JavaScriptObjCBridge.h in Headers */,
1AB5E62D18D05BC80088DAA4 /* jsb_cocos2dx_ui_auto.hpp in Headers */,
420BBCF91AA48EE900493976 /* jsb_cocos2dx_3d_manual.h in Headers */,
@ -611,6 +637,7 @@
1A119EB618BDF19200352BAA /* js_bindings_chipmunk_manual.h in Headers */,
1A119EFA18BDF19200352BAA /* jsb_websocket.h in Headers */,
1A119E9218BDF19200352BAA /* jsb_cocos2dx_extension_auto.hpp in Headers */,
42AD25761AFF9E17000176E2 /* jsb_cocos2dx_experimental_manual.h in Headers */,
1A119E8C18BDF19200352BAA /* jsb_cocos2dx_builder_auto.hpp in Headers */,
BA623E19191A196F00761F37 /* jsb_cocos2dx_pluginx_auto.hpp in Headers */,
1A119EAA18BDF19200352BAA /* js_bindings_chipmunk_auto_classes.h in Headers */,
@ -625,6 +652,7 @@
1A119ECC18BDF19200352BAA /* jsb_cocos2dx_extension_manual.h in Headers */,
1A119EF018BDF19200352BAA /* js_bindings_system_functions.h in Headers */,
1A119EDE18BDF19200352BAA /* js_manual_conversions.h in Headers */,
42AD256F1AFF9D1A000176E2 /* jsb_cocos2dx_experimental.hpp in Headers */,
1A119EFE18BDF19200352BAA /* XMLHTTPRequest.h in Headers */,
1AB5E63618D05BF30088DAA4 /* jsb_cocos2dx_ui_manual.h in Headers */,
1A119EE418BDF19200352BAA /* jsb_opengl_functions.h in Headers */,
@ -724,11 +752,13 @@
0541A7501973876100E45470 /* JavaScriptObjCBridge.mm in Sources */,
1A119EB318BDF19200352BAA /* js_bindings_chipmunk_manual.cpp in Sources */,
1A119EE918BDF19200352BAA /* jsb_opengl_registration.cpp in Sources */,
42AD25731AFF9E17000176E2 /* jsb_cocos2dx_experimental_manual.cpp in Sources */,
1A119EF718BDF19200352BAA /* jsb_websocket.cpp in Sources */,
1A119ED318BDF19200352BAA /* js_bindings_core.cpp in Sources */,
1A119EC118BDF19200352BAA /* js_bindings_ccbreader.cpp in Sources */,
1A119EFB18BDF19200352BAA /* XMLHTTPRequest.cpp in Sources */,
BAEE4D711AC3FFAD003BEB0F /* jsb_cocos2dx_3d_extension_auto.cpp in Sources */,
42AD256C1AFF9D1A000176E2 /* jsb_cocos2dx_experimental.cpp in Sources */,
1A119EC518BDF19200352BAA /* jsb_cocos2dx_studio_manual.cpp in Sources */,
1A119E8F18BDF19200352BAA /* jsb_cocos2dx_extension_auto.cpp in Sources */,
1A119ED718BDF19200352BAA /* js_bindings_opengl.cpp in Sources */,
@ -777,10 +807,12 @@
1AB5E62C18D05BC80088DAA4 /* jsb_cocos2dx_ui_auto.cpp in Sources */,
1A119E9C18BDF19200352BAA /* jsb_cocos2dx_spine_auto.cpp in Sources */,
1A119EF418BDF19200352BAA /* js_bindings_system_registration.cpp in Sources */,
42AD256D1AFF9D1A000176E2 /* jsb_cocos2dx_experimental.cpp in Sources */,
1A119EBC18BDF19200352BAA /* cocos2d_specifics.cpp in Sources */,
1A119EE618BDF19200352BAA /* jsb_opengl_manual.cpp in Sources */,
1A119F0618BDF19200352BAA /* jsb_cocos2dx_spine_manual.cpp in Sources */,
BA623E0F191A195F00761F37 /* jsb_pluginx_manual_protocols.cpp in Sources */,
42AD25741AFF9E17000176E2 /* jsb_cocos2dx_experimental_manual.cpp in Sources */,
BA623E13191A195F00761F37 /* pluginxUTF8.cpp in Sources */,
BAEE4D721AC3FFAD003BEB0F /* jsb_cocos2dx_3d_extension_auto.cpp in Sources */,
1A119EB818BDF19200352BAA /* js_bindings_chipmunk_registration.cpp in Sources */,

View File

@ -181,6 +181,8 @@
"src/ChipmunkTest/ChipmunkTest.js",
"src/Presentation/Presentation.js",
"src/ReflectionTest/ReflectionTest.js"
"src/ReflectionTest/ReflectionTest.js",
"src/SpritePolygonTest/SpritePolygonTest.js"
]
}

View File

@ -9,6 +9,8 @@
#include "jsb_cocos2dx_spine_auto.hpp"
#include "jsb_cocos2dx_3d_auto.hpp"
#include "jsb_cocos2dx_3d_extension_auto.hpp"
#include "jsb_cocos2dx_experimental.hpp"
#include "experimental/jsb_cocos2dx_experimental_manual.h"
#include "3d/jsb_cocos2dx_3d_manual.h"
#include "extension/jsb_cocos2dx_extension_manual.h"
#include "cocostudio/jsb_cocos2dx_studio_manual.h"
@ -105,6 +107,9 @@ bool AppDelegate::applicationDidFinishLaunching()
sc->addRegisterCallback(register_all_cocos2dx_3d_extension);
sc->addRegisterCallback(register_all_cocos2dx_experimental);
sc->addRegisterCallback(register_all_cocos2dx_experimental_manual);
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
sc->addRegisterCallback(JavascriptJavaBridge::_js_register);
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC)

View File

@ -0,0 +1,316 @@
/****************************************************************************
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2011-2012 cocos2d-x.org
Copyright (c) 2013-2014 Chukong Technologies Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
var SpritePolygonTestIdx = -1;
var SpritePolygonTestDemo = BaseTestLayer.extend({
_title:"",
_subtitle:"",
_debugDraw:null,
ctor:function () {
this._super();
},
initDefaultSprite:function(filename, inst){
cc.director.setClearColor(cc.color(102/255, 184/255, 204/255, 255/255));
this.addChild(inst);
var s = cc.director.getWinSize();
inst.setPosition(s.width/2 + 0.15*s.width, s.height/2);
var sp = new cc.Sprite(filename);
this.addChild(sp);
sp.setPosition(s.width/2 - 0.15*s.width, s.height/2);
this._debugDraw = new cc.DrawNode();
sp.addChild(this._debugDraw);
var self = this;
cc.eventManager.addListener({
event:cc.EventListener.TOUCH_ONE_BY_ONE,
onTouchBegan:function(){
inst.showDebug(true);
self._debugDraw.setVisible(true);
return true;
},
onTouchEnded:function(){
inst.showDebug(false);
self._debugDraw.setVisible(false);
}
}, this);
var positions = new Array(4);
var spSize = sp.getContentSize();
positions[0] = cc.p(0, spSize.height);
positions[1] = cc.p(spSize.width, spSize.height);
positions[2] = cc.p(spSize.width, 0);
positions[3] = cc.p(0, 0);
this._debugDraw.drawSegment(positions[0], positions[1], 1, cc.color.GREEN);
this._debugDraw.drawSegment(positions[1], positions[2], 1, cc.color.GREEN);
this._debugDraw.drawSegment(positions[2], positions[3], 1, cc.color.GREEN);
this._debugDraw.drawSegment(positions[3], positions[0], 1, cc.color.GREEN);
this._debugDraw.drawSegment(positions[0], positions[2], 1, cc.color.GREEN);
this._debugDraw.setVisible(false);
var label1 = new cc.LabelTTF("Sprite:\nPixels drawn:"+spSize.width*spSize.height, "fonts/arial.ttf", 10);
sp.addChild(label1);
label1.setAnchorPoint(cc.p(0, 1));
var label2 = new cc.LabelTTF("SpritePolygon:\nPixels drawn:"+(inst.getArea()+inst.getVertCount()), "fonts/arial.ttf", 10);
inst.addChild(label2);
label2.setAnchorPoint(cc.p(0, 1));
},
onRestartCallback:function (sender) {
var s = new SpritePolygonTestScene();
s.addChild(restartSpritePolygonTest());
director.runScene(s);
},
onNextCallback:function (sender) {
var s = new SpritePolygonTestScene();
s.addChild(nextSpritePolygonTest());
director.runScene(s);
},
onBackCallback:function (sender) {
var s = new SpritePolygonTestScene();
s.addChild(previousSpritePolygonTest());
director.runScene(s);
}
});
var SpritePolygonTestScene = cc.Scene.extend({
ctor:function () {
this._super();
var label = new cc.LabelTTF("Main Menu", "Arial", 20);
var menuItem = new cc.MenuItemLabel(label, this.onMainMenuCallback, this);
var menu = new cc.Menu(menuItem);
menu.x = 0;
menu.y = 0;
menuItem.x = winSize.width - 50;
menuItem.y = 25;
this.addChild(menu, 99);
},
onMainMenuCallback:function () {
var scene = new cc.Scene();
var layer = new TestController();
scene.addChild(layer);
director.runScene(scene);
},
runThisTest:function (num) {
SpritePolygonTestIdx = (num || num == 0) ? (num - 1) : -1;
var layer = nextSpritePolygonTest();
this.addChild(layer);
director.runScene(this);
}
});
var SpritePolygonTest1 = SpritePolygonTestDemo.extend({
_title:"SpritePolygon Creation",
_subtitle:"SpritePolygon::create(\"Images/grossini.png\")",
ctor:function(){
this._super();
var s = ccexp.SpritePolygon.create(s_pathGrossini);
this.initDefaultSprite(s_pathGrossini, s);
}
});
var SpritePolygonTest2 = SpritePolygonTestDemo.extend({
_title:"SpritePolygon Creation",
_subtitle:"SpritePolygon::create(\"Images/grossini.png\", verts)",
ctor:function(){
this._super();
var verts = [];
verts.push(cc.p(36.5, 242.0-128.5));
verts.push(cc.p(27.5, 242.0-133.5));
verts.push(cc.p(24.5, 242.0-145.5));
verts.push(cc.p(26.5, 242.0-161.5));
verts.push(cc.p(33.5, 242.0-168.5));
verts.push(cc.p(27.5, 242.0-168.5));
verts.push(cc.p(16.5, 242.0-179.5));
verts.push(cc.p(30.5, 242.0-197.5));
verts.push(cc.p(28.5, 242.0-237.5));
verts.push(cc.p(56.5, 242.0-237.5));
verts.push(cc.p(54.5, 242.0-197.5));
verts.push(cc.p(68.5, 242.0-184.5));
verts.push(cc.p(57.5, 242.0-168.5));
verts.push(cc.p(51.5, 242.0-168.5));
verts.push(cc.p(60.5, 242.0-154.5));
verts.push(cc.p(57.5, 242.0-133.5));
verts.push(cc.p(48.5, 242.0-127.5));
verts.push(cc.p(36.5, 242.0-127.5));
cc.SpritePolygonCache.getInstance().removeAllSpritePolygonCache();
var s = ccexp.SpritePolygon.create(s_pathGrossini, verts);
this.initDefaultSprite(s_pathGrossini, s);
}
});
var SpritePolygonTest3 = SpritePolygonTestDemo.extend({
_title:"SpritePolygon Creation",
_subtitle:"SpritePolygon::create(\"Images/grossini.png\", verts, indices)",
ctor:function(){
this._super();
var verts = [];
verts.push(cc.p(33.500000, 73.500000));
verts.push(cc.p(27.500000, 73.500000));
verts.push(cc.p(16.500000, 62.500000));
verts.push(cc.p(30.500000, 44.500000));
verts.push(cc.p(54.500000, 44.500000));
verts.push(cc.p(51.500000, 73.500000));
verts.push(cc.p(60.500000, 87.500000));
verts.push(cc.p(26.500000, 80.500000));
verts.push(cc.p(24.500000, 96.500000));
verts.push(cc.p(57.500000, 108.500000));
verts.push(cc.p(36.500000, 113.500000));
verts.push(cc.p(48.500000, 114.500000));
verts.push(cc.p(36.500000, 114.500000));
verts.push(cc.p(27.500000, 108.500000));
verts.push(cc.p(68.500000, 57.500000));
verts.push(cc.p(57.500000, 73.500000));
verts.push(cc.p(56.500000, 4.500000));
verts.push(cc.p(28.500000, 4.500000));
var indices = [0, 1, 2, 3, 0, 2, 4, 0, 3, 5, 0, 4, 5, 6, 0, 0, 6, 7, 8, 7, 6, 6, 9, 8, 9, 10, 8, 9, 11, 10, 11, 12, 10, 8, 10, 13, 14, 5, 4, 15, 5, 14, 4, 3, 16, 3, 17, 16];
cc.SpritePolygonCache.getInstance().removeAllSpritePolygonCache();
var s = ccexp.SpritePolygon.create(s_pathGrossini, verts, indices);
this.initDefaultSprite(s_pathGrossini, s);
}
});
var SpritePolygonTest4 = SpritePolygonTestDemo.extend({
_title:"SpritePolygon Creation",
_subtitle: "SpritePolygon::create(\"Images/grossini.png\", \n\tvector<V3F_C4B_T2F> v, vector<unsigned short> indices)",
ctor:function(){
this._super();
var vec3 = [];
vec3.push(cc.math.vec3(33.500000, 73.500000,0));
vec3.push(cc.math.vec3(27.500000, 73.500000,0));
vec3.push(cc.math.vec3(16.500000, 62.500000,0));
vec3.push(cc.math.vec3(30.500000, 44.500000,0));
vec3.push(cc.math.vec3(54.500000, 44.500000,0));
vec3.push(cc.math.vec3(51.500000, 73.500000,0));
vec3.push(cc.math.vec3(60.500000, 87.500000,0));
vec3.push(cc.math.vec3(26.500000, 80.500000,0));
vec3.push(cc.math.vec3(24.500000, 96.500000,0));
vec3.push(cc.math.vec3(57.500000, 108.500000,0));
vec3.push(cc.math.vec3(36.500000, 113.500000,0));
vec3.push(cc.math.vec3(48.500000, 114.500000,0));
vec3.push(cc.math.vec3(36.500000, 114.500000,0));
vec3.push(cc.math.vec3(27.500000, 108.500000,0));
vec3.push(cc.math.vec3(68.500000, 57.500000,0));
vec3.push(cc.math.vec3(57.500000, 73.500000,0));
vec3.push(cc.math.vec3(56.500000, 4.500000,0));
vec3.push(cc.math.vec3(28.500000, 4.50000, 0));
var t2f = [];
t2f.push(cc.p(0.394118, 0.392562));
t2f.push(cc.p(0.323529, 0.392562));
t2f.push(cc.p(0.194118, 0.483471));
t2f.push(cc.p(0.358824, 0.632231));
t2f.push(cc.p(0.641176, 0.632231));
t2f.push(cc.p(0.605882, 0.392562));
t2f.push(cc.p(0.711765, 0.276859));
t2f.push(cc.p(0.311765, 0.334711));
t2f.push(cc.p(0.288235, 0.202479));
t2f.push(cc.p(0.676471, 0.103306));
t2f.push(cc.p(0.429412, 0.061983));
t2f.push(cc.p(0.570588, 0.053719));
t2f.push(cc.p(0.429412, 0.053719));
t2f.push(cc.p(0.323529, 0.103306));
t2f.push(cc.p(0.805882, 0.524793));
t2f.push(cc.p(0.676471, 0.392562));
t2f.push(cc.p(0.664706, 0.962810));
t2f.push(cc.p(0.335294, 0.962810));
var verts = [];
for(var i = 0; i < 18; ++i)
{
var t = {
v3f:vec3[i],
c4b:cc.color.WHITE,
t2f:t2f[i]
};
verts.push(t);
}
var indices = [0, 1, 2, 3, 0, 2, 4, 0, 3, 5, 0, 4, 5, 6, 0, 0, 6, 7, 8, 7, 6, 6, 9, 8, 9, 10, 8, 9, 11, 10, 11, 12, 10, 8, 10, 13, 14, 5, 4, 15, 5, 14, 4, 3, 16, 3, 17, 16];
cc.SpritePolygonCache.getInstance().removeAllSpritePolygonCache();
var s = ccexp.SpritePolygon.create(s_pathGrossini, verts, indices);
this.initDefaultSprite(s_pathGrossini, s);
}
})
//
// Flow control
//
var arrayOfSpritePolygonTest = [
SpritePolygonTest1,
SpritePolygonTest2,
SpritePolygonTest3,
SpritePolygonTest4
];
var nextSpritePolygonTest = function () {
SpritePolygonTestIdx++;
SpritePolygonTestIdx = SpritePolygonTestIdx % arrayOfSpritePolygonTest.length;
if(window.sideIndexBar){
SpritePolygonTestIdx = window.sideIndexBar.changeTest(SpritePolygonTestIdx, 36);
}
return new arrayOfSpritePolygonTest[SpritePolygonTestIdx ]();
};
var previousSpritePolygonTest = function () {
SpritePolygonTestIdx--;
if (SpritePolygonTestIdx < 0)
SpritePolygonTestIdx += arrayOfSpritePolygonTest.length;
if(window.sideIndexBar){
SpritePolygonTestIdx = window.sideIndexBar.changeTest(SpritePolygonTestIdx, 36);
}
return new arrayOfSpritePolygonTest[SpritePolygonTestIdx ]();
};
var restartSpritePolygonTest = function () {
return new arrayOfSpritePolygonTest[SpritePolygonTestIdx ]();
};

View File

@ -580,6 +580,14 @@ var testNames = [
return new Sprite3DTestScene();
}
},
{
title:"SpritePolygon Test",
platforms: PLATFORM_JSB,
linksrc:"src/SpritePolygonTest/SpritePolygonTest.js",
testScene:function () {
return new SpritePolygonTestScene();
}
},
{
title:"Sprite Test",
resource:g_sprites,
@ -685,4 +693,4 @@ var testNames = [
//"UserDefaultTest",
//"ZwoptexTest",
];
];

View File

@ -22,12 +22,12 @@ cxxgenerator_headers =
extra_arguments = %(android_headers)s %(clang_headers)s %(cxxgenerator_headers)s %(cocos_headers)s %(android_flags)s %(clang_flags)s %(cocos_flags)s %(extra_flags)s
# what headers to parse
headers = %(cocosdir)s/cocos/cocos2d.h %(cocosdir)s/cocos/audio/include/SimpleAudioEngine.h %(cocosdir)s/cocos/2d/CCProtectedNode.h %(cocosdir)s/cocos/base/CCAsyncTaskPool.h
headers = %(cocosdir)s/cocos/cocos2d.h %(cocosdir)s/cocos/audio/include/SimpleAudioEngine.h %(cocosdir)s/cocos/2d/CCProtectedNode.h %(cocosdir)s/cocos/base/CCAsyncTaskPool.h %(cocosdir)s/cocos/2d/SpritePolygonCache.h
# what classes to produce code for. You can use regular expressions here. When testing the regular
# expression, it will be enclosed in "^$", like this: "^Menu*$".
classes = New.* Sprite SpriteBatchNode SpriteFrame SpriteFrameCache Scene Node.* Director Layer.* Menu.* Touch .*Action.* Move.* Rotate.* Blink.* Tint.* Sequence Repeat.* Fade.* Ease.* Scale.* Transition.* Spawn ReverseTime Animate AnimationFrame Animation AnimationCache Flip.* Delay.* Skew.* Jump.* Place.* Show.* Progress.* PointArray ToggleVisibility.* RemoveSelf Hide Particle.* Label.* Atlas.* TextureCache.* Texture2D Cardinal.* CatmullRom.* ParallaxNode TileMap.* TMX.* CallFunc CallFuncN RenderTexture GridAction Grid3DAction Grid3D TiledGrid3D GridBase$ .+Grid Shaky3D Waves3D FlipX3D FlipY3D Lens3D Ripple3D PageTurn3D ShakyTiles3D ShatteredTiles3D WavesTiles3D JumpTiles3D Speed ActionManager Set SimpleAudioEngine Scheduler Orbit.* Follow.* Bezier.* CardinalSpline.* Camera.* DrawNode Liquid$ Waves$ ShuffleTiles$ TurnOffTiles$ Split.* Twirl$ FileUtils$ GLProgram GLProgramCache Application ClippingNode MotionStreak TextFieldTTF GLViewProtocol GLView Component ComponentContainer __NodeRGBA __LayerRGBA SAXParser Event(?!.*(Physics).*).* Device Configuration ProtectedNode GLProgramState Image .*Light$ AsyncTaskPool
classes = New.* Sprite SpriteBatchNode SpriteFrame SpriteFrameCache Scene Node.* Director Layer.* Menu.* Touch .*Action.* Move.* Rotate.* Blink.* Tint.* Sequence Repeat.* Fade.* Ease.* Scale.* Transition.* Spawn ReverseTime Animate AnimationFrame Animation AnimationCache Flip.* Delay.* Skew.* Jump.* Place.* Show.* Progress.* PointArray ToggleVisibility.* RemoveSelf Hide Particle.* Label.* Atlas.* TextureCache.* Texture2D Cardinal.* CatmullRom.* ParallaxNode TileMap.* TMX.* CallFunc CallFuncN RenderTexture GridAction Grid3DAction Grid3D TiledGrid3D GridBase$ .+Grid Shaky3D Waves3D FlipX3D FlipY3D Lens3D Ripple3D PageTurn3D ShakyTiles3D ShatteredTiles3D WavesTiles3D JumpTiles3D Speed ActionManager Set SimpleAudioEngine Scheduler Orbit.* Follow.* Bezier.* CardinalSpline.* Camera.* DrawNode Liquid$ Waves$ ShuffleTiles$ TurnOffTiles$ Split.* Twirl$ FileUtils$ GLProgram GLProgramCache Application ClippingNode MotionStreak TextFieldTTF GLViewProtocol GLView Component ComponentContainer __NodeRGBA __LayerRGBA SAXParser Event(?!.*(Physics).*).* Device Configuration ProtectedNode GLProgramState Image .*Light$ AsyncTaskPool SpritePolygonCache
classes_need_extend = Node __NodeRGBA Layer.* Sprite SpriteBatchNode SpriteFrame Menu MenuItem.* Scene DrawNode Component .*Action.* GridBase Grid3D TiledGrid3D MotionStreak ParticleBatchNode ParticleSystem TextFieldTTF RenderTexture TileMapAtlas TMXLayer TMXTiledMap TMXMapInfo TransitionScene ProgressTimer ParallaxNode Label.* GLProgram
@ -121,7 +121,7 @@ skip = Node::[^setPosition$ setGLServerState description getUserObject .*UserDat
Component::[serialize],
EventListenerCustom::[init],
EventListener::[init],
Scene::[getCameras getLights initWithPhysics createWithPhysics getPhysicsWorld],
Scene::[getCameras getLights initWithPhysics createWithPhysics getPhysicsWorld getPhysics3DWorld],
Animate3D::[*],
Sprite3D::[*],
AttachNode::[*],
@ -135,7 +135,8 @@ skip = Node::[^setPosition$ setGLServerState description getUserObject .*UserDat
Device::[getTextureDataForText],
BillBoard::[*],
Camera::[unproject isVisibleInFrustum],
ClippingNode::[init]
ClippingNode::[init],
SpritePolygonCache::[addSpritePolygonCache getSpritePolygonCache]
rename_functions = SpriteFrameCache::[addSpriteFramesWithFile=addSpriteFrames getSpriteFrameByName=getSpriteFrame],
MenuItemFont::[setFontNameObj=setFontName setFontSizeObj=setFontSize getFontSizeObj=getFontSize getFontNameObj=getFontName],
@ -181,7 +182,7 @@ base_classes_to_skip = Ref Clonable
# classes that create no constructor
# Set is special and we will use a hand-written constructor
abstract_classes = Action FiniteTimeAction ActionInterval ActionEase EaseRateAction EaseElastic EaseBounce ActionInstant GridAction Grid3DAction TiledGrid3DAction Director SpriteFrameCache TransitionEaseScene Set SimpleAudioEngine FileUtils Application GLViewProtocol GLView ComponentContainer SAXParser Configuration EventListener BaseLight AsyncTaskPool
abstract_classes = Action FiniteTimeAction ActionInterval ActionEase EaseRateAction EaseElastic EaseBounce ActionInstant GridAction Grid3DAction TiledGrid3DAction Director SpriteFrameCache TransitionEaseScene Set SimpleAudioEngine FileUtils Application GLViewProtocol GLView ComponentContainer SAXParser Configuration EventListener BaseLight AsyncTaskPool SpritePolygonCache
# Determining whether to use script object(js object) to control the lifecycle of native(cpp) object or the other way around. Supported values are 'yes' or 'no'.
script_control_cpp = no

View File

@ -43,7 +43,7 @@ skip = Skeleton3D::[create],
Sprite3DCache::[addSprite3DData getSpriteData],
Animation3D::[getBoneCurves],
TextureCube::[setTexParameters],
Terrain::[getAABB getQuadTree create]
Terrain::[getAABB getQuadTree create getHeightData]
rename_functions =

View File

@ -0,0 +1,60 @@
[cocos2dx_experimental]
# the prefix to be added to the generated functions. You might or might not use this in your own
# templates
prefix = cocos2dx_experimental
# create a target namespace (in javascript, this would create some code like the equiv. to `ns = ns || {}`)
# all classes will be embedded in that namespace
target_namespace = ccexp
android_headers = -I%(androidndkdir)s/platforms/android-14/arch-arm/usr/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.7/libs/armeabi-v7a/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.7/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi-v7a/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.8/include
android_flags = -D_SIZE_T_DEFINED_
clang_headers = -I%(clangllvmdir)s/lib/clang/3.3/include
clang_flags = -nostdinc -x c++ -std=c++11 -U __SSE__
cocos_headers = -I%(cocosdir)s/cocos -I%(cocosdir)s/cocos/editor-support -I%(cocosdir)s/cocos/platform/android -I%(cocosdir)s/external
cocos_flags = -DANDROID
cxxgenerator_headers =
# extra arguments for clang
extra_arguments = %(android_headers)s %(clang_headers)s %(cxxgenerator_headers)s %(cocos_headers)s %(android_flags)s %(clang_flags)s %(cocos_flags)s %(extra_flags)s
# what headers to parse
headers = %(cocosdir)s/cocos/2d/SpritePolygon.h
# what classes to produce code for. You can use regular expressions here. When testing the regular
# expression, it will be enclosed in "^$", like this: "^Menu*$".
classes = SpritePolygon
# what should we skip? in the format ClassName::[function function]
# ClassName is a regular expression, but will be used like this: "^ClassName$" functions are also
# regular expressions, they will not be surrounded by "^$". If you want to skip a whole class, just
# add a single "*" as functions. See bellow for several examples. A special class name is "*", which
# will apply to all class names. This is a convenience wildcard to be able to skip similar named
# functions from all classes.
skip = SpritePolygon::[create initWithVerts initWithRect initWithPoly2tri initWithCache]
rename_functions =
rename_classes =
# for all class names, should we remove something when registering in the target VM?
remove_prefix =
# classes for which there will be no "parent" lookup
classes_have_no_parents =
# base classes which will be skipped when their sub-classes found them.
base_classes_to_skip =
# classes that create no constructor
# Set is special and we will use a hand-written constructor
abstract_classes =
# Determining whether to use script object(js object) to control the lifecycle of native(cpp) object or the other way around. Supported values are 'yes' or 'no'.
script_control_cpp = no

View File

@ -114,7 +114,7 @@ def main():
if platform == 'win32':
config.set('DEFAULT', 'extra_flags', '-D__WCHAR_MAX__=0x7fffffff -U__MINGW32__')
conf_ini_file = os.path.abspath(os.path.join(os.path.dirname(__file__), 'userconf.ini'))
conf_ini_file = os.path.abspath(os.path.join(os.path.dirname(__file__), 'userconf.ini'))
print 'generating userconf.ini...'
with open(conf_ini_file, 'w') as configfile:
@ -141,7 +141,8 @@ def main():
'cocos2dx_studio.ini' : ('cocos2dx_studio', 'jsb_cocos2dx_studio_auto'), \
'cocos2dx_spine.ini' : ('cocos2dx_spine', 'jsb_cocos2dx_spine_auto'), \
'cocos2dx_3d.ini' : ('cocos2dx_3d', 'jsb_cocos2dx_3d_auto'), \
'cocos2dx_3d_ext.ini' : ('cocos2dx_3d_extension', 'jsb_cocos2dx_3d_extension_auto')
'cocos2dx_3d_ext.ini' : ('cocos2dx_3d_extension', 'jsb_cocos2dx_3d_extension_auto'), \
'cocos2dx_experimental.ini' : ('cocos2dx_experimental', 'jsb_cocos2dx_experimental')
}
target = 'spidermonkey'
generator_py = '%s/generator.py' % cxx_generator_root
@ -156,7 +157,7 @@ def main():
with _pushd(output_dir):
_run_cmd('dos2unix *')
custom_cmd_args = {}
if len(custom_cmd_args) > 0:
output_dir = '%s/frameworks/custom/auto' % project_root
@ -182,7 +183,7 @@ def main():
sys.exit(1)
else:
raise
# -------------- main --------------
if __name__ == '__main__':