mirror of https://github.com/axmolengine/axmol.git
[PLUGIN] Removing the bindings glue codes for CCApplication since it was bound in cocos2dx.
This commit is contained in:
parent
a2c71f8e89
commit
90ad5410c7
|
@ -1,324 +0,0 @@
|
|||
#include "jsb_cocos2dx_other_auto.hpp"
|
||||
#include "jsb_pluginx_spidermonkey_specifics.h"
|
||||
#include "jsb_pluginx_basic_conversions.h"
|
||||
using namespace pluginx;
|
||||
#include "cocos2d.h"
|
||||
|
||||
template<class T>
|
||||
static JSBool dummy_constructor(JSContext *cx, uint32_t argc, jsval *vp) {
|
||||
TypeTest<T> t;
|
||||
T* cobj = new T();
|
||||
js_type_class_t *p;
|
||||
uint32_t typeId = t.s_id();
|
||||
HASH_FIND_INT(_js_global_type_ht, &typeId, p);
|
||||
assert(p);
|
||||
JSObject *_tmp = JS_NewObject(cx, p->jsclass, p->proto, p->parentProto);
|
||||
js_proxy_t *pp;
|
||||
JS_NEW_PROXY(pp, cobj, _tmp);
|
||||
JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(_tmp));
|
||||
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
static JSBool empty_constructor(JSContext *cx, uint32_t argc, jsval *vp) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
|
||||
JSClass *jsb_CCApplicationProtocol_class;
|
||||
JSObject *jsb_CCApplicationProtocol_prototype;
|
||||
|
||||
JSBool js_cocos2dx_other_CCApplicationProtocol_getTargetPlatform(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
|
||||
cocos2d::CCApplicationProtocol* cobj = (cocos2d::CCApplicationProtocol *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
|
||||
if (argc == 0) {
|
||||
cocos2d::TargetPlatform ret = cobj->getTargetPlatform();
|
||||
jsval jsret;
|
||||
jsret = int32_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, 0);
|
||||
return JS_FALSE;
|
||||
}
|
||||
JSBool js_cocos2dx_other_CCApplicationProtocol_getCurrentLanguage(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
|
||||
cocos2d::CCApplicationProtocol* cobj = (cocos2d::CCApplicationProtocol *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
|
||||
if (argc == 0) {
|
||||
cocos2d::ccLanguageType ret = cobj->getCurrentLanguage();
|
||||
jsval jsret;
|
||||
jsret = int32_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, 0);
|
||||
return JS_FALSE;
|
||||
}
|
||||
JSBool js_cocos2dx_other_CCApplicationProtocol_setAnimationInterval(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; JS_GET_NATIVE_PROXY(proxy, obj);
|
||||
cocos2d::CCApplicationProtocol* cobj = (cocos2d::CCApplicationProtocol *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
|
||||
if (argc == 1) {
|
||||
double arg0;
|
||||
ok &= JS_ValueToNumber(cx, argv[0], &arg0);
|
||||
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
|
||||
cobj->setAnimationInterval(arg0);
|
||||
JS_SET_RVAL(cx, vp, JSVAL_VOID);
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1);
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void js_cocos2dx_other_CCApplicationProtocol_finalize(JSFreeOp *fop, JSObject *obj) {
|
||||
js_proxy_t* nproxy;
|
||||
js_proxy_t* jsproxy;
|
||||
JS_GET_NATIVE_PROXY(jsproxy, obj);
|
||||
if (jsproxy) {
|
||||
JS_GET_PROXY(nproxy, jsproxy->ptr);
|
||||
|
||||
// cocos2d::CCApplicationProtocol *nobj = static_cast<cocos2d::CCApplicationProtocol *>(nproxy->ptr);
|
||||
// if (nobj)
|
||||
// delete nobj;
|
||||
|
||||
JS_REMOVE_PROXY(nproxy, jsproxy);
|
||||
}
|
||||
}
|
||||
|
||||
void js_register_cocos2dx_other_CCApplicationProtocol(JSContext *cx, JSObject *global) {
|
||||
jsb_CCApplicationProtocol_class = (JSClass *)calloc(1, sizeof(JSClass));
|
||||
jsb_CCApplicationProtocol_class->name = "ApplicationProtocol";
|
||||
jsb_CCApplicationProtocol_class->addProperty = JS_PropertyStub;
|
||||
jsb_CCApplicationProtocol_class->delProperty = JS_PropertyStub;
|
||||
jsb_CCApplicationProtocol_class->getProperty = JS_PropertyStub;
|
||||
jsb_CCApplicationProtocol_class->setProperty = JS_StrictPropertyStub;
|
||||
jsb_CCApplicationProtocol_class->enumerate = JS_EnumerateStub;
|
||||
jsb_CCApplicationProtocol_class->resolve = JS_ResolveStub;
|
||||
jsb_CCApplicationProtocol_class->convert = JS_ConvertStub;
|
||||
jsb_CCApplicationProtocol_class->finalize = js_cocos2dx_other_CCApplicationProtocol_finalize;
|
||||
jsb_CCApplicationProtocol_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
||||
|
||||
JSPropertySpec *properties = NULL;
|
||||
|
||||
static JSFunctionSpec funcs[] = {
|
||||
JS_FN("getTargetPlatform", js_cocos2dx_other_CCApplicationProtocol_getTargetPlatform, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("getCurrentLanguage", js_cocos2dx_other_CCApplicationProtocol_getCurrentLanguage, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("setAnimationInterval", js_cocos2dx_other_CCApplicationProtocol_setAnimationInterval, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FS_END
|
||||
};
|
||||
|
||||
JSFunctionSpec *st_funcs = NULL;
|
||||
|
||||
jsb_CCApplicationProtocol_prototype = JS_InitClass(
|
||||
cx, global,
|
||||
NULL, // parent proto
|
||||
jsb_CCApplicationProtocol_class,
|
||||
empty_constructor, 0,
|
||||
properties,
|
||||
funcs,
|
||||
NULL, // no static properties
|
||||
st_funcs);
|
||||
// make the class enumerable in the registered namespace
|
||||
JSBool found;
|
||||
JS_SetPropertyAttributes(cx, global, "ApplicationProtocol", JSPROP_ENUMERATE | JSPROP_READONLY, &found);
|
||||
|
||||
// add the proto and JSClass to the type->js info hash table
|
||||
TypeTest<cocos2d::CCApplicationProtocol> t;
|
||||
js_type_class_t *p;
|
||||
uint32_t typeId = t.s_id();
|
||||
HASH_FIND_INT(_js_global_type_ht, &typeId, p);
|
||||
if (!p) {
|
||||
p = (js_type_class_t *)malloc(sizeof(js_type_class_t));
|
||||
p->type = typeId;
|
||||
p->jsclass = jsb_CCApplicationProtocol_class;
|
||||
p->proto = jsb_CCApplicationProtocol_prototype;
|
||||
p->parentProto = NULL;
|
||||
HASH_ADD_INT(_js_global_type_ht, type, p);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
JSClass *jsb_CCApplication_class;
|
||||
JSObject *jsb_CCApplication_prototype;
|
||||
|
||||
JSBool js_cocos2dx_other_CCApplication_getTargetPlatform(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
|
||||
cocos2d::CCApplication* cobj = (cocos2d::CCApplication *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
|
||||
if (argc == 0) {
|
||||
cocos2d::TargetPlatform ret = cobj->getTargetPlatform();
|
||||
jsval jsret;
|
||||
jsret = int32_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, 0);
|
||||
return JS_FALSE;
|
||||
}
|
||||
JSBool js_cocos2dx_other_CCApplication_setAnimationInterval(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; JS_GET_NATIVE_PROXY(proxy, obj);
|
||||
cocos2d::CCApplication* cobj = (cocos2d::CCApplication *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
|
||||
if (argc == 1) {
|
||||
double arg0;
|
||||
ok &= JS_ValueToNumber(cx, argv[0], &arg0);
|
||||
JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
|
||||
cobj->setAnimationInterval(arg0);
|
||||
JS_SET_RVAL(cx, vp, JSVAL_VOID);
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1);
|
||||
return JS_FALSE;
|
||||
}
|
||||
JSBool js_cocos2dx_other_CCApplication_getCurrentLanguage(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JSObject *obj = JS_THIS_OBJECT(cx, vp);
|
||||
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
|
||||
cocos2d::CCApplication* cobj = (cocos2d::CCApplication *)(proxy ? proxy->ptr : NULL);
|
||||
JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object");
|
||||
if (argc == 0) {
|
||||
cocos2d::ccLanguageType ret = cobj->getCurrentLanguage();
|
||||
jsval jsret;
|
||||
jsret = int32_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, 0);
|
||||
return JS_FALSE;
|
||||
}
|
||||
JSBool js_cocos2dx_other_CCApplication_sharedApplication(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
if (argc == 0) {
|
||||
cocos2d::CCApplication* ret = cocos2d::CCApplication::sharedApplication();
|
||||
jsval jsret;
|
||||
do {
|
||||
if (ret) {
|
||||
js_proxy_t *proxy = js_get_or_create_proxy<cocos2d::CCApplication>(cx, 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, "wrong number of arguments");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
extern JSObject *jsb_CCApplicationProtocol_prototype;
|
||||
|
||||
void js_cocos2dx_other_CCApplication_finalize(JSFreeOp *fop, JSObject *obj) {
|
||||
js_proxy_t* nproxy;
|
||||
js_proxy_t* jsproxy;
|
||||
JS_GET_NATIVE_PROXY(jsproxy, obj);
|
||||
if (jsproxy) {
|
||||
JS_GET_PROXY(nproxy, jsproxy->ptr);
|
||||
|
||||
// cocos2d::CCApplication *nobj = static_cast<cocos2d::CCApplication *>(nproxy->ptr);
|
||||
// if (nobj)
|
||||
// delete nobj;
|
||||
|
||||
JS_REMOVE_PROXY(nproxy, jsproxy);
|
||||
}
|
||||
}
|
||||
|
||||
void js_register_cocos2dx_other_CCApplication(JSContext *cx, JSObject *global) {
|
||||
jsb_CCApplication_class = (JSClass *)calloc(1, sizeof(JSClass));
|
||||
jsb_CCApplication_class->name = "Application";
|
||||
jsb_CCApplication_class->addProperty = JS_PropertyStub;
|
||||
jsb_CCApplication_class->delProperty = JS_PropertyStub;
|
||||
jsb_CCApplication_class->getProperty = JS_PropertyStub;
|
||||
jsb_CCApplication_class->setProperty = JS_StrictPropertyStub;
|
||||
jsb_CCApplication_class->enumerate = JS_EnumerateStub;
|
||||
jsb_CCApplication_class->resolve = JS_ResolveStub;
|
||||
jsb_CCApplication_class->convert = JS_ConvertStub;
|
||||
jsb_CCApplication_class->finalize = js_cocos2dx_other_CCApplication_finalize;
|
||||
jsb_CCApplication_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
||||
|
||||
JSPropertySpec *properties = NULL;
|
||||
|
||||
static JSFunctionSpec funcs[] = {
|
||||
JS_FN("getTargetPlatform", js_cocos2dx_other_CCApplication_getTargetPlatform, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("setAnimationInterval", js_cocos2dx_other_CCApplication_setAnimationInterval, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FN("getCurrentLanguage", js_cocos2dx_other_CCApplication_getCurrentLanguage, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FS_END
|
||||
};
|
||||
|
||||
static JSFunctionSpec st_funcs[] = {
|
||||
JS_FN("getInstance", js_cocos2dx_other_CCApplication_sharedApplication, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||
JS_FS_END
|
||||
};
|
||||
|
||||
jsb_CCApplication_prototype = JS_InitClass(
|
||||
cx, global,
|
||||
jsb_CCApplicationProtocol_prototype,
|
||||
jsb_CCApplication_class,
|
||||
empty_constructor, 0,
|
||||
properties,
|
||||
funcs,
|
||||
NULL, // no static properties
|
||||
st_funcs);
|
||||
// make the class enumerable in the registered namespace
|
||||
JSBool found;
|
||||
JS_SetPropertyAttributes(cx, global, "Application", JSPROP_ENUMERATE | JSPROP_READONLY, &found);
|
||||
|
||||
// add the proto and JSClass to the type->js info hash table
|
||||
TypeTest<cocos2d::CCApplication> t;
|
||||
js_type_class_t *p;
|
||||
uint32_t typeId = t.s_id();
|
||||
HASH_FIND_INT(_js_global_type_ht, &typeId, p);
|
||||
if (!p) {
|
||||
p = (js_type_class_t *)malloc(sizeof(js_type_class_t));
|
||||
p->type = typeId;
|
||||
p->jsclass = jsb_CCApplication_class;
|
||||
p->proto = jsb_CCApplication_prototype;
|
||||
p->parentProto = jsb_CCApplicationProtocol_prototype;
|
||||
HASH_ADD_INT(_js_global_type_ht, type, p);
|
||||
}
|
||||
}
|
||||
|
||||
void register_all_cocos2dx_other(JSContext* cx, JSObject* obj) {
|
||||
// first, try to get the ns
|
||||
jsval nsval;
|
||||
JSObject *ns;
|
||||
JS_GetProperty(cx, obj, "cc", &nsval);
|
||||
if (nsval == JSVAL_VOID) {
|
||||
ns = JS_NewObject(cx, NULL, NULL, NULL);
|
||||
nsval = OBJECT_TO_JSVAL(ns);
|
||||
JS_SetProperty(cx, obj, "cc", &nsval);
|
||||
} else {
|
||||
JS_ValueToObject(cx, nsval, &ns);
|
||||
}
|
||||
obj = ns;
|
||||
|
||||
js_register_cocos2dx_other_CCApplicationProtocol(cx, obj);
|
||||
js_register_cocos2dx_other_CCApplication(cx, obj);
|
||||
}
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
#ifndef __cocos2dx_other_h__
|
||||
#define __cocos2dx_other_h__
|
||||
|
||||
#include "jsapi.h"
|
||||
#include "jsfriendapi.h"
|
||||
|
||||
|
||||
extern JSClass *jsb_CCApplicationProtocol_class;
|
||||
extern JSObject *jsb_CCApplicationProtocol_prototype;
|
||||
|
||||
JSBool js_cocos2dx_other_CCApplicationProtocol_constructor(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
void js_cocos2dx_other_CCApplicationProtocol_finalize(JSContext *cx, JSObject *obj);
|
||||
void js_register_cocos2dx_other_CCApplicationProtocol(JSContext *cx, JSObject *global);
|
||||
void register_all_cocos2dx_other(JSContext* cx, JSObject* obj);
|
||||
JSBool js_cocos2dx_other_CCApplicationProtocol_getTargetPlatform(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool js_cocos2dx_other_CCApplicationProtocol_getCurrentLanguage(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool js_cocos2dx_other_CCApplicationProtocol_setAnimationInterval(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
|
||||
extern JSClass *jsb_CCApplication_class;
|
||||
extern JSObject *jsb_CCApplication_prototype;
|
||||
|
||||
JSBool js_cocos2dx_other_CCApplication_constructor(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
void js_cocos2dx_other_CCApplication_finalize(JSContext *cx, JSObject *obj);
|
||||
void js_register_cocos2dx_other_CCApplication(JSContext *cx, JSObject *global);
|
||||
void register_all_cocos2dx_other(JSContext* cx, JSObject* obj);
|
||||
JSBool js_cocos2dx_other_CCApplication_getTargetPlatform(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool js_cocos2dx_other_CCApplication_setAnimationInterval(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool js_cocos2dx_other_CCApplication_getCurrentLanguage(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
JSBool js_cocos2dx_other_CCApplication_sharedApplication(JSContext *cx, uint32_t argc, jsval *vp);
|
||||
#endif
|
||||
|
|
@ -1,60 +0,0 @@
|
|||
/**
|
||||
* @module cocos2dx_other
|
||||
*/
|
||||
var cc = cc || {};
|
||||
|
||||
/**
|
||||
* @class CCApplicationProtocol
|
||||
*/
|
||||
cc.ApplicationProtocol = {
|
||||
|
||||
/**
|
||||
* @method getTargetPlatform
|
||||
* @return A value converted from C/C++ "cocos2d::TargetPlatform"
|
||||
*/
|
||||
getTargetPlatform : function () {},
|
||||
|
||||
/**
|
||||
* @method getCurrentLanguage
|
||||
* @return A value converted from C/C++ "cocos2d::ccLanguageType"
|
||||
*/
|
||||
getCurrentLanguage : function () {},
|
||||
|
||||
/**
|
||||
* @method setAnimationInterval
|
||||
* @param {double}
|
||||
*/
|
||||
setAnimationInterval : function () {},
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* @class CCApplication
|
||||
*/
|
||||
cc.Application = {
|
||||
|
||||
/**
|
||||
* @method getTargetPlatform
|
||||
* @return A value converted from C/C++ "cocos2d::TargetPlatform"
|
||||
*/
|
||||
getTargetPlatform : function () {},
|
||||
|
||||
/**
|
||||
* @method setAnimationInterval
|
||||
* @param {double}
|
||||
*/
|
||||
setAnimationInterval : function () {},
|
||||
|
||||
/**
|
||||
* @method getCurrentLanguage
|
||||
* @return A value converted from C/C++ "cocos2d::ccLanguageType"
|
||||
*/
|
||||
getCurrentLanguage : function () {},
|
||||
|
||||
/**
|
||||
* @method sharedApplication
|
||||
* @return A value converted from C/C++ "cocos2d::CCApplication*"
|
||||
*/
|
||||
sharedApplication : function () {},
|
||||
|
||||
};
|
|
@ -1,24 +0,0 @@
|
|||
var cc = cc || {};
|
||||
|
||||
cc.kLanguageEnglish = 0;
|
||||
cc.kLanguageChinese = 1;
|
||||
cc.kLanguageFrench = 2;
|
||||
cc.kLanguageItalian = 3;
|
||||
cc.kLanguageGerman = 4;
|
||||
cc.kLanguageSpanish = 5;
|
||||
cc.kLanguageRussian = 6;
|
||||
cc.kLanguageKorean = 7;
|
||||
cc.kLanguageJapanese = 8;
|
||||
cc.kLanguageHungarian = 9;
|
||||
cc.kLanguagePortuguese = 10;
|
||||
cc.kLanguageArabic = 11;
|
||||
|
||||
|
||||
cc.kTargetWindows = 0;
|
||||
cc.kTargetLinux = 1;
|
||||
cc.kTargetMacOS = 2;
|
||||
cc.kTargetAndroid = 3;
|
||||
cc.kTargetIphone = 4;
|
||||
cc.kTargetIpad = 5;
|
||||
cc.kTargetBlackBerry = 6;
|
||||
cc.kTargetNaCl = 7;
|
|
@ -14,7 +14,6 @@
|
|||
#include "jsb_pluginx_protocols_auto.hpp"
|
||||
#include "jsb_pluginx_flurry_auto.hpp"
|
||||
#include "jsb_pluginx_umeng_auto.hpp"
|
||||
#include "jsb_cocos2dx_other_auto.hpp"
|
||||
#include "jsb_pluginx_extension_registration.h"
|
||||
|
||||
USING_NS_CC;
|
||||
|
@ -53,7 +52,6 @@ bool AppDelegate::applicationDidFinishLaunching()
|
|||
sc->addRegisterCallback(register_all_pluginx_umeng);
|
||||
sc->addRegisterCallback(register_all_pluginx_flurry);
|
||||
sc->addRegisterCallback(register_pluginx_js_extensions);
|
||||
sc->addRegisterCallback(register_all_cocos2dx_other);
|
||||
sc->start();
|
||||
CCLOG("applicationDidFinishLaunching 02");
|
||||
CCScriptEngineProtocol *pEngine = ScriptingCore::getInstance();
|
||||
|
|
|
@ -69,7 +69,7 @@ var loadAnalyticsPlugin = function() {
|
|||
}
|
||||
|
||||
|
||||
if (cc.kLanguageChinese == langType)
|
||||
if (cc.LANGUAGE_CHINESE == langType)
|
||||
{
|
||||
g_pAnalytics = plugin.PluginManager.getInstance().loadPlugin("AnalyticsUmeng");
|
||||
s_strAppKey = umengKey;
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#include "jsb_pluginx_protocols_auto.hpp"
|
||||
#include "jsb_pluginx_alipay_auto.hpp"
|
||||
#include "jsb_pluginx_nd91_auto.hpp"
|
||||
#include "jsb_cocos2dx_other_auto.hpp"
|
||||
#include "jsb_pluginx_extension_registration.h"
|
||||
|
||||
USING_NS_CC;
|
||||
|
|
|
@ -31,9 +31,6 @@ check_return_value()
|
|||
./genbindings.sh "protocols"
|
||||
check_return_value "protocols"
|
||||
|
||||
./genbindings-cocos2dx-others.sh
|
||||
check_return_value "cocos2dx_others"
|
||||
|
||||
for i in "${PLUGIN_NAME[@]}"
|
||||
do
|
||||
echo $i
|
||||
|
|
|
@ -1,98 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
OUTPUT_FILENAME="jsb_cocos2dx_other_auto"
|
||||
# exit this script if any commmand fails
|
||||
set -e
|
||||
|
||||
# read user.cfg if it exists and is readable
|
||||
|
||||
_CFG_FILE=$(dirname "$0")"/user.cfg"
|
||||
if [ -f "$_CFG_FILE" ]
|
||||
then
|
||||
[ -r "$_CFG_FILE" ] || die "Fatal Error: $_CFG_FILE exists but is unreadable"
|
||||
. "$_CFG_FILE"
|
||||
fi
|
||||
|
||||
# paths
|
||||
|
||||
if [ -z "${NDK_ROOT+aaa}" ]; then
|
||||
# ... if NDK_ROOT is not set, use "$HOME/bin/android-ndk"
|
||||
NDK_ROOT="$HOME/bin/android-ndk"
|
||||
fi
|
||||
|
||||
if [ -z "${CLANG_ROOT+aaa}" ]; then
|
||||
# ... if CLANG_ROOT is not set, use "$HOME/bin/clang+llvm-3.1"
|
||||
CLANG_ROOT="$HOME/bin/clang+llvm-3.1"
|
||||
fi
|
||||
|
||||
if [ -z "${PYTHON_BIN+aaa}" ]; then
|
||||
# ... if PYTHON_BIN is not set, use "/usr/bin/python2.7"
|
||||
PYTHON_BIN="/usr/bin/python2.7"
|
||||
fi
|
||||
|
||||
# find current dir
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
# paths with defaults hardcoded to relative paths
|
||||
|
||||
if [ -z "${PLUGINX_ROOT+aaa}" ]; then
|
||||
PLUGINX_ROOT="$DIR/../.."
|
||||
fi
|
||||
|
||||
if [ -z "${CXX_GENERATOR_ROOT+aaa}" ]; then
|
||||
CXX_GENERATOR_ROOT="$PLUGINX_ROOT/../tools/bindings-generator"
|
||||
fi
|
||||
|
||||
if [ -z "${TOJS_ROOT+aaa}" ]; then
|
||||
TO_JS_ROOT="$PLUGINX_ROOT/tools/tojs"
|
||||
fi
|
||||
|
||||
echo "Paths"
|
||||
echo " NDK_ROOT: $NDK_ROOT"
|
||||
echo " CLANG_ROOT: $CLANG_ROOT"
|
||||
echo " PYTHON_BIN: $PYTHON_BIN"
|
||||
echo " PLUGINX_ROOT: $PLUGINX_ROOT"
|
||||
echo " CXX_GENERATOR_ROOT: $CXX_GENERATOR_ROOT"
|
||||
echo " TO_JS_ROOT: $TO_JS_ROOT"
|
||||
|
||||
# write userconf.ini
|
||||
|
||||
_CONF_INI_FILE="$PWD/userconf.ini"
|
||||
if [ -f "$_CONF_INI_FILE" ]
|
||||
then
|
||||
rm "$_CONF_INI_FILE"
|
||||
fi
|
||||
|
||||
_CONTENTS=""
|
||||
_CONTENTS+="[DEFAULT]"'\n'
|
||||
_CONTENTS+="androidndkdir=$NDK_ROOT"'\n'
|
||||
_CONTENTS+="clangllvmdir=$CLANG_ROOT"'\n'
|
||||
_CONTENTS+="cocosdir=$PLUGINX_ROOT/.."'\n'
|
||||
_CONTENTS+="pluginxdir=$PLUGINX_ROOT"'\n'
|
||||
_CONTENTS+="cxxgeneratordir=$CXX_GENERATOR_ROOT"'\n'
|
||||
echo
|
||||
echo "generating userconf.ini..."
|
||||
echo ---
|
||||
echo -e "$_CONTENTS"
|
||||
echo -e "$_CONTENTS" > "$_CONF_INI_FILE"
|
||||
echo ---
|
||||
|
||||
# Generate bindings for cocos2dx others
|
||||
echo "Generating bindings for cocos2dx others..."
|
||||
set -x
|
||||
mv $CXX_GENERATOR_ROOT/targets/spidermonkey/conversions.yaml $CXX_GENERATOR_ROOT/targets/spidermonkey/conversions.yaml.backup
|
||||
cp conversions.yaml $CXX_GENERATOR_ROOT/targets/spidermonkey
|
||||
|
||||
LD_LIBRARY_PATH=${CLANG_ROOT}/lib $PYTHON_BIN ${CXX_GENERATOR_ROOT}/generator.py ${PLUGINX_ROOT}/tools/tojs/jsb_cocos2dx_others.ini -s cocos2dx_other -o $PLUGINX_ROOT/jsbindings/auto -n $OUTPUT_FILENAME
|
||||
|
||||
mv $CXX_GENERATOR_ROOT/targets/spidermonkey/conversions.yaml.backup $CXX_GENERATOR_ROOT/targets/spidermonkey/conversions.yaml
|
||||
|
||||
# modify the include file
|
||||
# #include "cocos2d_specifics.hpp" -->
|
||||
# #include "jsb_pluginx_spidermonkey_specifics.h"
|
||||
# #include "jsb_pluginx_basic_conversions.h"
|
||||
|
||||
|
||||
./modify_include.sed $PLUGINX_ROOT/jsbindings/auto/$OUTPUT_FILENAME.cpp > $PLUGINX_ROOT/jsbindings/auto/$OUTPUT_FILENAME.cpp.origin
|
||||
mv $PLUGINX_ROOT/jsbindings/auto/$OUTPUT_FILENAME.cpp.origin $PLUGINX_ROOT/jsbindings/auto/$OUTPUT_FILENAME.cpp
|
||||
|
|
@ -1,59 +0,0 @@
|
|||
[cocos2dx_other]
|
||||
# the prefix to be added to the generated functions. You might or might not use this in your own
|
||||
# templates
|
||||
prefix = cocos2dx_other
|
||||
|
||||
# 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 = cc
|
||||
|
||||
android_headers = -I%(androidndkdir)s/platforms/android-14/arch-arm/usr/include -I%(androidndkdir)s/platforms/android-14/arch-arm/usr/include/linux -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.6/include -I%(androidndkdir)s/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86/lib/gcc/arm-linux-androideabi/4.6/include
|
||||
android_flags = -D_SIZE_T_DEFINED_
|
||||
|
||||
clang_headers = -I%(clangllvmdir)s/lib/clang/3.1/include
|
||||
clang_flags = -nostdinc -x c++
|
||||
|
||||
cocos_headers = -I%(cocosdir)s/cocos2dx/include -I%(cocosdir)s/cocos2dx/platform -I%(cocosdir)s/cocos2dx/platform/android -I%(cocosdir)s/cocos2dx -I%(cocosdir)s/cocos2dx/kazmath/include
|
||||
|
||||
cocos_flags = -DANDROID
|
||||
|
||||
cxxgenerator_headers = -I%(cxxgeneratordir)s/targets/spidermonkey/common
|
||||
|
||||
# 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
|
||||
|
||||
# what headers to parse
|
||||
headers = %(cocosdir)s/cocos2dx/include/cocos2d.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: "^CCMenu*$".
|
||||
classes = CCApplication CCApplicationProtocol
|
||||
|
||||
# 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 = *::[^application.* ^run$]
|
||||
|
||||
rename_functions = CCApplication::[sharedApplication=getInstance]
|
||||
|
||||
rename_classes =
|
||||
|
||||
# for all class names, should we remove something when registering in the target VM?
|
||||
remove_prefix = CC
|
||||
|
||||
# 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
|
||||
# CCSet is special and we will use a hand-written constructor
|
||||
abstract_classes = CCApplication CCApplicationProtocol
|
||||
|
||||
# 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 = yes
|
Loading…
Reference in New Issue