1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
//在AppDelegate::applicationDidFinishLaunching函数中
ScriptingCore* sc = ScriptingCore::getInstance();
sc->addRegisterCallback(register_all_cocos2dx);
sc->addRegisterCallback(register_all_cocos2dx_extension);
sc->addRegisterCallback(register_cocos2dx_js_extensions);
sc->addRegisterCallback(register_all_cocos2dx_extension_manual);
sc->addRegisterCallback(jsb_register_chipmunk);
sc->addRegisterCallback(JSB_register_opengl);
sc->addRegisterCallback(jsb_register_system);
sc->addRegisterCallback(MinXmlHttpRequest::_js_register);
sc->addRegisterCallback(register_jsb_websocket);
sc->addRegisterCallback(register_all_cocos2dx_builder);
sc->addRegisterCallback(register_CCBuilderReader);
sc->addRegisterCallback(register_all_cocos2dx_gui);
sc->addRegisterCallback(register_all_cocos2dx_gui_manual);
sc->addRegisterCallback(register_all_cocos2dx_studio);
sc->addRegisterCallback(register_all_cocos2dx_studio_manual);
sc->addRegisterCallback(register_all_cocos2dx_spine);
|
var
node = cc.Node.create();
node.setVisible(
false
);
auto
node = CCNode::create();
node->setVisible(
false
);
JSBool js_cocos2dx_Node_create(JSContext *cx,uint32_t argc,jsval *vp)
{
if
(argc == 0) {
cocos2d::Node* ret = cocos2d::Node::create();
jsval jsret = JSVAL_NULL;
do
{
(ret) {
js_proxy_t *proxy = js_get_or_create_proxy<cocos2d::Node>(cx,(cocos2d::Node*)ret);
jsret = OBJECT_TO_JSVAL(proxy->obj);
}
else
{
jsret = JSVAL_NULL;
}
while
(0);
JS_SET_RVAL(cx,vp,jsret);
return
JS_TRUE;
}
JS_ReportError(cx,
"js_cocos2dx_Node_create : wrong number of arguments"
);
JS_FALSE;
}