cocos2d-x jsb 绑定 ClippingNode

JSClass *jsb_ClippingNode_class; JSObject *jsb_ClippingNode_prototype; JSBool js_cocos2dx_ClippingNode_isInverted(JSContext *cx, uint32_t argc, jsval *vp) { JSObject *obj = JS_THIS_OBJECT(cx, vp); js_proxy_t *proxy = jsb_get_js_proxy(obj); cocos2d::CCClippingNode* cobj = (cocos2d::CCClippingNode *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object"); if (argc == 0) { bool ret = cobj->isInverted(); jsval jsret; jsret = BOOLEAN_TO_JSVAL(ret); JS_SET_RVAL(cx, vp, jsret); return JS_TRUE; } JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 0); return JS_FALSE; } JSBool js_cocos2dx_ClippingNode_visit(JSContext *cx, uint32_t argc, jsval *vp) { JSObject *obj = JS_THIS_OBJECT(cx, vp); js_proxy_t *proxy = jsb_get_js_proxy(obj); cocos2d::CCClippingNode* cobj = (cocos2d::CCClippingNode *)(proxy ?...

2013-12-10 · 6 分钟 · admin

cocos2d-x jsb 绑定 removeAllDelegates

html5版为 cc.Director.getInstance().getTouchDispatcher().removeAllDelegates(); 但 jsb 下没有,绑定一下。 void JSTouchDelegate::removeAllDelegates() { CCDirector* pDirector = CCDirector::sharedDirector(); pDirector->getTouchDispatcher()->removeAllDelegates(); } JSBool js_cocos2dx_JSTouchDelegate_removeAllDelegates(JSContext *cx, uint32_t argc, jsval *vp) { if (argc == 0) { JSTouchDelegate *touch = new JSTouchDelegate(); touch->autorelease(); touch->removeAllDelegates(); return JS_TRUE; } JS_ReportError(cx, "wrong number of arguments"); return JS_FALSE; } JS_DefineFunction(cx, ns, "removeAllDelegates", js_cocos2dx_JSTouchDelegate_removeAllDelegates, 1, JSPROP_READONLY | JSPROP_PERMANENT);

2013-12-10 · 1 分钟 · admin

cocos2d-x 2.1.5 jsb 读取 plist

static JSBool js_cocos2dx_CCFileUtils_createDictionaryWithContentsOfFile(JSContext *cx, uint32_t argc, jsval *vp) { jsval *argv = JS_ARGV(cx, vp); JSBool ok = JS_TRUE; JSObject *obj = JS_THIS_OBJECT(cx, vp); js_proxy_t *proxy = jsb_get_js_proxy(obj); cocos2d::CCFileUtils* cobj = (cocos2d::CCFileUtils *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object"); if (argc == 1) { std::string arg0; ok &= jsval_to_std_string(cx, argv[0], &arg0;); JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments"); cocos2d::CCDictionary* ret = CCDictionary::createWithContentsOfFile(arg0.c_str()); jsval jsret; jsret = ccdictionary_to_jsval(cx, ret); JS_SET_RVAL(cx, vp, jsret); return JS_TRUE; } JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1); return JS_FALSE; }

2013-10-17 · 1 分钟 · admin

cocos2d-x 2.1.5 clippingNode在 jsb 下无效的修改

**http://cocos2d-x.org/boards/6/topics/20141?r=20567#message-20567 ** for iOS: in AppController replace the gl-view creation with: EAGLView *__glView = [EAGLView viewWithFrame: [window bounds] pixelFormat: kEAGLColorFormatRGBA8 depthFormat: GL_DEPTH24_STENCIL8_OES preserveBackbuffer: NO sharegroup: nil multiSampling: NO numberOfSamples: 0]; for Android: in game activity: public Cocos2dxGLSurfaceView onCreateView() { Cocos2dxGLSurfaceView glSurfaceView = new Cocos2dxGLSurfaceView(this); glSurfaceView.setEGLConfigChooser(5, 6, 5, 0, 16, 8); return glSurfaceView; }

2013-09-23 · 1 分钟 · admin