mirror of https://github.com/axmolengine/axmol.git
65830 lines
2.9 MiB
65830 lines
2.9 MiB
#include "scripting/js-bindings/auto/jsb_cocos2dx_auto.hpp"
|
|
#include "scripting/js-bindings/manual/cocos2d_specifics.hpp"
|
|
#include "cocos2d.h"
|
|
#include "audio/include/SimpleAudioEngine.h"
|
|
#include "2d/CCProtectedNode.h"
|
|
#include "base/CCAsyncTaskPool.h"
|
|
#include "scripting/js-bindings/manual/component/CCComponentJS.h"
|
|
|
|
template<class T>
|
|
static bool dummy_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS_ReportError(cx, "Constructor for the requested class is not available, please refer to the API reference.");
|
|
return false;
|
|
}
|
|
|
|
static bool empty_constructor(JSContext *cx, uint32_t argc, jsval *vp) {
|
|
return false;
|
|
}
|
|
|
|
static bool js_is_native_obj(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
args.rval().setBoolean(true);
|
|
return true;
|
|
}
|
|
JSClass *jsb_cocos2d_Texture2D_class;
|
|
JSObject *jsb_cocos2d_Texture2D_prototype;
|
|
|
|
bool js_cocos2dx_Texture2D_getGLProgram(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Texture2D* cobj = (cocos2d::Texture2D *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Texture2D_getGLProgram : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::GLProgram* ret = cobj->getGLProgram();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::GLProgram>(cx, (cocos2d::GLProgram*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Texture2D_getGLProgram : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Texture2D_getMaxT(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Texture2D* cobj = (cocos2d::Texture2D *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Texture2D_getMaxT : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getMaxT();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Texture2D_getMaxT : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Texture2D_setAlphaTexture(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Texture2D* cobj = (cocos2d::Texture2D *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Texture2D_setAlphaTexture : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Texture2D* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Texture2D*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Texture2D_setAlphaTexture : Error processing arguments");
|
|
cobj->setAlphaTexture(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Texture2D_setAlphaTexture : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Texture2D_getStringForFormat(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Texture2D* cobj = (cocos2d::Texture2D *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Texture2D_getStringForFormat : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const char* ret = cobj->getStringForFormat();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = c_string_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Texture2D_getStringForFormat : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Texture2D_initWithImage(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::Texture2D* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::Texture2D *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Texture2D_initWithImage : Invalid Native Object");
|
|
do {
|
|
if (argc == 2) {
|
|
cocos2d::Image* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Image*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Texture2D::PixelFormat arg1;
|
|
ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1);
|
|
if (!ok) { ok = true; break; }
|
|
bool ret = cobj->initWithImage(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 1) {
|
|
cocos2d::Image* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Image*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
if (!ok) { ok = true; break; }
|
|
bool ret = cobj->initWithImage(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Texture2D_initWithImage : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Texture2D_setGLProgram(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Texture2D* cobj = (cocos2d::Texture2D *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Texture2D_setGLProgram : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::GLProgram* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::GLProgram*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Texture2D_setGLProgram : Error processing arguments");
|
|
cobj->setGLProgram(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Texture2D_setGLProgram : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Texture2D_getMaxS(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Texture2D* cobj = (cocos2d::Texture2D *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Texture2D_getMaxS : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getMaxS();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Texture2D_getMaxS : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Texture2D_releaseGLTexture(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Texture2D* cobj = (cocos2d::Texture2D *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Texture2D_releaseGLTexture : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->releaseGLTexture();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Texture2D_releaseGLTexture : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Texture2D_hasPremultipliedAlpha(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Texture2D* cobj = (cocos2d::Texture2D *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Texture2D_hasPremultipliedAlpha : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->hasPremultipliedAlpha();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Texture2D_hasPremultipliedAlpha : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Texture2D_initWithMipmaps(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Texture2D* cobj = (cocos2d::Texture2D *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Texture2D_initWithMipmaps : Invalid Native Object");
|
|
if (argc == 5) {
|
|
cocos2d::_MipmapInfo* arg0 = nullptr;
|
|
int arg1 = 0;
|
|
cocos2d::Texture2D::PixelFormat arg2;
|
|
int arg3 = 0;
|
|
int arg4 = 0;
|
|
#pragma warning NO CONVERSION TO NATIVE FOR _MipmapInfo*
|
|
ok = false;
|
|
ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1);
|
|
ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2);
|
|
ok &= jsval_to_int32(cx, args.get(3), (int32_t *)&arg3);
|
|
ok &= jsval_to_int32(cx, args.get(4), (int32_t *)&arg4);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Texture2D_initWithMipmaps : Error processing arguments");
|
|
bool ret = cobj->initWithMipmaps(arg0, arg1, arg2, arg3, arg4);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Texture2D_initWithMipmaps : wrong number of arguments: %d, was expecting %d", argc, 5);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Texture2D_getPixelsHigh(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Texture2D* cobj = (cocos2d::Texture2D *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Texture2D_getPixelsHigh : Invalid Native Object");
|
|
if (argc == 0) {
|
|
int ret = cobj->getPixelsHigh();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = int32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Texture2D_getPixelsHigh : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Texture2D_getAlphaTextureName(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Texture2D* cobj = (cocos2d::Texture2D *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Texture2D_getAlphaTextureName : Invalid Native Object");
|
|
if (argc == 0) {
|
|
unsigned int ret = cobj->getAlphaTextureName();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = uint32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Texture2D_getAlphaTextureName : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Texture2D_getBitsPerPixelForFormat(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::Texture2D* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::Texture2D *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Texture2D_getBitsPerPixelForFormat : Invalid Native Object");
|
|
do {
|
|
if (argc == 1) {
|
|
cocos2d::Texture2D::PixelFormat arg0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
if (!ok) { ok = true; break; }
|
|
unsigned int ret = cobj->getBitsPerPixelForFormat(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = uint32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 0) {
|
|
unsigned int ret = cobj->getBitsPerPixelForFormat();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = uint32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Texture2D_getBitsPerPixelForFormat : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Texture2D_getName(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Texture2D* cobj = (cocos2d::Texture2D *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Texture2D_getName : Invalid Native Object");
|
|
if (argc == 0) {
|
|
unsigned int ret = cobj->getName();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = uint32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Texture2D_getName : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Texture2D_initWithString(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::Texture2D* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::Texture2D *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Texture2D_initWithString : Invalid Native Object");
|
|
do {
|
|
if (argc == 2) {
|
|
const char* arg0 = nullptr;
|
|
std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str();
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::FontDefinition arg1;
|
|
ok &= jsval_to_FontDefinition(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
bool ret = cobj->initWithString(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 3) {
|
|
const char* arg0 = nullptr;
|
|
std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str();
|
|
if (!ok) { ok = true; break; }
|
|
std::string arg1;
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
double arg2 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
if (!ok) { ok = true; break; }
|
|
bool ret = cobj->initWithString(arg0, arg1, arg2);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 4) {
|
|
const char* arg0 = nullptr;
|
|
std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str();
|
|
if (!ok) { ok = true; break; }
|
|
std::string arg1;
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
double arg2 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Size arg3;
|
|
ok &= jsval_to_ccsize(cx, args.get(3), &arg3);
|
|
if (!ok) { ok = true; break; }
|
|
bool ret = cobj->initWithString(arg0, arg1, arg2, arg3);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 5) {
|
|
const char* arg0 = nullptr;
|
|
std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str();
|
|
if (!ok) { ok = true; break; }
|
|
std::string arg1;
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
double arg2 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Size arg3;
|
|
ok &= jsval_to_ccsize(cx, args.get(3), &arg3);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::TextHAlignment arg4;
|
|
ok &= jsval_to_int32(cx, args.get(4), (int32_t *)&arg4);
|
|
if (!ok) { ok = true; break; }
|
|
bool ret = cobj->initWithString(arg0, arg1, arg2, arg3, arg4);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 6) {
|
|
const char* arg0 = nullptr;
|
|
std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str();
|
|
if (!ok) { ok = true; break; }
|
|
std::string arg1;
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
double arg2 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Size arg3;
|
|
ok &= jsval_to_ccsize(cx, args.get(3), &arg3);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::TextHAlignment arg4;
|
|
ok &= jsval_to_int32(cx, args.get(4), (int32_t *)&arg4);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::TextVAlignment arg5;
|
|
ok &= jsval_to_int32(cx, args.get(5), (int32_t *)&arg5);
|
|
if (!ok) { ok = true; break; }
|
|
bool ret = cobj->initWithString(arg0, arg1, arg2, arg3, arg4, arg5);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 7) {
|
|
const char* arg0 = nullptr;
|
|
std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str();
|
|
if (!ok) { ok = true; break; }
|
|
std::string arg1;
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
double arg2 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Size arg3;
|
|
ok &= jsval_to_ccsize(cx, args.get(3), &arg3);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::TextHAlignment arg4;
|
|
ok &= jsval_to_int32(cx, args.get(4), (int32_t *)&arg4);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::TextVAlignment arg5;
|
|
ok &= jsval_to_int32(cx, args.get(5), (int32_t *)&arg5);
|
|
if (!ok) { ok = true; break; }
|
|
bool arg6;
|
|
arg6 = JS::ToBoolean(args.get(6));
|
|
bool ret = cobj->initWithString(arg0, arg1, arg2, arg3, arg4, arg5, arg6);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 8) {
|
|
const char* arg0 = nullptr;
|
|
std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str();
|
|
if (!ok) { ok = true; break; }
|
|
std::string arg1;
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
double arg2 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Size arg3;
|
|
ok &= jsval_to_ccsize(cx, args.get(3), &arg3);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::TextHAlignment arg4;
|
|
ok &= jsval_to_int32(cx, args.get(4), (int32_t *)&arg4);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::TextVAlignment arg5;
|
|
ok &= jsval_to_int32(cx, args.get(5), (int32_t *)&arg5);
|
|
if (!ok) { ok = true; break; }
|
|
bool arg6;
|
|
arg6 = JS::ToBoolean(args.get(6));
|
|
int arg7 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(7), (int32_t *)&arg7);
|
|
if (!ok) { ok = true; break; }
|
|
bool ret = cobj->initWithString(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Texture2D_initWithString : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Texture2D_setMaxT(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Texture2D* cobj = (cocos2d::Texture2D *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Texture2D_setMaxT : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Texture2D_setMaxT : Error processing arguments");
|
|
cobj->setMaxT(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Texture2D_setMaxT : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Texture2D_getPath(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Texture2D* cobj = (cocos2d::Texture2D *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Texture2D_getPath : Invalid Native Object");
|
|
if (argc == 0) {
|
|
std::string ret = cobj->getPath();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = std_string_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Texture2D_getPath : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Texture2D_drawInRect(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Texture2D* cobj = (cocos2d::Texture2D *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Texture2D_drawInRect : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Rect arg0;
|
|
ok &= jsval_to_ccrect(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Texture2D_drawInRect : Error processing arguments");
|
|
cobj->drawInRect(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Texture2D_drawInRect : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Texture2D_getContentSize(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Texture2D* cobj = (cocos2d::Texture2D *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Texture2D_getContentSize : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::Size ret = cobj->getContentSize();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ccsize_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Texture2D_getContentSize : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Texture2D_setAliasTexParameters(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Texture2D* cobj = (cocos2d::Texture2D *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Texture2D_setAliasTexParameters : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->setAliasTexParameters();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Texture2D_setAliasTexParameters : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Texture2D_setAntiAliasTexParameters(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Texture2D* cobj = (cocos2d::Texture2D *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Texture2D_setAntiAliasTexParameters : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->setAntiAliasTexParameters();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Texture2D_setAntiAliasTexParameters : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Texture2D_generateMipmap(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Texture2D* cobj = (cocos2d::Texture2D *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Texture2D_generateMipmap : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->generateMipmap();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Texture2D_generateMipmap : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Texture2D_getDescription(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Texture2D* cobj = (cocos2d::Texture2D *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Texture2D_getDescription : Invalid Native Object");
|
|
if (argc == 0) {
|
|
std::string ret = cobj->getDescription();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = std_string_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Texture2D_getDescription : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Texture2D_getPixelFormat(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Texture2D* cobj = (cocos2d::Texture2D *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Texture2D_getPixelFormat : Invalid Native Object");
|
|
if (argc == 0) {
|
|
int ret = (int)cobj->getPixelFormat();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = int32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Texture2D_getPixelFormat : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Texture2D_getContentSizeInPixels(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Texture2D* cobj = (cocos2d::Texture2D *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Texture2D_getContentSizeInPixels : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const cocos2d::Size& ret = cobj->getContentSizeInPixels();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ccsize_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Texture2D_getContentSizeInPixels : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Texture2D_getPixelsWide(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Texture2D* cobj = (cocos2d::Texture2D *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Texture2D_getPixelsWide : Invalid Native Object");
|
|
if (argc == 0) {
|
|
int ret = cobj->getPixelsWide();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = int32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Texture2D_getPixelsWide : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Texture2D_drawAtPoint(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Texture2D* cobj = (cocos2d::Texture2D *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Texture2D_drawAtPoint : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Vec2 arg0;
|
|
ok &= jsval_to_vector2(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Texture2D_drawAtPoint : Error processing arguments");
|
|
cobj->drawAtPoint(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Texture2D_drawAtPoint : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Texture2D_hasMipmaps(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Texture2D* cobj = (cocos2d::Texture2D *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Texture2D_hasMipmaps : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->hasMipmaps();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Texture2D_hasMipmaps : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Texture2D_setMaxS(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Texture2D* cobj = (cocos2d::Texture2D *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Texture2D_setMaxS : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Texture2D_setMaxS : Error processing arguments");
|
|
cobj->setMaxS(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Texture2D_setMaxS : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Texture2D_setDefaultAlphaPixelFormat(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
cocos2d::Texture2D::PixelFormat arg0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Texture2D_setDefaultAlphaPixelFormat : Error processing arguments");
|
|
cocos2d::Texture2D::setDefaultAlphaPixelFormat(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_Texture2D_setDefaultAlphaPixelFormat : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_Texture2D_getDefaultAlphaPixelFormat(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
if (argc == 0) {
|
|
|
|
int ret = (int)cocos2d::Texture2D::getDefaultAlphaPixelFormat();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = int32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_Texture2D_getDefaultAlphaPixelFormat : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_Texture2D_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::Texture2D* cobj = new (std::nothrow) cocos2d::Texture2D();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::Texture2D>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::Texture2D"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
|
|
|
|
void js_register_cocos2dx_Texture2D(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_Texture2D_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_Texture2D_class->name = "Texture2D";
|
|
jsb_cocos2d_Texture2D_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Texture2D_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_Texture2D_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Texture2D_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_Texture2D_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_Texture2D_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_Texture2D_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_Texture2D_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("getShaderProgram", js_cocos2dx_Texture2D_getGLProgram, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getMaxT", js_cocos2dx_Texture2D_getMaxT, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setAlphaTexture", js_cocos2dx_Texture2D_setAlphaTexture, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getStringForFormat", js_cocos2dx_Texture2D_getStringForFormat, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initWithImage", js_cocos2dx_Texture2D_initWithImage, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setShaderProgram", js_cocos2dx_Texture2D_setGLProgram, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getMaxS", js_cocos2dx_Texture2D_getMaxS, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("releaseGLTexture", js_cocos2dx_Texture2D_releaseGLTexture, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("hasPremultipliedAlpha", js_cocos2dx_Texture2D_hasPremultipliedAlpha, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initWithMipmaps", js_cocos2dx_Texture2D_initWithMipmaps, 5, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getPixelsHigh", js_cocos2dx_Texture2D_getPixelsHigh, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getAlphaTextureName", js_cocos2dx_Texture2D_getAlphaTextureName, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getBitsPerPixelForFormat", js_cocos2dx_Texture2D_getBitsPerPixelForFormat, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getName", js_cocos2dx_Texture2D_getName, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initWithString", js_cocos2dx_Texture2D_initWithString, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setMaxT", js_cocos2dx_Texture2D_setMaxT, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getPath", js_cocos2dx_Texture2D_getPath, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("drawInRect", js_cocos2dx_Texture2D_drawInRect, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getContentSize", js_cocos2dx_Texture2D_getContentSize, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setAliasTexParameters", js_cocos2dx_Texture2D_setAliasTexParameters, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setAntiAliasTexParameters", js_cocos2dx_Texture2D_setAntiAliasTexParameters, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("generateMipmap", js_cocos2dx_Texture2D_generateMipmap, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getDescription", js_cocos2dx_Texture2D_getDescription, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getPixelFormat", js_cocos2dx_Texture2D_getPixelFormat, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getContentSizeInPixels", js_cocos2dx_Texture2D_getContentSizeInPixels, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getPixelsWide", js_cocos2dx_Texture2D_getPixelsWide, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("drawAtPoint", js_cocos2dx_Texture2D_drawAtPoint, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("hasMipmaps", js_cocos2dx_Texture2D_hasMipmaps, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setMaxS", js_cocos2dx_Texture2D_setMaxS, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("setDefaultAlphaPixelFormat", js_cocos2dx_Texture2D_setDefaultAlphaPixelFormat, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getDefaultAlphaPixelFormat", js_cocos2dx_Texture2D_getDefaultAlphaPixelFormat, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
jsb_cocos2d_Texture2D_prototype = JS_InitClass(
|
|
cx, global,
|
|
JS::NullPtr(),
|
|
jsb_cocos2d_Texture2D_class,
|
|
js_cocos2dx_Texture2D_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_Texture2D_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "Texture2D"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::Texture2D>(cx, jsb_cocos2d_Texture2D_class, proto, JS::NullPtr());
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_Touch_class;
|
|
JSObject *jsb_cocos2d_Touch_prototype;
|
|
|
|
bool js_cocos2dx_Touch_getPreviousLocationInView(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Touch* cobj = (cocos2d::Touch *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Touch_getPreviousLocationInView : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::Vec2 ret = cobj->getPreviousLocationInView();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = vector2_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Touch_getPreviousLocationInView : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Touch_getLocation(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Touch* cobj = (cocos2d::Touch *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Touch_getLocation : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::Vec2 ret = cobj->getLocation();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = vector2_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Touch_getLocation : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Touch_getDelta(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Touch* cobj = (cocos2d::Touch *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Touch_getDelta : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::Vec2 ret = cobj->getDelta();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = vector2_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Touch_getDelta : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Touch_getStartLocationInView(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Touch* cobj = (cocos2d::Touch *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Touch_getStartLocationInView : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::Vec2 ret = cobj->getStartLocationInView();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = vector2_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Touch_getStartLocationInView : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Touch_getCurrentForce(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Touch* cobj = (cocos2d::Touch *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Touch_getCurrentForce : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getCurrentForce();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Touch_getCurrentForce : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Touch_getStartLocation(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Touch* cobj = (cocos2d::Touch *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Touch_getStartLocation : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::Vec2 ret = cobj->getStartLocation();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = vector2_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Touch_getStartLocation : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Touch_getID(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Touch* cobj = (cocos2d::Touch *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Touch_getID : Invalid Native Object");
|
|
if (argc == 0) {
|
|
int ret = cobj->getID();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = int32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Touch_getID : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Touch_setTouchInfo(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::Touch* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::Touch *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Touch_setTouchInfo : Invalid Native Object");
|
|
do {
|
|
if (argc == 5) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
if (!ok) { ok = true; break; }
|
|
double arg1 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
if (!ok) { ok = true; break; }
|
|
double arg2 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
if (!ok) { ok = true; break; }
|
|
double arg3 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(3), &arg3) && !std::isnan(arg3);
|
|
if (!ok) { ok = true; break; }
|
|
double arg4 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(4), &arg4) && !std::isnan(arg4);
|
|
if (!ok) { ok = true; break; }
|
|
cobj->setTouchInfo(arg0, arg1, arg2, arg3, arg4);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 3) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
if (!ok) { ok = true; break; }
|
|
double arg1 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
if (!ok) { ok = true; break; }
|
|
double arg2 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
if (!ok) { ok = true; break; }
|
|
cobj->setTouchInfo(arg0, arg1, arg2);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Touch_setTouchInfo : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Touch_getMaxForce(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Touch* cobj = (cocos2d::Touch *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Touch_getMaxForce : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getMaxForce();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Touch_getMaxForce : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Touch_getLocationInView(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Touch* cobj = (cocos2d::Touch *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Touch_getLocationInView : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::Vec2 ret = cobj->getLocationInView();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = vector2_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Touch_getLocationInView : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Touch_getPreviousLocation(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Touch* cobj = (cocos2d::Touch *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Touch_getPreviousLocation : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::Vec2 ret = cobj->getPreviousLocation();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = vector2_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Touch_getPreviousLocation : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Touch_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::Touch* cobj = new (std::nothrow) cocos2d::Touch();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::Touch>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::Touch"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
|
|
|
|
void js_register_cocos2dx_Touch(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_Touch_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_Touch_class->name = "Touch";
|
|
jsb_cocos2d_Touch_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Touch_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_Touch_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Touch_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_Touch_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_Touch_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_Touch_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_Touch_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("getPreviousLocationInView", js_cocos2dx_Touch_getPreviousLocationInView, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getLocation", js_cocos2dx_Touch_getLocation, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getDelta", js_cocos2dx_Touch_getDelta, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getStartLocationInView", js_cocos2dx_Touch_getStartLocationInView, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getCurrentForce", js_cocos2dx_Touch_getCurrentForce, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getStartLocation", js_cocos2dx_Touch_getStartLocation, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getID", js_cocos2dx_Touch_getID, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setTouchInfo", js_cocos2dx_Touch_setTouchInfo, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getMaxForce", js_cocos2dx_Touch_getMaxForce, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getLocationInView", js_cocos2dx_Touch_getLocationInView, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getPreviousLocation", js_cocos2dx_Touch_getPreviousLocation, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JSFunctionSpec *st_funcs = NULL;
|
|
|
|
jsb_cocos2d_Touch_prototype = JS_InitClass(
|
|
cx, global,
|
|
JS::NullPtr(),
|
|
jsb_cocos2d_Touch_class,
|
|
js_cocos2dx_Touch_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_Touch_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "Touch"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::Touch>(cx, jsb_cocos2d_Touch_class, proto, JS::NullPtr());
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_Event_class;
|
|
JSObject *jsb_cocos2d_Event_prototype;
|
|
|
|
bool js_cocos2dx_Event_isStopped(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Event* cobj = (cocos2d::Event *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Event_isStopped : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->isStopped();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Event_isStopped : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Event_getType(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Event* cobj = (cocos2d::Event *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Event_getType : Invalid Native Object");
|
|
if (argc == 0) {
|
|
int ret = (int)cobj->getType();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = int32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Event_getType : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Event_getCurrentTarget(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Event* cobj = (cocos2d::Event *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Event_getCurrentTarget : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::Node* ret = cobj->getCurrentTarget();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Node>(cx, (cocos2d::Node*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Event_getCurrentTarget : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Event_stopPropagation(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Event* cobj = (cocos2d::Event *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Event_stopPropagation : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->stopPropagation();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Event_stopPropagation : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Event_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::Event::Type arg0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Event_constructor : Error processing arguments");
|
|
cocos2d::Event* cobj = new (std::nothrow) cocos2d::Event(arg0);
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::Event>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::Event"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
|
|
|
|
void js_register_cocos2dx_Event(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_Event_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_Event_class->name = "Event";
|
|
jsb_cocos2d_Event_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Event_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_Event_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Event_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_Event_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_Event_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_Event_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_Event_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("isStopped", js_cocos2dx_Event_isStopped, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getType", js_cocos2dx_Event_getType, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getCurrentTarget", js_cocos2dx_Event_getCurrentTarget, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("stopPropagation", js_cocos2dx_Event_stopPropagation, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JSFunctionSpec *st_funcs = NULL;
|
|
|
|
jsb_cocos2d_Event_prototype = JS_InitClass(
|
|
cx, global,
|
|
JS::NullPtr(),
|
|
jsb_cocos2d_Event_class,
|
|
js_cocos2dx_Event_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_Event_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "Event"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::Event>(cx, jsb_cocos2d_Event_class, proto, JS::NullPtr());
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_EventTouch_class;
|
|
JSObject *jsb_cocos2d_EventTouch_prototype;
|
|
|
|
bool js_cocos2dx_EventTouch_getEventCode(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::EventTouch* cobj = (cocos2d::EventTouch *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventTouch_getEventCode : Invalid Native Object");
|
|
if (argc == 0) {
|
|
int ret = (int)cobj->getEventCode();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = int32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_EventTouch_getEventCode : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_EventTouch_setEventCode(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::EventTouch* cobj = (cocos2d::EventTouch *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventTouch_setEventCode : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::EventTouch::EventCode arg0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EventTouch_setEventCode : Error processing arguments");
|
|
cobj->setEventCode(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_EventTouch_setEventCode : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_EventTouch_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::EventTouch* cobj = new (std::nothrow) cocos2d::EventTouch();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EventTouch>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::EventTouch"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_Event_prototype;
|
|
|
|
void js_register_cocos2dx_EventTouch(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_EventTouch_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_EventTouch_class->name = "EventTouch";
|
|
jsb_cocos2d_EventTouch_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EventTouch_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_EventTouch_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EventTouch_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_EventTouch_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_EventTouch_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_EventTouch_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_EventTouch_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("getEventCode", js_cocos2dx_EventTouch_getEventCode, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setEventCode", js_cocos2dx_EventTouch_setEventCode, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JSFunctionSpec *st_funcs = NULL;
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_Event_prototype);
|
|
jsb_cocos2d_EventTouch_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_EventTouch_class,
|
|
js_cocos2dx_EventTouch_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_EventTouch_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "EventTouch"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::EventTouch>(cx, jsb_cocos2d_EventTouch_class, proto, parent_proto);
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_ComponentContainer_class;
|
|
JSObject *jsb_cocos2d_ComponentContainer_prototype;
|
|
|
|
bool js_cocos2dx_ComponentContainer_visit(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ComponentContainer* cobj = (cocos2d::ComponentContainer *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ComponentContainer_visit : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ComponentContainer_visit : Error processing arguments");
|
|
cobj->visit(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ComponentContainer_visit : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ComponentContainer_remove(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::ComponentContainer* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::ComponentContainer *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ComponentContainer_remove : Invalid Native Object");
|
|
do {
|
|
if (argc == 1) {
|
|
cocos2d::Component* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Component*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
if (!ok) { ok = true; break; }
|
|
bool ret = cobj->remove(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
bool ret = cobj->remove(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ComponentContainer_remove : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ComponentContainer_removeAll(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ComponentContainer* cobj = (cocos2d::ComponentContainer *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ComponentContainer_removeAll : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->removeAll();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ComponentContainer_removeAll : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ComponentContainer_add(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ComponentContainer* cobj = (cocos2d::ComponentContainer *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ComponentContainer_add : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Component* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Component*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ComponentContainer_add : Error processing arguments");
|
|
bool ret = cobj->add(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ComponentContainer_add : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ComponentContainer_isEmpty(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ComponentContainer* cobj = (cocos2d::ComponentContainer *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ComponentContainer_isEmpty : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->isEmpty();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ComponentContainer_isEmpty : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ComponentContainer_get(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ComponentContainer* cobj = (cocos2d::ComponentContainer *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ComponentContainer_get : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ComponentContainer_get : Error processing arguments");
|
|
cocos2d::Component* ret = cobj->get(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Component>(cx, (cocos2d::Component*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ComponentContainer_get : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
|
|
void js_register_cocos2dx_ComponentContainer(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_ComponentContainer_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_ComponentContainer_class->name = "ComponentContainer";
|
|
jsb_cocos2d_ComponentContainer_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_ComponentContainer_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_ComponentContainer_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_ComponentContainer_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_ComponentContainer_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_ComponentContainer_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_ComponentContainer_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_ComponentContainer_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("visit", js_cocos2dx_ComponentContainer_visit, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("remove", js_cocos2dx_ComponentContainer_remove, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("removeAll", js_cocos2dx_ComponentContainer_removeAll, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("add", js_cocos2dx_ComponentContainer_add, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("isEmpty", js_cocos2dx_ComponentContainer_isEmpty, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getComponent", js_cocos2dx_ComponentContainer_get, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JSFunctionSpec *st_funcs = NULL;
|
|
|
|
jsb_cocos2d_ComponentContainer_prototype = JS_InitClass(
|
|
cx, global,
|
|
JS::NullPtr(),
|
|
jsb_cocos2d_ComponentContainer_class,
|
|
empty_constructor, 0,
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_ComponentContainer_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "ComponentContainer"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::FalseHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::ComponentContainer>(cx, jsb_cocos2d_ComponentContainer_class, proto, JS::NullPtr());
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_Component_class;
|
|
JSObject *jsb_cocos2d_Component_prototype;
|
|
|
|
bool js_cocos2dx_Component_setEnabled(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Component* cobj = (cocos2d::Component *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Component_setEnabled : Invalid Native Object");
|
|
if (argc == 1) {
|
|
bool arg0;
|
|
arg0 = JS::ToBoolean(args.get(0));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Component_setEnabled : Error processing arguments");
|
|
cobj->setEnabled(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Component_setEnabled : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Component_setName(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Component* cobj = (cocos2d::Component *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Component_setName : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Component_setName : Error processing arguments");
|
|
cobj->setName(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Component_setName : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Component_isEnabled(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Component* cobj = (cocos2d::Component *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Component_isEnabled : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->isEnabled();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Component_isEnabled : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Component_getOwner(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Component* cobj = (cocos2d::Component *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Component_getOwner : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::Node* ret = cobj->getOwner();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Node>(cx, (cocos2d::Node*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Component_getOwner : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Component_init(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Component* cobj = (cocos2d::Component *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Component_init : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->init();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Component_init : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Component_setOwner(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Component* cobj = (cocos2d::Component *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Component_setOwner : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Node* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Component_setOwner : Error processing arguments");
|
|
cobj->setOwner(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Component_setOwner : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Component_getName(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Component* cobj = (cocos2d::Component *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Component_getName : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const std::string& ret = cobj->getName();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = std_string_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Component_getName : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Component_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
if (argc == 0) {
|
|
|
|
auto ret = cocos2d::Component::create();
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::Component>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::Component"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_Component_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_Component_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::Component* cobj = new (std::nothrow) cocos2d::Component();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::Component>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::Component"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_Component_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::Component *nobj = new (std::nothrow) cocos2d::Component();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::Component");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
|
|
void js_register_cocos2dx_Component(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_Component_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_Component_class->name = "Component";
|
|
jsb_cocos2d_Component_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Component_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_Component_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Component_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_Component_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_Component_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_Component_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_Component_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("setEnabled", js_cocos2dx_Component_setEnabled, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setName", js_cocos2dx_Component_setName, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("isEnabled", js_cocos2dx_Component_isEnabled, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getOwner", js_cocos2dx_Component_getOwner, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("init", js_cocos2dx_Component_init, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setOwner", js_cocos2dx_Component_setOwner, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getName", js_cocos2dx_Component_getName, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_Component_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_Component_create, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
jsb_cocos2d_Component_prototype = JS_InitClass(
|
|
cx, global,
|
|
JS::NullPtr(),
|
|
jsb_cocos2d_Component_class,
|
|
js_cocos2dx_Component_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_Component_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "Component"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::Component>(cx, jsb_cocos2d_Component_class, proto, JS::NullPtr());
|
|
anonEvaluate(cx, global, "(function () { cc.Component.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_Node_class;
|
|
JSObject *jsb_cocos2d_Node_prototype;
|
|
|
|
bool js_cocos2dx_Node_addChild(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::Node* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::Node *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_addChild : Invalid Native Object");
|
|
do {
|
|
if (argc == 2) {
|
|
cocos2d::Node* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
if (!ok) { ok = true; break; }
|
|
int arg1 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1);
|
|
if (!ok) { ok = true; break; }
|
|
cobj->addChild(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 1) {
|
|
cocos2d::Node* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
if (!ok) { ok = true; break; }
|
|
cobj->addChild(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 3) {
|
|
cocos2d::Node* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
if (!ok) { ok = true; break; }
|
|
int arg1 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1);
|
|
if (!ok) { ok = true; break; }
|
|
int arg2 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2);
|
|
if (!ok) { ok = true; break; }
|
|
cobj->addChild(arg0, arg1, arg2);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 3) {
|
|
cocos2d::Node* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
if (!ok) { ok = true; break; }
|
|
int arg1 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1);
|
|
if (!ok) { ok = true; break; }
|
|
std::string arg2;
|
|
ok &= jsval_to_std_string(cx, args.get(2), &arg2);
|
|
if (!ok) { ok = true; break; }
|
|
cobj->addChild(arg0, arg1, arg2);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_addChild : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_removeComponent(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::Node* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::Node *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_removeComponent : Invalid Native Object");
|
|
do {
|
|
if (argc == 1) {
|
|
cocos2d::Component* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Component*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
if (!ok) { ok = true; break; }
|
|
bool ret = cobj->removeComponent(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
bool ret = cobj->removeComponent(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_removeComponent : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_setPhysicsBody(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setPhysicsBody : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::PhysicsBody* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::PhysicsBody*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setPhysicsBody : Error processing arguments");
|
|
cobj->setPhysicsBody(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_setPhysicsBody : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_getGLProgram(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getGLProgram : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::GLProgram* ret = cobj->getGLProgram();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::GLProgram>(cx, (cocos2d::GLProgram*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_getGLProgram : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_getDescription(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getDescription : Invalid Native Object");
|
|
if (argc == 0) {
|
|
std::string ret = cobj->getDescription();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = std_string_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_getDescription : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_setOpacityModifyRGB(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setOpacityModifyRGB : Invalid Native Object");
|
|
if (argc == 1) {
|
|
bool arg0;
|
|
arg0 = JS::ToBoolean(args.get(0));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setOpacityModifyRGB : Error processing arguments");
|
|
cobj->setOpacityModifyRGB(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_setOpacityModifyRGB : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_setCascadeOpacityEnabled(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setCascadeOpacityEnabled : Invalid Native Object");
|
|
if (argc == 1) {
|
|
bool arg0;
|
|
arg0 = JS::ToBoolean(args.get(0));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setCascadeOpacityEnabled : Error processing arguments");
|
|
cobj->setCascadeOpacityEnabled(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_setCascadeOpacityEnabled : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_getChildren(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::Node* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::Node *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getChildren : Invalid Native Object");
|
|
do {
|
|
if (argc == 0) {
|
|
const cocos2d::Vector<cocos2d::Node *>& ret = cobj->getChildren();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ccvector_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 0) {
|
|
cocos2d::Vector<cocos2d::Node *>& ret = cobj->getChildren();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ccvector_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_getChildren : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_setOnExitCallback(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setOnExitCallback : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::function<void ()> arg0;
|
|
do {
|
|
if(JS_TypeOfValue(cx, args.get(0)) == JSTYPE_FUNCTION)
|
|
{
|
|
JS::RootedObject jstarget(cx, args.thisv().toObjectOrNull());
|
|
std::shared_ptr<JSFunctionWrapper> func(new JSFunctionWrapper(cx, jstarget, args.get(0), args.thisv()));
|
|
auto lambda = [=]() -> void {
|
|
JSB_AUTOCOMPARTMENT_WITH_GLOBAL_OBJCET
|
|
JS::RootedValue rval(cx);
|
|
bool succeed = func->invoke(0, nullptr, &rval);
|
|
if (!succeed && JS_IsExceptionPending(cx)) {
|
|
JS_ReportPendingException(cx);
|
|
}
|
|
};
|
|
arg0 = lambda;
|
|
}
|
|
else
|
|
{
|
|
arg0 = nullptr;
|
|
}
|
|
} while(0)
|
|
;
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setOnExitCallback : Error processing arguments");
|
|
cobj->setOnExitCallback(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_setOnExitCallback : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_setActionManager(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setActionManager : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::ActionManager* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::ActionManager*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setActionManager : Error processing arguments");
|
|
cobj->setActionManager(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_setActionManager : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_isIgnoreAnchorPointForPosition(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_isIgnoreAnchorPointForPosition : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->isIgnoreAnchorPointForPosition();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_isIgnoreAnchorPointForPosition : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_getChildByName(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getChildByName : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_getChildByName : Error processing arguments");
|
|
cocos2d::Node* ret = cobj->getChildByName(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Node>(cx, (cocos2d::Node*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_getChildByName : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_updateDisplayedOpacity(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_updateDisplayedOpacity : Invalid Native Object");
|
|
if (argc == 1) {
|
|
uint16_t arg0;
|
|
ok &= jsval_to_uint16(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_updateDisplayedOpacity : Error processing arguments");
|
|
cobj->updateDisplayedOpacity(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_updateDisplayedOpacity : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_init(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_init : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->init();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_init : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_getCameraMask(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getCameraMask : Invalid Native Object");
|
|
if (argc == 0) {
|
|
unsigned short ret = cobj->getCameraMask();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ushort_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_getCameraMask : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_setRotation(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setRotation : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setRotation : Error processing arguments");
|
|
cobj->setRotation(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_setRotation : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_setScaleZ(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setScaleZ : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setScaleZ : Error processing arguments");
|
|
cobj->setScaleZ(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_setScaleZ : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_setScaleY(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setScaleY : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setScaleY : Error processing arguments");
|
|
cobj->setScaleY(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_setScaleY : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_setScaleX(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setScaleX : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setScaleX : Error processing arguments");
|
|
cobj->setScaleX(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_setScaleX : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_getColor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getColor : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const cocos2d::Color3B& ret = cobj->getColor();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = cccolor3b_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_getColor : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_setonEnterTransitionDidFinishCallback(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setonEnterTransitionDidFinishCallback : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::function<void ()> arg0;
|
|
do {
|
|
if(JS_TypeOfValue(cx, args.get(0)) == JSTYPE_FUNCTION)
|
|
{
|
|
JS::RootedObject jstarget(cx, args.thisv().toObjectOrNull());
|
|
std::shared_ptr<JSFunctionWrapper> func(new JSFunctionWrapper(cx, jstarget, args.get(0), args.thisv()));
|
|
auto lambda = [=]() -> void {
|
|
JSB_AUTOCOMPARTMENT_WITH_GLOBAL_OBJCET
|
|
JS::RootedValue rval(cx);
|
|
bool succeed = func->invoke(0, nullptr, &rval);
|
|
if (!succeed && JS_IsExceptionPending(cx)) {
|
|
JS_ReportPendingException(cx);
|
|
}
|
|
};
|
|
arg0 = lambda;
|
|
}
|
|
else
|
|
{
|
|
arg0 = nullptr;
|
|
}
|
|
} while(0)
|
|
;
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setonEnterTransitionDidFinishCallback : Error processing arguments");
|
|
cobj->setonEnterTransitionDidFinishCallback(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_setonEnterTransitionDidFinishCallback : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_removeAllComponents(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_removeAllComponents : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->removeAllComponents();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_removeAllComponents : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node__setLocalZOrder(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node__setLocalZOrder : Invalid Native Object");
|
|
if (argc == 1) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node__setLocalZOrder : Error processing arguments");
|
|
cobj->_setLocalZOrder(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node__setLocalZOrder : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_setCameraMask(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setCameraMask : Invalid Native Object");
|
|
if (argc == 1) {
|
|
unsigned short arg0 = 0;
|
|
ok &= jsval_to_ushort(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setCameraMask : Error processing arguments");
|
|
cobj->setCameraMask(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
if (argc == 2) {
|
|
unsigned short arg0 = 0;
|
|
bool arg1;
|
|
ok &= jsval_to_ushort(cx, args.get(0), &arg0);
|
|
arg1 = JS::ToBoolean(args.get(1));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setCameraMask : Error processing arguments");
|
|
cobj->setCameraMask(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_setCameraMask : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_getTag(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getTag : Invalid Native Object");
|
|
if (argc == 0) {
|
|
int ret = cobj->getTag();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = int32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_getTag : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_getonEnterTransitionDidFinishCallback(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getonEnterTransitionDidFinishCallback : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const std::function<void ()>& ret = cobj->getonEnterTransitionDidFinishCallback();
|
|
jsval jsret = JSVAL_NULL;
|
|
#pragma warning NO CONVERSION FROM NATIVE FOR std::function;
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_getonEnterTransitionDidFinishCallback : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_getNodeToWorldAffineTransform(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getNodeToWorldAffineTransform : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::AffineTransform ret = cobj->getNodeToWorldAffineTransform();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ccaffinetransform_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_getNodeToWorldAffineTransform : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_getPosition3D(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getPosition3D : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::Vec3 ret = cobj->getPosition3D();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = vector3_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_getPosition3D : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_removeChild(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_removeChild : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Node* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_removeChild : Error processing arguments");
|
|
cobj->removeChild(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
if (argc == 2) {
|
|
cocos2d::Node* arg0 = nullptr;
|
|
bool arg1;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
arg1 = JS::ToBoolean(args.get(1));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_removeChild : Error processing arguments");
|
|
cobj->removeChild(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_removeChild : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_getScene(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getScene : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::Scene* ret = cobj->getScene();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Scene>(cx, (cocos2d::Scene*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_getScene : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_getEventDispatcher(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getEventDispatcher : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::EventDispatcher* ret = cobj->getEventDispatcher();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::EventDispatcher>(cx, (cocos2d::EventDispatcher*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_getEventDispatcher : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_setSkewX(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setSkewX : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setSkewX : Error processing arguments");
|
|
cobj->setSkewX(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_setSkewX : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_setGLProgramState(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setGLProgramState : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::GLProgramState* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::GLProgramState*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setGLProgramState : Error processing arguments");
|
|
cobj->setGLProgramState(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_setGLProgramState : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_setOnEnterCallback(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setOnEnterCallback : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::function<void ()> arg0;
|
|
do {
|
|
if(JS_TypeOfValue(cx, args.get(0)) == JSTYPE_FUNCTION)
|
|
{
|
|
JS::RootedObject jstarget(cx, args.thisv().toObjectOrNull());
|
|
std::shared_ptr<JSFunctionWrapper> func(new JSFunctionWrapper(cx, jstarget, args.get(0), args.thisv()));
|
|
auto lambda = [=]() -> void {
|
|
JSB_AUTOCOMPARTMENT_WITH_GLOBAL_OBJCET
|
|
JS::RootedValue rval(cx);
|
|
bool succeed = func->invoke(0, nullptr, &rval);
|
|
if (!succeed && JS_IsExceptionPending(cx)) {
|
|
JS_ReportPendingException(cx);
|
|
}
|
|
};
|
|
arg0 = lambda;
|
|
}
|
|
else
|
|
{
|
|
arg0 = nullptr;
|
|
}
|
|
} while(0)
|
|
;
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setOnEnterCallback : Error processing arguments");
|
|
cobj->setOnEnterCallback(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_setOnEnterCallback : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_stopActionsByFlags(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_stopActionsByFlags : Invalid Native Object");
|
|
if (argc == 1) {
|
|
unsigned int arg0 = 0;
|
|
ok &= jsval_to_uint32(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_stopActionsByFlags : Error processing arguments");
|
|
cobj->stopActionsByFlags(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_stopActionsByFlags : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_setNormalizedPosition(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setNormalizedPosition : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Vec2 arg0;
|
|
ok &= jsval_to_vector2(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setNormalizedPosition : Error processing arguments");
|
|
cobj->setNormalizedPosition(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_setNormalizedPosition : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_setonExitTransitionDidStartCallback(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setonExitTransitionDidStartCallback : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::function<void ()> arg0;
|
|
do {
|
|
if(JS_TypeOfValue(cx, args.get(0)) == JSTYPE_FUNCTION)
|
|
{
|
|
JS::RootedObject jstarget(cx, args.thisv().toObjectOrNull());
|
|
std::shared_ptr<JSFunctionWrapper> func(new JSFunctionWrapper(cx, jstarget, args.get(0), args.thisv()));
|
|
auto lambda = [=]() -> void {
|
|
JSB_AUTOCOMPARTMENT_WITH_GLOBAL_OBJCET
|
|
JS::RootedValue rval(cx);
|
|
bool succeed = func->invoke(0, nullptr, &rval);
|
|
if (!succeed && JS_IsExceptionPending(cx)) {
|
|
JS_ReportPendingException(cx);
|
|
}
|
|
};
|
|
arg0 = lambda;
|
|
}
|
|
else
|
|
{
|
|
arg0 = nullptr;
|
|
}
|
|
} while(0)
|
|
;
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setonExitTransitionDidStartCallback : Error processing arguments");
|
|
cobj->setonExitTransitionDidStartCallback(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_setonExitTransitionDidStartCallback : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_convertTouchToNodeSpace(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_convertTouchToNodeSpace : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Touch* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Touch*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_convertTouchToNodeSpace : Error processing arguments");
|
|
cocos2d::Vec2 ret = cobj->convertTouchToNodeSpace(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = vector2_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_convertTouchToNodeSpace : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_removeAllChildrenWithCleanup(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::Node* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::Node *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_removeAllChildrenWithCleanup : Invalid Native Object");
|
|
do {
|
|
if (argc == 1) {
|
|
bool arg0;
|
|
arg0 = JS::ToBoolean(args.get(0));
|
|
cobj->removeAllChildrenWithCleanup(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 0) {
|
|
cobj->removeAllChildren();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_removeAllChildrenWithCleanup : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_getRotationSkewX(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getRotationSkewX : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getRotationSkewX();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_getRotationSkewX : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_getRotationSkewY(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getRotationSkewY : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getRotationSkewY();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_getRotationSkewY : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_getNodeToWorldTransform(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getNodeToWorldTransform : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::Mat4 ret = cobj->getNodeToWorldTransform();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = matrix_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_getNodeToWorldTransform : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_isCascadeOpacityEnabled(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_isCascadeOpacityEnabled : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->isCascadeOpacityEnabled();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_isCascadeOpacityEnabled : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_setParent(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setParent : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Node* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setParent : Error processing arguments");
|
|
cobj->setParent(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_setParent : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_getName(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getName : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const std::string& ret = cobj->getName();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = std_string_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_getName : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_getRotation3D(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getRotation3D : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::Vec3 ret = cobj->getRotation3D();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = vector3_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_getRotation3D : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_getNodeToParentAffineTransform(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::Node* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::Node *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getNodeToParentAffineTransform : Invalid Native Object");
|
|
do {
|
|
if (argc == 1) {
|
|
cocos2d::Node* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::AffineTransform ret = cobj->getNodeToParentAffineTransform(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ccaffinetransform_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 0) {
|
|
cocos2d::AffineTransform ret = cobj->getNodeToParentAffineTransform();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ccaffinetransform_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_getNodeToParentAffineTransform : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_convertTouchToNodeSpaceAR(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_convertTouchToNodeSpaceAR : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Touch* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Touch*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_convertTouchToNodeSpaceAR : Error processing arguments");
|
|
cocos2d::Vec2 ret = cobj->convertTouchToNodeSpaceAR(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = vector2_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_convertTouchToNodeSpaceAR : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_getOnEnterCallback(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getOnEnterCallback : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const std::function<void ()>& ret = cobj->getOnEnterCallback();
|
|
jsval jsret = JSVAL_NULL;
|
|
#pragma warning NO CONVERSION FROM NATIVE FOR std::function;
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_getOnEnterCallback : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_setPositionNormalized(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setPositionNormalized : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Vec2 arg0;
|
|
ok &= jsval_to_vector2(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setPositionNormalized : Error processing arguments");
|
|
cobj->setPositionNormalized(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_setPositionNormalized : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_isOpacityModifyRGB(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_isOpacityModifyRGB : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->isOpacityModifyRGB();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_isOpacityModifyRGB : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_stopActionByTag(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_stopActionByTag : Invalid Native Object");
|
|
if (argc == 1) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_stopActionByTag : Error processing arguments");
|
|
cobj->stopActionByTag(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_stopActionByTag : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_reorderChild(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_reorderChild : Invalid Native Object");
|
|
if (argc == 2) {
|
|
cocos2d::Node* arg0 = nullptr;
|
|
int arg1 = 0;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_reorderChild : Error processing arguments");
|
|
cobj->reorderChild(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_reorderChild : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_setSkewY(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setSkewY : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setSkewY : Error processing arguments");
|
|
cobj->setSkewY(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_setSkewY : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_setRotation3D(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setRotation3D : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Vec3 arg0;
|
|
ok &= jsval_to_vector3(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setRotation3D : Error processing arguments");
|
|
cobj->setRotation3D(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_setRotation3D : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_setPositionX(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setPositionX : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setPositionX : Error processing arguments");
|
|
cobj->setPositionX(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_setPositionX : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_setNodeToParentTransform(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setNodeToParentTransform : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Mat4 arg0;
|
|
ok &= jsval_to_matrix(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setNodeToParentTransform : Error processing arguments");
|
|
cobj->setNodeToParentTransform(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_setNodeToParentTransform : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_getAnchorPoint(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getAnchorPoint : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const cocos2d::Vec2& ret = cobj->getAnchorPoint();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = vector2_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_getAnchorPoint : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_getNumberOfRunningActions(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getNumberOfRunningActions : Invalid Native Object");
|
|
if (argc == 0) {
|
|
ssize_t ret = cobj->getNumberOfRunningActions();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ssize_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_getNumberOfRunningActions : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_updateTransform(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_updateTransform : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->updateTransform();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_updateTransform : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_isVisible(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_isVisible : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->isVisible();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_isVisible : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_getChildrenCount(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getChildrenCount : Invalid Native Object");
|
|
if (argc == 0) {
|
|
ssize_t ret = cobj->getChildrenCount();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ssize_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_getChildrenCount : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_getNodeToParentTransform(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::Node* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::Node *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getNodeToParentTransform : Invalid Native Object");
|
|
do {
|
|
if (argc == 1) {
|
|
cocos2d::Node* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Mat4 ret = cobj->getNodeToParentTransform(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = matrix_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 0) {
|
|
const cocos2d::Mat4& ret = cobj->getNodeToParentTransform();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = matrix_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_getNodeToParentTransform : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_convertToNodeSpaceAR(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_convertToNodeSpaceAR : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Vec2 arg0;
|
|
ok &= jsval_to_vector2(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_convertToNodeSpaceAR : Error processing arguments");
|
|
cocos2d::Vec2 ret = cobj->convertToNodeSpaceAR(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = vector2_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_convertToNodeSpaceAR : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_addComponent(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_addComponent : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Component* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Component*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_addComponent : Error processing arguments");
|
|
bool ret = cobj->addComponent(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_addComponent : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_runAction(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_runAction : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Action* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Action*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_runAction : Error processing arguments");
|
|
cocos2d::Action* ret = cobj->runAction(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Action>(cx, (cocos2d::Action*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_runAction : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_visit(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::Node* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::Node *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_visit : Invalid Native Object");
|
|
do {
|
|
if (argc == 0) {
|
|
cobj->visit();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 3) {
|
|
cocos2d::Renderer* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Renderer*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Mat4 arg1;
|
|
ok &= jsval_to_matrix(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
unsigned int arg2 = 0;
|
|
ok &= jsval_to_uint32(cx, args.get(2), &arg2);
|
|
if (!ok) { ok = true; break; }
|
|
cobj->visit(arg0, arg1, arg2);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_visit : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_setGLProgram(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setGLProgram : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::GLProgram* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::GLProgram*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setGLProgram : Error processing arguments");
|
|
cobj->setGLProgram(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_setGLProgram : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_getRotation(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getRotation : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getRotation();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_getRotation : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_getPhysicsBody(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getPhysicsBody : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::PhysicsBody* ret = cobj->getPhysicsBody();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::PhysicsBody>(cx, (cocos2d::PhysicsBody*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_getPhysicsBody : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_getAnchorPointInPoints(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getAnchorPointInPoints : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const cocos2d::Vec2& ret = cobj->getAnchorPointInPoints();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = vector2_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_getAnchorPointInPoints : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_getRotationQuat(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getRotationQuat : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::Quaternion ret = cobj->getRotationQuat();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = quaternion_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_getRotationQuat : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_removeChildByName(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_removeChildByName : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_removeChildByName : Error processing arguments");
|
|
cobj->removeChildByName(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
if (argc == 2) {
|
|
std::string arg0;
|
|
bool arg1;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
arg1 = JS::ToBoolean(args.get(1));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_removeChildByName : Error processing arguments");
|
|
cobj->removeChildByName(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_removeChildByName : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_setPositionZ(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setPositionZ : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setPositionZ : Error processing arguments");
|
|
cobj->setPositionZ(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_setPositionZ : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_getGLProgramState(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getGLProgramState : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::GLProgramState* ret = cobj->getGLProgramState();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::GLProgramState>(cx, (cocos2d::GLProgramState*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_getGLProgramState : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_setScheduler(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setScheduler : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Scheduler* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Scheduler*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setScheduler : Error processing arguments");
|
|
cobj->setScheduler(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_setScheduler : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_stopAllActions(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_stopAllActions : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->stopAllActions();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_stopAllActions : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_getSkewX(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getSkewX : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getSkewX();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_getSkewX : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_getSkewY(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getSkewY : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getSkewY();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_getSkewY : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_isScheduled(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_isScheduled : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_isScheduled : Error processing arguments");
|
|
bool ret = cobj->isScheduled(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_isScheduled : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_getDisplayedColor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getDisplayedColor : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const cocos2d::Color3B& ret = cobj->getDisplayedColor();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = cccolor3b_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_getDisplayedColor : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_getActionByTag(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getActionByTag : Invalid Native Object");
|
|
if (argc == 1) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_getActionByTag : Error processing arguments");
|
|
cocos2d::Action* ret = cobj->getActionByTag(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Action>(cx, (cocos2d::Action*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_getActionByTag : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_setRotationSkewX(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setRotationSkewX : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setRotationSkewX : Error processing arguments");
|
|
cobj->setRotationSkewX(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_setRotationSkewX : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_setRotationSkewY(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setRotationSkewY : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setRotationSkewY : Error processing arguments");
|
|
cobj->setRotationSkewY(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_setRotationSkewY : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_setName(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setName : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setName : Error processing arguments");
|
|
cobj->setName(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_setName : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_update(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_update : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_update : Error processing arguments");
|
|
cobj->update(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_update : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_getDisplayedOpacity(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getDisplayedOpacity : Invalid Native Object");
|
|
if (argc == 0) {
|
|
uint16_t ret = cobj->getDisplayedOpacity();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = uint32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_getDisplayedOpacity : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_getLocalZOrder(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getLocalZOrder : Invalid Native Object");
|
|
if (argc == 0) {
|
|
int ret = cobj->getLocalZOrder();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = int32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_getLocalZOrder : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_getScheduler(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::Node* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::Node *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getScheduler : Invalid Native Object");
|
|
do {
|
|
if (argc == 0) {
|
|
const cocos2d::Scheduler* ret = cobj->getScheduler();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Scheduler>(cx, (cocos2d::Scheduler*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 0) {
|
|
cocos2d::Scheduler* ret = cobj->getScheduler();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Scheduler>(cx, (cocos2d::Scheduler*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_getScheduler : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_getPositionNormalized(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getPositionNormalized : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const cocos2d::Vec2& ret = cobj->getPositionNormalized();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = vector2_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_getPositionNormalized : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_getPosition(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::Node* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::Node *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getPosition : Invalid Native Object");
|
|
do {
|
|
if (argc == 2) {
|
|
float* arg0 = 0;
|
|
#pragma warning NO CONVERSION TO NATIVE FOR float*
|
|
ok = false;
|
|
if (!ok) { ok = true; break; }
|
|
float* arg1 = 0;
|
|
#pragma warning NO CONVERSION TO NATIVE FOR float*
|
|
ok = false;
|
|
if (!ok) { ok = true; break; }
|
|
cobj->getPosition(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 0) {
|
|
const cocos2d::Vec2& ret = cobj->getPosition();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = vector2_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_getPosition : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_isRunning(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_isRunning : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->isRunning();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_isRunning : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_getParent(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::Node* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::Node *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getParent : Invalid Native Object");
|
|
do {
|
|
if (argc == 0) {
|
|
const cocos2d::Node* ret = cobj->getParent();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Node>(cx, (cocos2d::Node*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 0) {
|
|
cocos2d::Node* ret = cobj->getParent();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Node>(cx, (cocos2d::Node*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_getParent : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_getWorldToNodeTransform(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getWorldToNodeTransform : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::Mat4 ret = cobj->getWorldToNodeTransform();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = matrix_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_getWorldToNodeTransform : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_getPositionY(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getPositionY : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getPositionY();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_getPositionY : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_getPositionX(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getPositionX : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getPositionX();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_getPositionX : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_removeChildByTag(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_removeChildByTag : Invalid Native Object");
|
|
if (argc == 1) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_removeChildByTag : Error processing arguments");
|
|
cobj->removeChildByTag(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
if (argc == 2) {
|
|
int arg0 = 0;
|
|
bool arg1;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
arg1 = JS::ToBoolean(args.get(1));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_removeChildByTag : Error processing arguments");
|
|
cobj->removeChildByTag(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_removeChildByTag : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_setPositionY(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setPositionY : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setPositionY : Error processing arguments");
|
|
cobj->setPositionY(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_setPositionY : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_updateDisplayedColor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_updateDisplayedColor : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Color3B arg0;
|
|
ok &= jsval_to_cccolor3b(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_updateDisplayedColor : Error processing arguments");
|
|
cobj->updateDisplayedColor(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_updateDisplayedColor : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_setVisible(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setVisible : Invalid Native Object");
|
|
if (argc == 1) {
|
|
bool arg0;
|
|
arg0 = JS::ToBoolean(args.get(0));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setVisible : Error processing arguments");
|
|
cobj->setVisible(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_setVisible : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_getParentToNodeAffineTransform(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getParentToNodeAffineTransform : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::AffineTransform ret = cobj->getParentToNodeAffineTransform();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ccaffinetransform_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_getParentToNodeAffineTransform : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_getPositionZ(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getPositionZ : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getPositionZ();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_getPositionZ : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_setGlobalZOrder(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setGlobalZOrder : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setGlobalZOrder : Error processing arguments");
|
|
cobj->setGlobalZOrder(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_setGlobalZOrder : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_setScale(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::Node* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::Node *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setScale : Invalid Native Object");
|
|
do {
|
|
if (argc == 2) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
if (!ok) { ok = true; break; }
|
|
double arg1 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
if (!ok) { ok = true; break; }
|
|
cobj->setScale(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cobj->setScale(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_setScale : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_getOnExitCallback(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getOnExitCallback : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const std::function<void ()>& ret = cobj->getOnExitCallback();
|
|
jsval jsret = JSVAL_NULL;
|
|
#pragma warning NO CONVERSION FROM NATIVE FOR std::function;
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_getOnExitCallback : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_getChildByTag(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getChildByTag : Invalid Native Object");
|
|
if (argc == 1) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_getChildByTag : Error processing arguments");
|
|
cocos2d::Node* ret = cobj->getChildByTag(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Node>(cx, (cocos2d::Node*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_getChildByTag : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_getScaleZ(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getScaleZ : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getScaleZ();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_getScaleZ : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_getScaleY(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getScaleY : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getScaleY();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_getScaleY : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_getScaleX(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getScaleX : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getScaleX();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_getScaleX : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_setLocalZOrder(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setLocalZOrder : Invalid Native Object");
|
|
if (argc == 1) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setLocalZOrder : Error processing arguments");
|
|
cobj->setLocalZOrder(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_setLocalZOrder : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_setCascadeColorEnabled(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setCascadeColorEnabled : Invalid Native Object");
|
|
if (argc == 1) {
|
|
bool arg0;
|
|
arg0 = JS::ToBoolean(args.get(0));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setCascadeColorEnabled : Error processing arguments");
|
|
cobj->setCascadeColorEnabled(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_setCascadeColorEnabled : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_setOpacity(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setOpacity : Invalid Native Object");
|
|
if (argc == 1) {
|
|
uint16_t arg0;
|
|
ok &= jsval_to_uint16(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setOpacity : Error processing arguments");
|
|
cobj->setOpacity(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_setOpacity : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_getComponent(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getComponent : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_getComponent : Error processing arguments");
|
|
cocos2d::Component* ret = cobj->getComponent(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Component>(cx, (cocos2d::Component*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_getComponent : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_getContentSize(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getContentSize : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const cocos2d::Size& ret = cobj->getContentSize();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ccsize_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_getContentSize : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_stopAllActionsByTag(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_stopAllActionsByTag : Invalid Native Object");
|
|
if (argc == 1) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_stopAllActionsByTag : Error processing arguments");
|
|
cobj->stopAllActionsByTag(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_stopAllActionsByTag : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_getBoundingBox(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getBoundingBox : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::Rect ret = cobj->getBoundingBox();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ccrect_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_getBoundingBox : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_setIgnoreAnchorPointForPosition(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setIgnoreAnchorPointForPosition : Invalid Native Object");
|
|
if (argc == 1) {
|
|
bool arg0;
|
|
arg0 = JS::ToBoolean(args.get(0));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setIgnoreAnchorPointForPosition : Error processing arguments");
|
|
cobj->setIgnoreAnchorPointForPosition(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_setIgnoreAnchorPointForPosition : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_setEventDispatcher(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setEventDispatcher : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::EventDispatcher* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::EventDispatcher*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setEventDispatcher : Error processing arguments");
|
|
cobj->setEventDispatcher(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_setEventDispatcher : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_getGlobalZOrder(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getGlobalZOrder : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getGlobalZOrder();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_getGlobalZOrder : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_draw(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::Node* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::Node *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_draw : Invalid Native Object");
|
|
do {
|
|
if (argc == 0) {
|
|
cobj->draw();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 3) {
|
|
cocos2d::Renderer* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Renderer*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Mat4 arg1;
|
|
ok &= jsval_to_matrix(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
unsigned int arg2 = 0;
|
|
ok &= jsval_to_uint32(cx, args.get(2), &arg2);
|
|
if (!ok) { ok = true; break; }
|
|
cobj->draw(arg0, arg1, arg2);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_draw : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_setUserObject(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setUserObject : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Ref* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Ref*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setUserObject : Error processing arguments");
|
|
cobj->setUserObject(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_setUserObject : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_enumerateChildren(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_enumerateChildren : Invalid Native Object");
|
|
if (argc == 2) {
|
|
std::string arg0;
|
|
std::function<bool (cocos2d::Node *)> arg1;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
do {
|
|
if(JS_TypeOfValue(cx, args.get(1)) == JSTYPE_FUNCTION)
|
|
{
|
|
JS::RootedObject jstarget(cx, args.thisv().toObjectOrNull());
|
|
std::shared_ptr<JSFunctionWrapper> func(new JSFunctionWrapper(cx, jstarget, args.get(1), args.thisv()));
|
|
auto lambda = [=](cocos2d::Node* larg0) -> bool {
|
|
JSB_AUTOCOMPARTMENT_WITH_GLOBAL_OBJCET
|
|
jsval largv[1];
|
|
if (larg0) {
|
|
largv[0] = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Node>(cx, (cocos2d::Node*)larg0));
|
|
} else {
|
|
largv[0] = JSVAL_NULL;
|
|
};
|
|
JS::RootedValue rval(cx);
|
|
bool succeed = func->invoke(1, &largv[0], &rval);
|
|
if (!succeed && JS_IsExceptionPending(cx)) {
|
|
JS_ReportPendingException(cx);
|
|
}
|
|
bool ret;
|
|
ret = JS::ToBoolean(rval);
|
|
return ret;
|
|
};
|
|
arg1 = lambda;
|
|
}
|
|
else
|
|
{
|
|
arg1 = nullptr;
|
|
}
|
|
} while(0)
|
|
;
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_enumerateChildren : Error processing arguments");
|
|
cobj->enumerateChildren(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_enumerateChildren : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_getonExitTransitionDidStartCallback(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getonExitTransitionDidStartCallback : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const std::function<void ()>& ret = cobj->getonExitTransitionDidStartCallback();
|
|
jsval jsret = JSVAL_NULL;
|
|
#pragma warning NO CONVERSION FROM NATIVE FOR std::function;
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_getonExitTransitionDidStartCallback : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_removeFromParentAndCleanup(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::Node* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::Node *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_removeFromParentAndCleanup : Invalid Native Object");
|
|
do {
|
|
if (argc == 1) {
|
|
bool arg0;
|
|
arg0 = JS::ToBoolean(args.get(0));
|
|
cobj->removeFromParentAndCleanup(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 0) {
|
|
cobj->removeFromParent();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_removeFromParentAndCleanup : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_setPosition3D(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setPosition3D : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Vec3 arg0;
|
|
ok &= jsval_to_vector3(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setPosition3D : Error processing arguments");
|
|
cobj->setPosition3D(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_setPosition3D : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_getNumberOfRunningActionsByTag(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getNumberOfRunningActionsByTag : Invalid Native Object");
|
|
if (argc == 1) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_getNumberOfRunningActionsByTag : Error processing arguments");
|
|
ssize_t ret = cobj->getNumberOfRunningActionsByTag(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ssize_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_getNumberOfRunningActionsByTag : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_sortAllChildren(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_sortAllChildren : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->sortAllChildren();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_sortAllChildren : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_getWorldToNodeAffineTransform(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getWorldToNodeAffineTransform : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::AffineTransform ret = cobj->getWorldToNodeAffineTransform();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ccaffinetransform_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_getWorldToNodeAffineTransform : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_getScale(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getScale : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getScale();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_getScale : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_getOpacity(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getOpacity : Invalid Native Object");
|
|
if (argc == 0) {
|
|
uint16_t ret = cobj->getOpacity();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = uint32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_getOpacity : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_updateOrderOfArrival(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_updateOrderOfArrival : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->updateOrderOfArrival();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_updateOrderOfArrival : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_getNormalizedPosition(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getNormalizedPosition : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const cocos2d::Vec2& ret = cobj->getNormalizedPosition();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = vector2_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_getNormalizedPosition : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_getParentToNodeTransform(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getParentToNodeTransform : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const cocos2d::Mat4& ret = cobj->getParentToNodeTransform();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = matrix_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_getParentToNodeTransform : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_convertToNodeSpace(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_convertToNodeSpace : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Vec2 arg0;
|
|
ok &= jsval_to_vector2(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_convertToNodeSpace : Error processing arguments");
|
|
cocos2d::Vec2 ret = cobj->convertToNodeSpace(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = vector2_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_convertToNodeSpace : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_setTag(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setTag : Invalid Native Object");
|
|
if (argc == 1) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setTag : Error processing arguments");
|
|
cobj->setTag(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_setTag : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_isCascadeColorEnabled(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_isCascadeColorEnabled : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->isCascadeColorEnabled();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_isCascadeColorEnabled : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_setRotationQuat(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_setRotationQuat : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Quaternion arg0;
|
|
ok &= jsval_to_quaternion(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_setRotationQuat : Error processing arguments");
|
|
cobj->setRotationQuat(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_setRotationQuat : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_stopAction(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Node* cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_stopAction : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Action* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Action*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Node_stopAction : Error processing arguments");
|
|
cobj->stopAction(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_stopAction : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_getActionManager(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::Node* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::Node *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Node_getActionManager : Invalid Native Object");
|
|
do {
|
|
if (argc == 0) {
|
|
const cocos2d::ActionManager* ret = cobj->getActionManager();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::ActionManager>(cx, (cocos2d::ActionManager*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 0) {
|
|
cocos2d::ActionManager* ret = cobj->getActionManager();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::ActionManager>(cx, (cocos2d::ActionManager*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Node_getActionManager : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Node_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
if (argc == 0) {
|
|
|
|
auto ret = cocos2d::Node::create();
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::Node>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::Node"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_Node_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_Node_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::Node* cobj = new (std::nothrow) cocos2d::Node();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::Node>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::Node"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_Node_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::Node *nobj = new (std::nothrow) cocos2d::Node();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::Node");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
|
|
void js_register_cocos2dx_Node(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_Node_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_Node_class->name = "Node";
|
|
jsb_cocos2d_Node_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Node_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_Node_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Node_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_Node_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_Node_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_Node_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_Node_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("addChild", js_cocos2dx_Node_addChild, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("removeComponent", js_cocos2dx_Node_removeComponent, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setPhysicsBody", js_cocos2dx_Node_setPhysicsBody, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getShaderProgram", js_cocos2dx_Node_getGLProgram, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getDescription", js_cocos2dx_Node_getDescription, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setOpacityModifyRGB", js_cocos2dx_Node_setOpacityModifyRGB, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setCascadeOpacityEnabled", js_cocos2dx_Node_setCascadeOpacityEnabled, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getChildren", js_cocos2dx_Node_getChildren, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setOnExitCallback", js_cocos2dx_Node_setOnExitCallback, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setActionManager", js_cocos2dx_Node_setActionManager, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("isIgnoreAnchorPointForPosition", js_cocos2dx_Node_isIgnoreAnchorPointForPosition, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getChildByName", js_cocos2dx_Node_getChildByName, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("updateDisplayedOpacity", js_cocos2dx_Node_updateDisplayedOpacity, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("init", js_cocos2dx_Node_init, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getCameraMask", js_cocos2dx_Node_getCameraMask, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setRotation", js_cocos2dx_Node_setRotation, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setScaleZ", js_cocos2dx_Node_setScaleZ, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setScaleY", js_cocos2dx_Node_setScaleY, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setScaleX", js_cocos2dx_Node_setScaleX, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getColor", js_cocos2dx_Node_getColor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setonEnterTransitionDidFinishCallback", js_cocos2dx_Node_setonEnterTransitionDidFinishCallback, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("removeAllComponents", js_cocos2dx_Node_removeAllComponents, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("_setLocalZOrder", js_cocos2dx_Node__setLocalZOrder, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setCameraMask", js_cocos2dx_Node_setCameraMask, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getTag", js_cocos2dx_Node_getTag, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getonEnterTransitionDidFinishCallback", js_cocos2dx_Node_getonEnterTransitionDidFinishCallback, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getNodeToWorldTransform", js_cocos2dx_Node_getNodeToWorldAffineTransform, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getPosition3D", js_cocos2dx_Node_getPosition3D, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("removeChild", js_cocos2dx_Node_removeChild, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getScene", js_cocos2dx_Node_getScene, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getEventDispatcher", js_cocos2dx_Node_getEventDispatcher, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setSkewX", js_cocos2dx_Node_setSkewX, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setGLProgramState", js_cocos2dx_Node_setGLProgramState, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setOnEnterCallback", js_cocos2dx_Node_setOnEnterCallback, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("stopActionsByFlags", js_cocos2dx_Node_stopActionsByFlags, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setNormalizedPosition", js_cocos2dx_Node_setNormalizedPosition, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setonExitTransitionDidStartCallback", js_cocos2dx_Node_setonExitTransitionDidStartCallback, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("convertTouchToNodeSpace", js_cocos2dx_Node_convertTouchToNodeSpace, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("removeAllChildren", js_cocos2dx_Node_removeAllChildrenWithCleanup, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getRotationX", js_cocos2dx_Node_getRotationSkewX, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getRotationY", js_cocos2dx_Node_getRotationSkewY, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getNodeToWorldTransform3D", js_cocos2dx_Node_getNodeToWorldTransform, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("isCascadeOpacityEnabled", js_cocos2dx_Node_isCascadeOpacityEnabled, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setParent", js_cocos2dx_Node_setParent, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getName", js_cocos2dx_Node_getName, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getRotation3D", js_cocos2dx_Node_getRotation3D, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getNodeToParentTransform", js_cocos2dx_Node_getNodeToParentAffineTransform, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("convertTouchToNodeSpaceAR", js_cocos2dx_Node_convertTouchToNodeSpaceAR, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getOnEnterCallback", js_cocos2dx_Node_getOnEnterCallback, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setPositionNormalized", js_cocos2dx_Node_setPositionNormalized, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("isOpacityModifyRGB", js_cocos2dx_Node_isOpacityModifyRGB, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("stopActionByTag", js_cocos2dx_Node_stopActionByTag, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("reorderChild", js_cocos2dx_Node_reorderChild, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setSkewY", js_cocos2dx_Node_setSkewY, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setRotation3D", js_cocos2dx_Node_setRotation3D, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setPositionX", js_cocos2dx_Node_setPositionX, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setNodeToParentTransform", js_cocos2dx_Node_setNodeToParentTransform, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getAnchorPoint", js_cocos2dx_Node_getAnchorPoint, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getNumberOfRunningActions", js_cocos2dx_Node_getNumberOfRunningActions, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("updateTransform", js_cocos2dx_Node_updateTransform, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("isVisible", js_cocos2dx_Node_isVisible, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getChildrenCount", js_cocos2dx_Node_getChildrenCount, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getNodeToParentTransform3D", js_cocos2dx_Node_getNodeToParentTransform, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("convertToNodeSpaceAR", js_cocos2dx_Node_convertToNodeSpaceAR, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("addComponent", js_cocos2dx_Node_addComponent, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("runAction", js_cocos2dx_Node_runAction, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("visit", js_cocos2dx_Node_visit, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setShaderProgram", js_cocos2dx_Node_setGLProgram, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getRotation", js_cocos2dx_Node_getRotation, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getPhysicsBody", js_cocos2dx_Node_getPhysicsBody, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getAnchorPointInPoints", js_cocos2dx_Node_getAnchorPointInPoints, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getRotationQuat", js_cocos2dx_Node_getRotationQuat, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("removeChildByName", js_cocos2dx_Node_removeChildByName, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setVertexZ", js_cocos2dx_Node_setPositionZ, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getGLProgramState", js_cocos2dx_Node_getGLProgramState, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setScheduler", js_cocos2dx_Node_setScheduler, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("stopAllActions", js_cocos2dx_Node_stopAllActions, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getSkewX", js_cocos2dx_Node_getSkewX, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getSkewY", js_cocos2dx_Node_getSkewY, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("isScheduled", js_cocos2dx_Node_isScheduled, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getDisplayedColor", js_cocos2dx_Node_getDisplayedColor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getActionByTag", js_cocos2dx_Node_getActionByTag, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setRotationX", js_cocos2dx_Node_setRotationSkewX, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setRotationY", js_cocos2dx_Node_setRotationSkewY, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setName", js_cocos2dx_Node_setName, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("update", js_cocos2dx_Node_update, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getDisplayedOpacity", js_cocos2dx_Node_getDisplayedOpacity, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getLocalZOrder", js_cocos2dx_Node_getLocalZOrder, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getScheduler", js_cocos2dx_Node_getScheduler, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getPositionNormalized", js_cocos2dx_Node_getPositionNormalized, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getPosition", js_cocos2dx_Node_getPosition, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("isRunning", js_cocos2dx_Node_isRunning, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getParent", js_cocos2dx_Node_getParent, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getWorldToNodeTransform3D", js_cocos2dx_Node_getWorldToNodeTransform, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getPositionY", js_cocos2dx_Node_getPositionY, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getPositionX", js_cocos2dx_Node_getPositionX, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("removeChildByTag", js_cocos2dx_Node_removeChildByTag, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setPositionY", js_cocos2dx_Node_setPositionY, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("updateDisplayedColor", js_cocos2dx_Node_updateDisplayedColor, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setVisible", js_cocos2dx_Node_setVisible, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getParentToNodeTransform", js_cocos2dx_Node_getParentToNodeAffineTransform, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getVertexZ", js_cocos2dx_Node_getPositionZ, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setGlobalZOrder", js_cocos2dx_Node_setGlobalZOrder, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setScale", js_cocos2dx_Node_setScale, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getOnExitCallback", js_cocos2dx_Node_getOnExitCallback, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getChildByTag", js_cocos2dx_Node_getChildByTag, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getScaleZ", js_cocos2dx_Node_getScaleZ, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getScaleY", js_cocos2dx_Node_getScaleY, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getScaleX", js_cocos2dx_Node_getScaleX, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setLocalZOrder", js_cocos2dx_Node_setLocalZOrder, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setCascadeColorEnabled", js_cocos2dx_Node_setCascadeColorEnabled, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setOpacity", js_cocos2dx_Node_setOpacity, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getComponent", js_cocos2dx_Node_getComponent, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getContentSize", js_cocos2dx_Node_getContentSize, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("stopAllActionsByTag", js_cocos2dx_Node_stopAllActionsByTag, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getBoundingBox", js_cocos2dx_Node_getBoundingBox, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setIgnoreAnchorPointForPosition", js_cocos2dx_Node_setIgnoreAnchorPointForPosition, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setEventDispatcher", js_cocos2dx_Node_setEventDispatcher, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getGlobalZOrder", js_cocos2dx_Node_getGlobalZOrder, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("draw", js_cocos2dx_Node_draw, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setUserObject", js_cocos2dx_Node_setUserObject, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("enumerateChildren", js_cocos2dx_Node_enumerateChildren, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getonExitTransitionDidStartCallback", js_cocos2dx_Node_getonExitTransitionDidStartCallback, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("removeFromParent", js_cocos2dx_Node_removeFromParentAndCleanup, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setPosition3D", js_cocos2dx_Node_setPosition3D, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getNumberOfRunningActionsByTag", js_cocos2dx_Node_getNumberOfRunningActionsByTag, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("sortAllChildren", js_cocos2dx_Node_sortAllChildren, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getWorldToNodeTransform", js_cocos2dx_Node_getWorldToNodeAffineTransform, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getScale", js_cocos2dx_Node_getScale, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getOpacity", js_cocos2dx_Node_getOpacity, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("updateOrderOfArrival", js_cocos2dx_Node_updateOrderOfArrival, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getNormalizedPosition", js_cocos2dx_Node_getNormalizedPosition, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getParentToNodeTransform3D", js_cocos2dx_Node_getParentToNodeTransform, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("convertToNodeSpace", js_cocos2dx_Node_convertToNodeSpace, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setTag", js_cocos2dx_Node_setTag, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("isCascadeColorEnabled", js_cocos2dx_Node_isCascadeColorEnabled, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setRotationQuat", js_cocos2dx_Node_setRotationQuat, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("stopAction", js_cocos2dx_Node_stopAction, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getActionManager", js_cocos2dx_Node_getActionManager, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_Node_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_Node_create, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
jsb_cocos2d_Node_prototype = JS_InitClass(
|
|
cx, global,
|
|
JS::NullPtr(),
|
|
jsb_cocos2d_Node_class,
|
|
js_cocos2dx_Node_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_Node_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "Node"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::Node>(cx, jsb_cocos2d_Node_class, proto, JS::NullPtr());
|
|
anonEvaluate(cx, global, "(function () { cc.Node.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d___NodeRGBA_class;
|
|
JSObject *jsb_cocos2d___NodeRGBA_prototype;
|
|
|
|
bool js_cocos2dx___NodeRGBA_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::__NodeRGBA* cobj = new (std::nothrow) cocos2d::__NodeRGBA();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::__NodeRGBA>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::__NodeRGBA"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_Node_prototype;
|
|
|
|
void js_register_cocos2dx___NodeRGBA(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d___NodeRGBA_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d___NodeRGBA_class->name = "__NodeRGBA";
|
|
jsb_cocos2d___NodeRGBA_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d___NodeRGBA_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d___NodeRGBA_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d___NodeRGBA_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d___NodeRGBA_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d___NodeRGBA_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d___NodeRGBA_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d___NodeRGBA_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FS_END
|
|
};
|
|
|
|
JSFunctionSpec *st_funcs = NULL;
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_Node_prototype);
|
|
jsb_cocos2d___NodeRGBA_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d___NodeRGBA_class,
|
|
js_cocos2dx___NodeRGBA_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d___NodeRGBA_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "__NodeRGBA"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::__NodeRGBA>(cx, jsb_cocos2d___NodeRGBA_class, proto, parent_proto);
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_Scene_class;
|
|
JSObject *jsb_cocos2d_Scene_prototype;
|
|
|
|
bool js_cocos2dx_Scene_setCameraOrderDirty(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Scene* cobj = (cocos2d::Scene *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Scene_setCameraOrderDirty : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->setCameraOrderDirty();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Scene_setCameraOrderDirty : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Scene_render(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::Scene* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::Scene *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Scene_render : Invalid Native Object");
|
|
do {
|
|
if (argc == 4) {
|
|
cocos2d::Renderer* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Renderer*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
if (!ok) { ok = true; break; }
|
|
const cocos2d::Mat4* arg1 = nullptr;
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (const cocos2d::Mat4*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
if (!ok) { ok = true; break; }
|
|
const cocos2d::Mat4* arg2 = nullptr;
|
|
do {
|
|
if (args.get(2).isNull()) { arg2 = nullptr; break; }
|
|
if (!args.get(2).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(2).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg2 = (const cocos2d::Mat4*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg2, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
if (!ok) { ok = true; break; }
|
|
unsigned int arg3 = 0;
|
|
ok &= jsval_to_uint32(cx, args.get(3), &arg3);
|
|
if (!ok) { ok = true; break; }
|
|
cobj->render(arg0, arg1, arg2, arg3);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 2) {
|
|
cocos2d::Renderer* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Renderer*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Mat4 arg1;
|
|
ok &= jsval_to_matrix(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
cobj->render(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 3) {
|
|
cocos2d::Renderer* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Renderer*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Mat4 arg1;
|
|
ok &= jsval_to_matrix(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
const cocos2d::Mat4* arg2 = nullptr;
|
|
do {
|
|
if (args.get(2).isNull()) { arg2 = nullptr; break; }
|
|
if (!args.get(2).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(2).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg2 = (const cocos2d::Mat4*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg2, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
if (!ok) { ok = true; break; }
|
|
cobj->render(arg0, arg1, arg2);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Scene_render : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Scene_stepPhysicsAndNavigation(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Scene* cobj = (cocos2d::Scene *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Scene_stepPhysicsAndNavigation : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Scene_stepPhysicsAndNavigation : Error processing arguments");
|
|
cobj->stepPhysicsAndNavigation(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Scene_stepPhysicsAndNavigation : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Scene_onProjectionChanged(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Scene* cobj = (cocos2d::Scene *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Scene_onProjectionChanged : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::EventCustom* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::EventCustom*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Scene_onProjectionChanged : Error processing arguments");
|
|
cobj->onProjectionChanged(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Scene_onProjectionChanged : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Scene_initWithSize(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Scene* cobj = (cocos2d::Scene *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Scene_initWithSize : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Size arg0;
|
|
ok &= jsval_to_ccsize(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Scene_initWithSize : Error processing arguments");
|
|
bool ret = cobj->initWithSize(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Scene_initWithSize : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Scene_getDefaultCamera(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Scene* cobj = (cocos2d::Scene *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Scene_getDefaultCamera : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::Camera* ret = cobj->getDefaultCamera();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Camera>(cx, (cocos2d::Camera*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Scene_getDefaultCamera : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Scene_createWithSize(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
cocos2d::Size arg0;
|
|
ok &= jsval_to_ccsize(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Scene_createWithSize : Error processing arguments");
|
|
|
|
auto ret = cocos2d::Scene::createWithSize(arg0);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::Scene>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::Scene"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_Scene_createWithSize : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_Scene_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
if (argc == 0) {
|
|
|
|
auto ret = cocos2d::Scene::create();
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::Scene>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::Scene"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_Scene_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_Scene_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::Scene* cobj = new (std::nothrow) cocos2d::Scene();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::Scene>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::Scene"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_Scene_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::Scene *nobj = new (std::nothrow) cocos2d::Scene();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::Scene");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_Node_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_Scene(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_Scene_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_Scene_class->name = "Scene";
|
|
jsb_cocos2d_Scene_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Scene_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_Scene_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Scene_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_Scene_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_Scene_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_Scene_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_Scene_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("setCameraOrderDirty", js_cocos2dx_Scene_setCameraOrderDirty, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("render", js_cocos2dx_Scene_render, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("stepPhysicsAndNavigation", js_cocos2dx_Scene_stepPhysicsAndNavigation, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("onProjectionChanged", js_cocos2dx_Scene_onProjectionChanged, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initWithSize", js_cocos2dx_Scene_initWithSize, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getDefaultCamera", js_cocos2dx_Scene_getDefaultCamera, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_Scene_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("createWithSize", js_cocos2dx_Scene_createWithSize, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("create", js_cocos2dx_Scene_create, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_Node_prototype);
|
|
jsb_cocos2d_Scene_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_Scene_class,
|
|
js_cocos2dx_Scene_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_Scene_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "Scene"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::Scene>(cx, jsb_cocos2d_Scene_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.Scene.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_GLView_class;
|
|
JSObject *jsb_cocos2d_GLView_prototype;
|
|
|
|
bool js_cocos2dx_GLView_setFrameSize(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GLView* cobj = (cocos2d::GLView *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLView_setFrameSize : Invalid Native Object");
|
|
if (argc == 2) {
|
|
double arg0 = 0;
|
|
double arg1 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_GLView_setFrameSize : Error processing arguments");
|
|
cobj->setFrameSize(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLView_setFrameSize : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLView_getViewPortRect(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GLView* cobj = (cocos2d::GLView *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLView_getViewPortRect : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const cocos2d::Rect& ret = cobj->getViewPortRect();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ccrect_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLView_getViewPortRect : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLView_setContentScaleFactor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GLView* cobj = (cocos2d::GLView *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLView_setContentScaleFactor : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_GLView_setContentScaleFactor : Error processing arguments");
|
|
bool ret = cobj->setContentScaleFactor(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLView_setContentScaleFactor : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLView_getContentScaleFactor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GLView* cobj = (cocos2d::GLView *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLView_getContentScaleFactor : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getContentScaleFactor();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLView_getContentScaleFactor : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLView_setIMEKeyboardState(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GLView* cobj = (cocos2d::GLView *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLView_setIMEKeyboardState : Invalid Native Object");
|
|
if (argc == 1) {
|
|
bool arg0;
|
|
arg0 = JS::ToBoolean(args.get(0));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_GLView_setIMEKeyboardState : Error processing arguments");
|
|
cobj->setIMEKeyboardState(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLView_setIMEKeyboardState : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLView_getVR(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GLView* cobj = (cocos2d::GLView *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLView_getVR : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::VRIRenderer* ret = cobj->getVR();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::VRIRenderer>(cx, (cocos2d::VRIRenderer*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLView_getVR : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLView_setScissorInPoints(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GLView* cobj = (cocos2d::GLView *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLView_setScissorInPoints : Invalid Native Object");
|
|
if (argc == 4) {
|
|
double arg0 = 0;
|
|
double arg1 = 0;
|
|
double arg2 = 0;
|
|
double arg3 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
ok &= JS::ToNumber( cx, args.get(3), &arg3) && !std::isnan(arg3);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_GLView_setScissorInPoints : Error processing arguments");
|
|
cobj->setScissorInPoints(arg0, arg1, arg2, arg3);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLView_setScissorInPoints : wrong number of arguments: %d, was expecting %d", argc, 4);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLView_getViewName(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GLView* cobj = (cocos2d::GLView *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLView_getViewName : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const std::string& ret = cobj->getViewName();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = std_string_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLView_getViewName : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLView_isOpenGLReady(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GLView* cobj = (cocos2d::GLView *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLView_isOpenGLReady : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->isOpenGLReady();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLView_isOpenGLReady : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLView_setCursorVisible(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GLView* cobj = (cocos2d::GLView *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLView_setCursorVisible : Invalid Native Object");
|
|
if (argc == 1) {
|
|
bool arg0;
|
|
arg0 = JS::ToBoolean(args.get(0));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_GLView_setCursorVisible : Error processing arguments");
|
|
cobj->setCursorVisible(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLView_setCursorVisible : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLView_getScaleY(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GLView* cobj = (cocos2d::GLView *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLView_getScaleY : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getScaleY();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLView_getScaleY : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLView_getScaleX(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GLView* cobj = (cocos2d::GLView *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLView_getScaleX : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getScaleX();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLView_getScaleX : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLView_getVisibleOrigin(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GLView* cobj = (cocos2d::GLView *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLView_getVisibleOrigin : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::Vec2 ret = cobj->getVisibleOrigin();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = vector2_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLView_getVisibleOrigin : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLView_getFrameSize(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GLView* cobj = (cocos2d::GLView *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLView_getFrameSize : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const cocos2d::Size& ret = cobj->getFrameSize();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ccsize_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLView_getFrameSize : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLView_setFrameZoomFactor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GLView* cobj = (cocos2d::GLView *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLView_setFrameZoomFactor : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_GLView_setFrameZoomFactor : Error processing arguments");
|
|
cobj->setFrameZoomFactor(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLView_setFrameZoomFactor : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLView_getFrameZoomFactor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GLView* cobj = (cocos2d::GLView *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLView_getFrameZoomFactor : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getFrameZoomFactor();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLView_getFrameZoomFactor : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLView_getDesignResolutionSize(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GLView* cobj = (cocos2d::GLView *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLView_getDesignResolutionSize : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const cocos2d::Size& ret = cobj->getDesignResolutionSize();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ccsize_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLView_getDesignResolutionSize : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLView_windowShouldClose(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GLView* cobj = (cocos2d::GLView *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLView_windowShouldClose : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->windowShouldClose();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLView_windowShouldClose : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLView_setDesignResolutionSize(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GLView* cobj = (cocos2d::GLView *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLView_setDesignResolutionSize : Invalid Native Object");
|
|
if (argc == 3) {
|
|
double arg0 = 0;
|
|
double arg1 = 0;
|
|
ResolutionPolicy arg2;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_GLView_setDesignResolutionSize : Error processing arguments");
|
|
cobj->setDesignResolutionSize(arg0, arg1, arg2);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLView_setDesignResolutionSize : wrong number of arguments: %d, was expecting %d", argc, 3);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLView_getResolutionPolicy(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GLView* cobj = (cocos2d::GLView *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLView_getResolutionPolicy : Invalid Native Object");
|
|
if (argc == 0) {
|
|
int ret = (int)cobj->getResolutionPolicy();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = int32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLView_getResolutionPolicy : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLView_isRetinaDisplay(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GLView* cobj = (cocos2d::GLView *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLView_isRetinaDisplay : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->isRetinaDisplay();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLView_isRetinaDisplay : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLView_renderScene(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GLView* cobj = (cocos2d::GLView *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLView_renderScene : Invalid Native Object");
|
|
if (argc == 2) {
|
|
cocos2d::Scene* arg0 = nullptr;
|
|
cocos2d::Renderer* arg1 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Scene*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::Renderer*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_GLView_renderScene : Error processing arguments");
|
|
cobj->renderScene(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLView_renderScene : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLView_setVR(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GLView* cobj = (cocos2d::GLView *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLView_setVR : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::VRIRenderer* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::VRIRenderer*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_GLView_setVR : Error processing arguments");
|
|
cobj->setVR(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLView_setVR : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLView_setViewPortInPoints(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GLView* cobj = (cocos2d::GLView *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLView_setViewPortInPoints : Invalid Native Object");
|
|
if (argc == 4) {
|
|
double arg0 = 0;
|
|
double arg1 = 0;
|
|
double arg2 = 0;
|
|
double arg3 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
ok &= JS::ToNumber( cx, args.get(3), &arg3) && !std::isnan(arg3);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_GLView_setViewPortInPoints : Error processing arguments");
|
|
cobj->setViewPortInPoints(arg0, arg1, arg2, arg3);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLView_setViewPortInPoints : wrong number of arguments: %d, was expecting %d", argc, 4);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLView_getScissorRect(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GLView* cobj = (cocos2d::GLView *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLView_getScissorRect : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::Rect ret = cobj->getScissorRect();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ccrect_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLView_getScissorRect : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLView_getRetinaFactor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GLView* cobj = (cocos2d::GLView *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLView_getRetinaFactor : Invalid Native Object");
|
|
if (argc == 0) {
|
|
int ret = cobj->getRetinaFactor();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = int32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLView_getRetinaFactor : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLView_setViewName(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GLView* cobj = (cocos2d::GLView *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLView_setViewName : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_GLView_setViewName : Error processing arguments");
|
|
cobj->setViewName(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLView_setViewName : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLView_getVisibleRect(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GLView* cobj = (cocos2d::GLView *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLView_getVisibleRect : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::Rect ret = cobj->getVisibleRect();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ccrect_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLView_getVisibleRect : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLView_getVisibleSize(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GLView* cobj = (cocos2d::GLView *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLView_getVisibleSize : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::Size ret = cobj->getVisibleSize();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ccsize_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLView_getVisibleSize : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLView_isScissorEnabled(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GLView* cobj = (cocos2d::GLView *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLView_isScissorEnabled : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->isScissorEnabled();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLView_isScissorEnabled : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLView_pollEvents(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GLView* cobj = (cocos2d::GLView *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLView_pollEvents : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->pollEvents();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLView_pollEvents : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLView_setGLContextAttrs(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
GLContextAttrs arg0;
|
|
#pragma warning NO CONVERSION TO NATIVE FOR GLContextAttrs
|
|
ok = false;
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_GLView_setGLContextAttrs : Error processing arguments");
|
|
cocos2d::GLView::setGLContextAttrs(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_GLView_setGLContextAttrs : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_GLView_getGLContextAttrs(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
if (argc == 0) {
|
|
|
|
GLContextAttrs ret = cocos2d::GLView::getGLContextAttrs();
|
|
jsval jsret = JSVAL_NULL;
|
|
#pragma warning NO CONVERSION FROM NATIVE FOR GLContextAttrs;
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_GLView_getGLContextAttrs : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
|
|
void js_register_cocos2dx_GLView(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_GLView_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_GLView_class->name = "GLView";
|
|
jsb_cocos2d_GLView_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_GLView_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_GLView_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_GLView_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_GLView_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_GLView_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_GLView_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_GLView_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("setFrameSize", js_cocos2dx_GLView_setFrameSize, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getViewPortRect", js_cocos2dx_GLView_getViewPortRect, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setContentScaleFactor", js_cocos2dx_GLView_setContentScaleFactor, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getContentScaleFactor", js_cocos2dx_GLView_getContentScaleFactor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setIMEKeyboardState", js_cocos2dx_GLView_setIMEKeyboardState, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getVR", js_cocos2dx_GLView_getVR, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setScissorInPoints", js_cocos2dx_GLView_setScissorInPoints, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getViewName", js_cocos2dx_GLView_getViewName, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("isOpenGLReady", js_cocos2dx_GLView_isOpenGLReady, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setCursorVisible", js_cocos2dx_GLView_setCursorVisible, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getScaleY", js_cocos2dx_GLView_getScaleY, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getScaleX", js_cocos2dx_GLView_getScaleX, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getVisibleOrigin", js_cocos2dx_GLView_getVisibleOrigin, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getFrameSize", js_cocos2dx_GLView_getFrameSize, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setFrameZoomFactor", js_cocos2dx_GLView_setFrameZoomFactor, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getFrameZoomFactor", js_cocos2dx_GLView_getFrameZoomFactor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getDesignResolutionSize", js_cocos2dx_GLView_getDesignResolutionSize, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("windowShouldClose", js_cocos2dx_GLView_windowShouldClose, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setDesignResolutionSize", js_cocos2dx_GLView_setDesignResolutionSize, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getResolutionPolicy", js_cocos2dx_GLView_getResolutionPolicy, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("isRetinaDisplay", js_cocos2dx_GLView_isRetinaDisplay, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("renderScene", js_cocos2dx_GLView_renderScene, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setVR", js_cocos2dx_GLView_setVR, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setViewPortInPoints", js_cocos2dx_GLView_setViewPortInPoints, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getScissorRect", js_cocos2dx_GLView_getScissorRect, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getRetinaFactor", js_cocos2dx_GLView_getRetinaFactor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setViewName", js_cocos2dx_GLView_setViewName, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getVisibleRect", js_cocos2dx_GLView_getVisibleRect, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getVisibleSize", js_cocos2dx_GLView_getVisibleSize, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("isScissorEnabled", js_cocos2dx_GLView_isScissorEnabled, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("pollEvents", js_cocos2dx_GLView_pollEvents, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("setGLContextAttrs", js_cocos2dx_GLView_setGLContextAttrs, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getGLContextAttrs", js_cocos2dx_GLView_getGLContextAttrs, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
jsb_cocos2d_GLView_prototype = JS_InitClass(
|
|
cx, global,
|
|
JS::NullPtr(),
|
|
jsb_cocos2d_GLView_class,
|
|
empty_constructor, 0,
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_GLView_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "GLView"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::GLView>(cx, jsb_cocos2d_GLView_class, proto, JS::NullPtr());
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_Director_class;
|
|
JSObject *jsb_cocos2d_Director_prototype;
|
|
|
|
bool js_cocos2dx_Director_pause(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_pause : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->pause();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Director_pause : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Director_pushProjectionMatrix(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_pushProjectionMatrix : Invalid Native Object");
|
|
if (argc == 1) {
|
|
unsigned int arg0 = 0;
|
|
ok &= jsval_to_uint32(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Director_pushProjectionMatrix : Error processing arguments");
|
|
cobj->pushProjectionMatrix(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Director_pushProjectionMatrix : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Director_popProjectionMatrix(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_popProjectionMatrix : Invalid Native Object");
|
|
if (argc == 1) {
|
|
unsigned int arg0 = 0;
|
|
ok &= jsval_to_uint32(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Director_popProjectionMatrix : Error processing arguments");
|
|
cobj->popProjectionMatrix(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Director_popProjectionMatrix : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Director_setEventDispatcher(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_setEventDispatcher : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::EventDispatcher* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::EventDispatcher*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Director_setEventDispatcher : Error processing arguments");
|
|
cobj->setEventDispatcher(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Director_setEventDispatcher : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Director_loadProjectionIdentityMatrix(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_loadProjectionIdentityMatrix : Invalid Native Object");
|
|
if (argc == 1) {
|
|
unsigned int arg0 = 0;
|
|
ok &= jsval_to_uint32(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Director_loadProjectionIdentityMatrix : Error processing arguments");
|
|
cobj->loadProjectionIdentityMatrix(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Director_loadProjectionIdentityMatrix : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Director_setContentScaleFactor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_setContentScaleFactor : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Director_setContentScaleFactor : Error processing arguments");
|
|
cobj->setContentScaleFactor(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Director_setContentScaleFactor : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Director_getContentScaleFactor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_getContentScaleFactor : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getContentScaleFactor();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Director_getContentScaleFactor : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Director_getWinSizeInPixels(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_getWinSizeInPixels : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::Size ret = cobj->getWinSizeInPixels();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ccsize_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Director_getWinSizeInPixels : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Director_getDeltaTime(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_getDeltaTime : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getDeltaTime();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Director_getDeltaTime : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Director_setGLDefaultValues(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_setGLDefaultValues : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->setGLDefaultValues();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Director_setGLDefaultValues : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Director_setActionManager(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_setActionManager : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::ActionManager* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::ActionManager*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Director_setActionManager : Error processing arguments");
|
|
cobj->setActionManager(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Director_setActionManager : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Director_setAlphaBlending(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_setAlphaBlending : Invalid Native Object");
|
|
if (argc == 1) {
|
|
bool arg0;
|
|
arg0 = JS::ToBoolean(args.get(0));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Director_setAlphaBlending : Error processing arguments");
|
|
cobj->setAlphaBlending(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Director_setAlphaBlending : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Director_popToRootScene(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_popToRootScene : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->popToRootScene();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Director_popToRootScene : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Director_loadMatrix(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_loadMatrix : Invalid Native Object");
|
|
if (argc == 2) {
|
|
cocos2d::MATRIX_STACK_TYPE arg0;
|
|
cocos2d::Mat4 arg1;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
ok &= jsval_to_matrix(cx, args.get(1), &arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Director_loadMatrix : Error processing arguments");
|
|
cobj->loadMatrix(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Director_loadMatrix : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Director_getNotificationNode(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_getNotificationNode : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::Node* ret = cobj->getNotificationNode();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Node>(cx, (cocos2d::Node*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Director_getNotificationNode : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Director_getWinSize(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_getWinSize : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const cocos2d::Size& ret = cobj->getWinSize();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ccsize_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Director_getWinSize : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Director_end(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_end : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->end();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Director_end : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Director_getTextureCache(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_getTextureCache : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::TextureCache* ret = cobj->getTextureCache();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::TextureCache>(cx, (cocos2d::TextureCache*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Director_getTextureCache : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Director_isSendCleanupToScene(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_isSendCleanupToScene : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->isSendCleanupToScene();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Director_isSendCleanupToScene : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Director_getVisibleOrigin(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_getVisibleOrigin : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::Vec2 ret = cobj->getVisibleOrigin();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = vector2_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Director_getVisibleOrigin : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Director_mainLoop(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_mainLoop : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->mainLoop();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Director_mainLoop : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Director_setDepthTest(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_setDepthTest : Invalid Native Object");
|
|
if (argc == 1) {
|
|
bool arg0;
|
|
arg0 = JS::ToBoolean(args.get(0));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Director_setDepthTest : Error processing arguments");
|
|
cobj->setDepthTest(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Director_setDepthTest : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Director_getFrameRate(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_getFrameRate : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getFrameRate();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Director_getFrameRate : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Director_getSecondsPerFrame(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_getSecondsPerFrame : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getSecondsPerFrame();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Director_getSecondsPerFrame : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Director_resetMatrixStack(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_resetMatrixStack : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->resetMatrixStack();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Director_resetMatrixStack : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Director_convertToUI(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_convertToUI : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Vec2 arg0;
|
|
ok &= jsval_to_vector2(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Director_convertToUI : Error processing arguments");
|
|
cocos2d::Vec2 ret = cobj->convertToUI(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = vector2_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Director_convertToUI : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Director_pushMatrix(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_pushMatrix : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::MATRIX_STACK_TYPE arg0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Director_pushMatrix : Error processing arguments");
|
|
cobj->pushMatrix(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Director_pushMatrix : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Director_setDefaultValues(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_setDefaultValues : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->setDefaultValues();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Director_setDefaultValues : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Director_init(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_init : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->init();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Director_init : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Director_setScheduler(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_setScheduler : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Scheduler* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Scheduler*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Director_setScheduler : Error processing arguments");
|
|
cobj->setScheduler(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Director_setScheduler : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Director_multiplyProjectionMatrix(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_multiplyProjectionMatrix : Invalid Native Object");
|
|
if (argc == 2) {
|
|
cocos2d::Mat4 arg0;
|
|
unsigned int arg1 = 0;
|
|
ok &= jsval_to_matrix(cx, args.get(0), &arg0);
|
|
ok &= jsval_to_uint32(cx, args.get(1), &arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Director_multiplyProjectionMatrix : Error processing arguments");
|
|
cobj->multiplyProjectionMatrix(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Director_multiplyProjectionMatrix : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Director_getMatrix(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_getMatrix : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::MATRIX_STACK_TYPE arg0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Director_getMatrix : Error processing arguments");
|
|
const cocos2d::Mat4& ret = cobj->getMatrix(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = matrix_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Director_getMatrix : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Director_isValid(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_isValid : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->isValid();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Director_isValid : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Director_startAnimation(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_startAnimation : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->startAnimation();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Director_startAnimation : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Director_getOpenGLView(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_getOpenGLView : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::GLView* ret = cobj->getOpenGLView();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::GLView>(cx, (cocos2d::GLView*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Director_getOpenGLView : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Director_getRunningScene(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_getRunningScene : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::Scene* ret = cobj->getRunningScene();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Scene>(cx, (cocos2d::Scene*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Director_getRunningScene : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Director_setViewport(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_setViewport : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->setViewport();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Director_setViewport : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Director_stopAnimation(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_stopAnimation : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->stopAnimation();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Director_stopAnimation : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Director_popToSceneStackLevel(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_popToSceneStackLevel : Invalid Native Object");
|
|
if (argc == 1) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Director_popToSceneStackLevel : Error processing arguments");
|
|
cobj->popToSceneStackLevel(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Director_popToSceneStackLevel : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Director_resume(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_resume : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->resume();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Director_resume : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Director_isNextDeltaTimeZero(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_isNextDeltaTimeZero : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->isNextDeltaTimeZero();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Director_isNextDeltaTimeZero : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Director_setClearColor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_setClearColor : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Color4F arg0;
|
|
ok &= jsval_to_cccolor4f(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Director_setClearColor : Error processing arguments");
|
|
cobj->setClearColor(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Director_setClearColor : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Director_setOpenGLView(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_setOpenGLView : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::GLView* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::GLView*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Director_setOpenGLView : Error processing arguments");
|
|
cobj->setOpenGLView(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Director_setOpenGLView : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Director_convertToGL(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_convertToGL : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Vec2 arg0;
|
|
ok &= jsval_to_vector2(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Director_convertToGL : Error processing arguments");
|
|
cocos2d::Vec2 ret = cobj->convertToGL(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = vector2_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Director_convertToGL : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Director_purgeCachedData(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_purgeCachedData : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->purgeCachedData();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Director_purgeCachedData : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Director_getTotalFrames(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_getTotalFrames : Invalid Native Object");
|
|
if (argc == 0) {
|
|
unsigned int ret = cobj->getTotalFrames();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = uint32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Director_getTotalFrames : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Director_runWithScene(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_runWithScene : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Scene* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Scene*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Director_runWithScene : Error processing arguments");
|
|
cobj->runWithScene(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Director_runWithScene : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Director_setNotificationNode(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_setNotificationNode : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Node* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Director_setNotificationNode : Error processing arguments");
|
|
cobj->setNotificationNode(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Director_setNotificationNode : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Director_drawScene(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_drawScene : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->drawScene();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Director_drawScene : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Director_restart(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_restart : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->restart();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Director_restart : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Director_popScene(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_popScene : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->popScene();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Director_popScene : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Director_loadIdentityMatrix(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_loadIdentityMatrix : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::MATRIX_STACK_TYPE arg0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Director_loadIdentityMatrix : Error processing arguments");
|
|
cobj->loadIdentityMatrix(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Director_loadIdentityMatrix : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Director_isDisplayStats(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_isDisplayStats : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->isDisplayStats();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Director_isDisplayStats : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Director_setProjection(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_setProjection : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Director::Projection arg0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Director_setProjection : Error processing arguments");
|
|
cobj->setProjection(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Director_setProjection : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Director_multiplyMatrix(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_multiplyMatrix : Invalid Native Object");
|
|
if (argc == 2) {
|
|
cocos2d::MATRIX_STACK_TYPE arg0;
|
|
cocos2d::Mat4 arg1;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
ok &= jsval_to_matrix(cx, args.get(1), &arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Director_multiplyMatrix : Error processing arguments");
|
|
cobj->multiplyMatrix(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Director_multiplyMatrix : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Director_getZEye(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_getZEye : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getZEye();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Director_getZEye : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Director_setNextDeltaTimeZero(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_setNextDeltaTimeZero : Invalid Native Object");
|
|
if (argc == 1) {
|
|
bool arg0;
|
|
arg0 = JS::ToBoolean(args.get(0));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Director_setNextDeltaTimeZero : Error processing arguments");
|
|
cobj->setNextDeltaTimeZero(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Director_setNextDeltaTimeZero : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Director_popMatrix(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_popMatrix : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::MATRIX_STACK_TYPE arg0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Director_popMatrix : Error processing arguments");
|
|
cobj->popMatrix(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Director_popMatrix : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Director_getVisibleSize(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_getVisibleSize : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::Size ret = cobj->getVisibleSize();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ccsize_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Director_getVisibleSize : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Director_loadProjectionMatrix(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_loadProjectionMatrix : Invalid Native Object");
|
|
if (argc == 2) {
|
|
cocos2d::Mat4 arg0;
|
|
unsigned int arg1 = 0;
|
|
ok &= jsval_to_matrix(cx, args.get(0), &arg0);
|
|
ok &= jsval_to_uint32(cx, args.get(1), &arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Director_loadProjectionMatrix : Error processing arguments");
|
|
cobj->loadProjectionMatrix(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Director_loadProjectionMatrix : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Director_initProjectionMatrixStack(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_initProjectionMatrixStack : Invalid Native Object");
|
|
if (argc == 1) {
|
|
unsigned int arg0 = 0;
|
|
ok &= jsval_to_uint32(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Director_initProjectionMatrixStack : Error processing arguments");
|
|
cobj->initProjectionMatrixStack(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Director_initProjectionMatrixStack : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Director_getScheduler(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_getScheduler : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::Scheduler* ret = cobj->getScheduler();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Scheduler>(cx, (cocos2d::Scheduler*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Director_getScheduler : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Director_pushScene(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_pushScene : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Scene* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Scene*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Director_pushScene : Error processing arguments");
|
|
cobj->pushScene(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Director_pushScene : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Director_getAnimationInterval(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_getAnimationInterval : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getAnimationInterval();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Director_getAnimationInterval : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Director_isPaused(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_isPaused : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->isPaused();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Director_isPaused : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Director_setDisplayStats(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_setDisplayStats : Invalid Native Object");
|
|
if (argc == 1) {
|
|
bool arg0;
|
|
arg0 = JS::ToBoolean(args.get(0));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Director_setDisplayStats : Error processing arguments");
|
|
cobj->setDisplayStats(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Director_setDisplayStats : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Director_getEventDispatcher(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_getEventDispatcher : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::EventDispatcher* ret = cobj->getEventDispatcher();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::EventDispatcher>(cx, (cocos2d::EventDispatcher*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Director_getEventDispatcher : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Director_replaceScene(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_replaceScene : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Scene* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Scene*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Director_replaceScene : Error processing arguments");
|
|
cobj->replaceScene(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Director_replaceScene : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Director_setAnimationInterval(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_setAnimationInterval : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Director_setAnimationInterval : Error processing arguments");
|
|
cobj->setAnimationInterval(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Director_setAnimationInterval : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Director_getActionManager(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_getActionManager : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::ActionManager* ret = cobj->getActionManager();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::ActionManager>(cx, (cocos2d::ActionManager*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Director_getActionManager : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Director_getInstance(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
if (argc == 0) {
|
|
|
|
auto ret = cocos2d::Director::getInstance();
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::Director>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_get_or_create_jsobject(cx, ret, typeClass, "cocos2d::Director"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_Director_getInstance : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
|
|
void js_register_cocos2dx_Director(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_Director_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_Director_class->name = "Director";
|
|
jsb_cocos2d_Director_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Director_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_Director_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Director_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_Director_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_Director_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_Director_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_Director_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("pause", js_cocos2dx_Director_pause, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("pushProjectionMatrix", js_cocos2dx_Director_pushProjectionMatrix, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("popProjectionMatrix", js_cocos2dx_Director_popProjectionMatrix, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setEventDispatcher", js_cocos2dx_Director_setEventDispatcher, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("loadProjectionIdentityMatrix", js_cocos2dx_Director_loadProjectionIdentityMatrix, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setContentScaleFactor", js_cocos2dx_Director_setContentScaleFactor, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getContentScaleFactor", js_cocos2dx_Director_getContentScaleFactor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getWinSizeInPixels", js_cocos2dx_Director_getWinSizeInPixels, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getDeltaTime", js_cocos2dx_Director_getDeltaTime, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setGLDefaultValues", js_cocos2dx_Director_setGLDefaultValues, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setActionManager", js_cocos2dx_Director_setActionManager, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setAlphaBlending", js_cocos2dx_Director_setAlphaBlending, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("popToRootScene", js_cocos2dx_Director_popToRootScene, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("loadMatrix", js_cocos2dx_Director_loadMatrix, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getNotificationNode", js_cocos2dx_Director_getNotificationNode, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getWinSize", js_cocos2dx_Director_getWinSize, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("end", js_cocos2dx_Director_end, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getTextureCache", js_cocos2dx_Director_getTextureCache, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("isSendCleanupToScene", js_cocos2dx_Director_isSendCleanupToScene, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getVisibleOrigin", js_cocos2dx_Director_getVisibleOrigin, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("mainLoop", js_cocos2dx_Director_mainLoop, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setDepthTest", js_cocos2dx_Director_setDepthTest, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getFrameRate", js_cocos2dx_Director_getFrameRate, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getSecondsPerFrame", js_cocos2dx_Director_getSecondsPerFrame, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("resetMatrixStack", js_cocos2dx_Director_resetMatrixStack, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("convertToUI", js_cocos2dx_Director_convertToUI, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("pushMatrix", js_cocos2dx_Director_pushMatrix, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setDefaultValues", js_cocos2dx_Director_setDefaultValues, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("init", js_cocos2dx_Director_init, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setScheduler", js_cocos2dx_Director_setScheduler, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("multiplyProjectionMatrix", js_cocos2dx_Director_multiplyProjectionMatrix, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getMatrix", js_cocos2dx_Director_getMatrix, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("isValid", js_cocos2dx_Director_isValid, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("startAnimation", js_cocos2dx_Director_startAnimation, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getOpenGLView", js_cocos2dx_Director_getOpenGLView, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getRunningScene", js_cocos2dx_Director_getRunningScene, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setViewport", js_cocos2dx_Director_setViewport, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("stopAnimation", js_cocos2dx_Director_stopAnimation, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("popToSceneStackLevel", js_cocos2dx_Director_popToSceneStackLevel, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("resume", js_cocos2dx_Director_resume, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("isNextDeltaTimeZero", js_cocos2dx_Director_isNextDeltaTimeZero, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setClearColor", js_cocos2dx_Director_setClearColor, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setOpenGLView", js_cocos2dx_Director_setOpenGLView, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("convertToGL", js_cocos2dx_Director_convertToGL, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("purgeCachedData", js_cocos2dx_Director_purgeCachedData, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getTotalFrames", js_cocos2dx_Director_getTotalFrames, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("runWithScene", js_cocos2dx_Director_runWithScene, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setNotificationNode", js_cocos2dx_Director_setNotificationNode, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("drawScene", js_cocos2dx_Director_drawScene, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("restart", js_cocos2dx_Director_restart, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("popScene", js_cocos2dx_Director_popScene, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("loadIdentityMatrix", js_cocos2dx_Director_loadIdentityMatrix, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("isDisplayStats", js_cocos2dx_Director_isDisplayStats, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setProjection", js_cocos2dx_Director_setProjection, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("multiplyMatrix", js_cocos2dx_Director_multiplyMatrix, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getZEye", js_cocos2dx_Director_getZEye, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setNextDeltaTimeZero", js_cocos2dx_Director_setNextDeltaTimeZero, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("popMatrix", js_cocos2dx_Director_popMatrix, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getVisibleSize", js_cocos2dx_Director_getVisibleSize, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("loadProjectionMatrix", js_cocos2dx_Director_loadProjectionMatrix, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initProjectionMatrixStack", js_cocos2dx_Director_initProjectionMatrixStack, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getScheduler", js_cocos2dx_Director_getScheduler, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("pushScene", js_cocos2dx_Director_pushScene, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getAnimationInterval", js_cocos2dx_Director_getAnimationInterval, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("isPaused", js_cocos2dx_Director_isPaused, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setDisplayStats", js_cocos2dx_Director_setDisplayStats, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getEventDispatcher", js_cocos2dx_Director_getEventDispatcher, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("replaceScene", js_cocos2dx_Director_replaceScene, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setAnimationInterval", js_cocos2dx_Director_setAnimationInterval, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getActionManager", js_cocos2dx_Director_getActionManager, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("getInstance", js_cocos2dx_Director_getInstance, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
jsb_cocos2d_Director_prototype = JS_InitClass(
|
|
cx, global,
|
|
JS::NullPtr(),
|
|
jsb_cocos2d_Director_class,
|
|
empty_constructor, 0,
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_Director_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "Director"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::Director>(cx, jsb_cocos2d_Director_class, proto, JS::NullPtr());
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_Scheduler_class;
|
|
JSObject *jsb_cocos2d_Scheduler_prototype;
|
|
|
|
bool js_cocos2dx_Scheduler_setTimeScale(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Scheduler* cobj = (cocos2d::Scheduler *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Scheduler_setTimeScale : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Scheduler_setTimeScale : Error processing arguments");
|
|
cobj->setTimeScale(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Scheduler_setTimeScale : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Scheduler_unscheduleAllWithMinPriority(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Scheduler* cobj = (cocos2d::Scheduler *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Scheduler_unscheduleAllWithMinPriority : Invalid Native Object");
|
|
if (argc == 1) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Scheduler_unscheduleAllWithMinPriority : Error processing arguments");
|
|
cobj->unscheduleAllWithMinPriority(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Scheduler_unscheduleAllWithMinPriority : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Scheduler_update(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Scheduler* cobj = (cocos2d::Scheduler *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Scheduler_update : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Scheduler_update : Error processing arguments");
|
|
cobj->update(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Scheduler_update : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Scheduler_unscheduleScriptEntry(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Scheduler* cobj = (cocos2d::Scheduler *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Scheduler_unscheduleScriptEntry : Invalid Native Object");
|
|
if (argc == 1) {
|
|
unsigned int arg0 = 0;
|
|
ok &= jsval_to_uint32(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Scheduler_unscheduleScriptEntry : Error processing arguments");
|
|
cobj->unscheduleScriptEntry(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Scheduler_unscheduleScriptEntry : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Scheduler_performFunctionInCocosThread(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Scheduler* cobj = (cocos2d::Scheduler *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Scheduler_performFunctionInCocosThread : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::function<void ()> arg0;
|
|
do {
|
|
if(JS_TypeOfValue(cx, args.get(0)) == JSTYPE_FUNCTION)
|
|
{
|
|
JS::RootedObject jstarget(cx, args.thisv().toObjectOrNull());
|
|
std::shared_ptr<JSFunctionWrapper> func(new JSFunctionWrapper(cx, jstarget, args.get(0), args.thisv()));
|
|
auto lambda = [=]() -> void {
|
|
JSB_AUTOCOMPARTMENT_WITH_GLOBAL_OBJCET
|
|
JS::RootedValue rval(cx);
|
|
bool succeed = func->invoke(0, nullptr, &rval);
|
|
if (!succeed && JS_IsExceptionPending(cx)) {
|
|
JS_ReportPendingException(cx);
|
|
}
|
|
};
|
|
arg0 = lambda;
|
|
}
|
|
else
|
|
{
|
|
arg0 = nullptr;
|
|
}
|
|
} while(0)
|
|
;
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Scheduler_performFunctionInCocosThread : Error processing arguments");
|
|
cobj->performFunctionInCocosThread(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Scheduler_performFunctionInCocosThread : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Scheduler_unscheduleAll(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Scheduler* cobj = (cocos2d::Scheduler *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Scheduler_unscheduleAll : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->unscheduleAll();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Scheduler_unscheduleAll : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Scheduler_getTimeScale(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Scheduler* cobj = (cocos2d::Scheduler *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Scheduler_getTimeScale : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getTimeScale();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Scheduler_getTimeScale : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Scheduler_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::Scheduler* cobj = new (std::nothrow) cocos2d::Scheduler();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::Scheduler>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::Scheduler"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
|
|
|
|
void js_register_cocos2dx_Scheduler(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_Scheduler_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_Scheduler_class->name = "Scheduler";
|
|
jsb_cocos2d_Scheduler_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Scheduler_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_Scheduler_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Scheduler_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_Scheduler_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_Scheduler_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_Scheduler_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_Scheduler_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("setTimeScale", js_cocos2dx_Scheduler_setTimeScale, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("unscheduleAllWithMinPriority", js_cocos2dx_Scheduler_unscheduleAllWithMinPriority, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("update", js_cocos2dx_Scheduler_update, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("unscheduleScriptEntry", js_cocos2dx_Scheduler_unscheduleScriptEntry, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("performFunctionInCocosThread", js_cocos2dx_Scheduler_performFunctionInCocosThread, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("unscheduleAll", js_cocos2dx_Scheduler_unscheduleAll, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getTimeScale", js_cocos2dx_Scheduler_getTimeScale, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JSFunctionSpec *st_funcs = NULL;
|
|
|
|
jsb_cocos2d_Scheduler_prototype = JS_InitClass(
|
|
cx, global,
|
|
JS::NullPtr(),
|
|
jsb_cocos2d_Scheduler_class,
|
|
js_cocos2dx_Scheduler_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_Scheduler_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "Scheduler"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::Scheduler>(cx, jsb_cocos2d_Scheduler_class, proto, JS::NullPtr());
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_AsyncTaskPool_class;
|
|
JSObject *jsb_cocos2d_AsyncTaskPool_prototype;
|
|
|
|
bool js_cocos2dx_AsyncTaskPool_stopTasks(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::AsyncTaskPool* cobj = (cocos2d::AsyncTaskPool *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_AsyncTaskPool_stopTasks : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::AsyncTaskPool::TaskType arg0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_AsyncTaskPool_stopTasks : Error processing arguments");
|
|
cobj->stopTasks(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_AsyncTaskPool_stopTasks : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_AsyncTaskPool_destroyInstance(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
if (argc == 0) {
|
|
cocos2d::AsyncTaskPool::destroyInstance();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_AsyncTaskPool_destroyInstance : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_AsyncTaskPool_getInstance(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
if (argc == 0) {
|
|
|
|
cocos2d::AsyncTaskPool* ret = cocos2d::AsyncTaskPool::getInstance();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::AsyncTaskPool>(cx, (cocos2d::AsyncTaskPool*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_AsyncTaskPool_getInstance : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
|
|
void js_register_cocos2dx_AsyncTaskPool(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_AsyncTaskPool_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_AsyncTaskPool_class->name = "AsyncTaskPool";
|
|
jsb_cocos2d_AsyncTaskPool_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_AsyncTaskPool_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_AsyncTaskPool_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_AsyncTaskPool_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_AsyncTaskPool_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_AsyncTaskPool_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_AsyncTaskPool_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_AsyncTaskPool_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("stopTasks", js_cocos2dx_AsyncTaskPool_stopTasks, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("destroyInstance", js_cocos2dx_AsyncTaskPool_destroyInstance, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getInstance", js_cocos2dx_AsyncTaskPool_getInstance, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
jsb_cocos2d_AsyncTaskPool_prototype = JS_InitClass(
|
|
cx, global,
|
|
JS::NullPtr(),
|
|
jsb_cocos2d_AsyncTaskPool_class,
|
|
empty_constructor, 0,
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_AsyncTaskPool_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "AsyncTaskPool"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::FalseHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::AsyncTaskPool>(cx, jsb_cocos2d_AsyncTaskPool_class, proto, JS::NullPtr());
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_Action_class;
|
|
JSObject *jsb_cocos2d_Action_prototype;
|
|
|
|
bool js_cocos2dx_Action_startWithTarget(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Action* cobj = (cocos2d::Action *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Action_startWithTarget : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Node* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Action_startWithTarget : Error processing arguments");
|
|
cobj->startWithTarget(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Action_startWithTarget : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Action_setOriginalTarget(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Action* cobj = (cocos2d::Action *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Action_setOriginalTarget : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Node* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Action_setOriginalTarget : Error processing arguments");
|
|
cobj->setOriginalTarget(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Action_setOriginalTarget : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Action_clone(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Action* cobj = (cocos2d::Action *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Action_clone : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::Action* ret = cobj->clone();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Action>(cx, (cocos2d::Action*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Action_clone : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Action_getOriginalTarget(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Action* cobj = (cocos2d::Action *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Action_getOriginalTarget : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::Node* ret = cobj->getOriginalTarget();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Node>(cx, (cocos2d::Node*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Action_getOriginalTarget : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Action_stop(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Action* cobj = (cocos2d::Action *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Action_stop : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->stop();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Action_stop : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Action_update(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Action* cobj = (cocos2d::Action *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Action_update : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Action_update : Error processing arguments");
|
|
cobj->update(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Action_update : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Action_getTarget(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Action* cobj = (cocos2d::Action *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Action_getTarget : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::Node* ret = cobj->getTarget();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Node>(cx, (cocos2d::Node*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Action_getTarget : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Action_getFlags(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Action* cobj = (cocos2d::Action *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Action_getFlags : Invalid Native Object");
|
|
if (argc == 0) {
|
|
unsigned int ret = cobj->getFlags();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = uint32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Action_getFlags : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Action_step(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Action* cobj = (cocos2d::Action *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Action_step : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Action_step : Error processing arguments");
|
|
cobj->step(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Action_step : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Action_setTag(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Action* cobj = (cocos2d::Action *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Action_setTag : Invalid Native Object");
|
|
if (argc == 1) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Action_setTag : Error processing arguments");
|
|
cobj->setTag(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Action_setTag : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Action_setFlags(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Action* cobj = (cocos2d::Action *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Action_setFlags : Invalid Native Object");
|
|
if (argc == 1) {
|
|
unsigned int arg0 = 0;
|
|
ok &= jsval_to_uint32(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Action_setFlags : Error processing arguments");
|
|
cobj->setFlags(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Action_setFlags : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Action_getTag(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Action* cobj = (cocos2d::Action *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Action_getTag : Invalid Native Object");
|
|
if (argc == 0) {
|
|
int ret = cobj->getTag();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = int32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Action_getTag : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Action_setTarget(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Action* cobj = (cocos2d::Action *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Action_setTarget : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Node* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Action_setTarget : Error processing arguments");
|
|
cobj->setTarget(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Action_setTarget : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Action_isDone(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Action* cobj = (cocos2d::Action *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Action_isDone : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->isDone();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Action_isDone : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Action_reverse(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Action* cobj = (cocos2d::Action *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Action_reverse : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::Action* ret = cobj->reverse();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Action>(cx, (cocos2d::Action*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Action_reverse : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
|
|
void js_register_cocos2dx_Action(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_Action_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_Action_class->name = "Action";
|
|
jsb_cocos2d_Action_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Action_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_Action_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Action_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_Action_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_Action_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_Action_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_Action_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("startWithTarget", js_cocos2dx_Action_startWithTarget, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setOriginalTarget", js_cocos2dx_Action_setOriginalTarget, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("clone", js_cocos2dx_Action_clone, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getOriginalTarget", js_cocos2dx_Action_getOriginalTarget, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("stop", js_cocos2dx_Action_stop, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("update", js_cocos2dx_Action_update, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getTarget", js_cocos2dx_Action_getTarget, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getFlags", js_cocos2dx_Action_getFlags, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("step", js_cocos2dx_Action_step, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setTag", js_cocos2dx_Action_setTag, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setFlags", js_cocos2dx_Action_setFlags, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getTag", js_cocos2dx_Action_getTag, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setTarget", js_cocos2dx_Action_setTarget, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("isDone", js_cocos2dx_Action_isDone, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("reverse", js_cocos2dx_Action_reverse, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JSFunctionSpec *st_funcs = NULL;
|
|
|
|
jsb_cocos2d_Action_prototype = JS_InitClass(
|
|
cx, global,
|
|
JS::NullPtr(),
|
|
jsb_cocos2d_Action_class,
|
|
empty_constructor, 0,
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_Action_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "Action"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::Action>(cx, jsb_cocos2d_Action_class, proto, JS::NullPtr());
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_FiniteTimeAction_class;
|
|
JSObject *jsb_cocos2d_FiniteTimeAction_prototype;
|
|
|
|
bool js_cocos2dx_FiniteTimeAction_setDuration(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::FiniteTimeAction* cobj = (cocos2d::FiniteTimeAction *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FiniteTimeAction_setDuration : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FiniteTimeAction_setDuration : Error processing arguments");
|
|
cobj->setDuration(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_FiniteTimeAction_setDuration : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_FiniteTimeAction_getDuration(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::FiniteTimeAction* cobj = (cocos2d::FiniteTimeAction *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FiniteTimeAction_getDuration : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getDuration();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_FiniteTimeAction_getDuration : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
|
|
extern JSObject *jsb_cocos2d_Action_prototype;
|
|
|
|
void js_register_cocos2dx_FiniteTimeAction(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_FiniteTimeAction_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_FiniteTimeAction_class->name = "FiniteTimeAction";
|
|
jsb_cocos2d_FiniteTimeAction_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_FiniteTimeAction_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_FiniteTimeAction_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_FiniteTimeAction_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_FiniteTimeAction_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_FiniteTimeAction_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_FiniteTimeAction_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_FiniteTimeAction_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("setDuration", js_cocos2dx_FiniteTimeAction_setDuration, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getDuration", js_cocos2dx_FiniteTimeAction_getDuration, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JSFunctionSpec *st_funcs = NULL;
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_Action_prototype);
|
|
jsb_cocos2d_FiniteTimeAction_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_FiniteTimeAction_class,
|
|
empty_constructor, 0,
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_FiniteTimeAction_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "FiniteTimeAction"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::FiniteTimeAction>(cx, jsb_cocos2d_FiniteTimeAction_class, proto, parent_proto);
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_Speed_class;
|
|
JSObject *jsb_cocos2d_Speed_prototype;
|
|
|
|
bool js_cocos2dx_Speed_setInnerAction(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Speed* cobj = (cocos2d::Speed *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Speed_setInnerAction : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::ActionInterval* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Speed_setInnerAction : Error processing arguments");
|
|
cobj->setInnerAction(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Speed_setInnerAction : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Speed_getSpeed(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Speed* cobj = (cocos2d::Speed *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Speed_getSpeed : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getSpeed();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Speed_getSpeed : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Speed_setSpeed(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Speed* cobj = (cocos2d::Speed *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Speed_setSpeed : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Speed_setSpeed : Error processing arguments");
|
|
cobj->setSpeed(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Speed_setSpeed : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Speed_initWithAction(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Speed* cobj = (cocos2d::Speed *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Speed_initWithAction : Invalid Native Object");
|
|
if (argc == 2) {
|
|
cocos2d::ActionInterval* arg0 = nullptr;
|
|
double arg1 = 0;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Speed_initWithAction : Error processing arguments");
|
|
bool ret = cobj->initWithAction(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Speed_initWithAction : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Speed_getInnerAction(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Speed* cobj = (cocos2d::Speed *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Speed_getInnerAction : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::ActionInterval* ret = cobj->getInnerAction();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::ActionInterval>(cx, (cocos2d::ActionInterval*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Speed_getInnerAction : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Speed_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 2) {
|
|
cocos2d::ActionInterval* arg0 = nullptr;
|
|
double arg1 = 0;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Speed_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::Speed::create(arg0, arg1);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::Speed>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::Speed"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_Speed_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_Speed_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::Speed* cobj = new (std::nothrow) cocos2d::Speed();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::Speed>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::Speed"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_Action_prototype;
|
|
|
|
void js_register_cocos2dx_Speed(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_Speed_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_Speed_class->name = "Speed";
|
|
jsb_cocos2d_Speed_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Speed_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_Speed_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Speed_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_Speed_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_Speed_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_Speed_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_Speed_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("setInnerAction", js_cocos2dx_Speed_setInnerAction, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("_getSpeed", js_cocos2dx_Speed_getSpeed, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("_setSpeed", js_cocos2dx_Speed_setSpeed, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initWithAction", js_cocos2dx_Speed_initWithAction, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getInnerAction", js_cocos2dx_Speed_getInnerAction, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_Speed_create, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_Action_prototype);
|
|
jsb_cocos2d_Speed_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_Speed_class,
|
|
js_cocos2dx_Speed_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_Speed_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "Speed"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::Speed>(cx, jsb_cocos2d_Speed_class, proto, parent_proto);
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_Follow_class;
|
|
JSObject *jsb_cocos2d_Follow_prototype;
|
|
|
|
bool js_cocos2dx_Follow_setBoundarySet(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Follow* cobj = (cocos2d::Follow *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Follow_setBoundarySet : Invalid Native Object");
|
|
if (argc == 1) {
|
|
bool arg0;
|
|
arg0 = JS::ToBoolean(args.get(0));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Follow_setBoundarySet : Error processing arguments");
|
|
cobj->setBoundarySet(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Follow_setBoundarySet : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Follow_initWithTarget(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Follow* cobj = (cocos2d::Follow *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Follow_initWithTarget : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Node* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Follow_initWithTarget : Error processing arguments");
|
|
bool ret = cobj->initWithTarget(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
if (argc == 2) {
|
|
cocos2d::Node* arg0 = nullptr;
|
|
cocos2d::Rect arg1;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
ok &= jsval_to_ccrect(cx, args.get(1), &arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Follow_initWithTarget : Error processing arguments");
|
|
bool ret = cobj->initWithTarget(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Follow_initWithTarget : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Follow_initWithTargetAndOffset(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Follow* cobj = (cocos2d::Follow *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Follow_initWithTargetAndOffset : Invalid Native Object");
|
|
if (argc == 3) {
|
|
cocos2d::Node* arg0 = nullptr;
|
|
double arg1 = 0;
|
|
double arg2 = 0;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Follow_initWithTargetAndOffset : Error processing arguments");
|
|
bool ret = cobj->initWithTargetAndOffset(arg0, arg1, arg2);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
if (argc == 4) {
|
|
cocos2d::Node* arg0 = nullptr;
|
|
double arg1 = 0;
|
|
double arg2 = 0;
|
|
cocos2d::Rect arg3;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
ok &= jsval_to_ccrect(cx, args.get(3), &arg3);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Follow_initWithTargetAndOffset : Error processing arguments");
|
|
bool ret = cobj->initWithTargetAndOffset(arg0, arg1, arg2, arg3);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Follow_initWithTargetAndOffset : wrong number of arguments: %d, was expecting %d", argc, 3);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Follow_isBoundarySet(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Follow* cobj = (cocos2d::Follow *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Follow_isBoundarySet : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->isBoundarySet();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Follow_isBoundarySet : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Follow_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
cocos2d::Node* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Follow_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::Follow::create(arg0);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::Follow>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::Follow"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
if (argc == 2) {
|
|
cocos2d::Node* arg0 = nullptr;
|
|
cocos2d::Rect arg1;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
ok &= jsval_to_ccrect(cx, args.get(1), &arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Follow_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::Follow::create(arg0, arg1);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::Follow>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::Follow"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_Follow_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_Follow_createWithOffset(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 3) {
|
|
cocos2d::Node* arg0 = nullptr;
|
|
double arg1 = 0;
|
|
double arg2 = 0;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Follow_createWithOffset : Error processing arguments");
|
|
|
|
auto ret = cocos2d::Follow::createWithOffset(arg0, arg1, arg2);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::Follow>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::Follow"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
if (argc == 4) {
|
|
cocos2d::Node* arg0 = nullptr;
|
|
double arg1 = 0;
|
|
double arg2 = 0;
|
|
cocos2d::Rect arg3;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
ok &= jsval_to_ccrect(cx, args.get(3), &arg3);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Follow_createWithOffset : Error processing arguments");
|
|
|
|
auto ret = cocos2d::Follow::createWithOffset(arg0, arg1, arg2, arg3);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::Follow>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::Follow"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_Follow_createWithOffset : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_Follow_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::Follow* cobj = new (std::nothrow) cocos2d::Follow();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::Follow>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::Follow"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_Follow_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::Follow *nobj = new (std::nothrow) cocos2d::Follow();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::Follow");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_Action_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_Follow(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_Follow_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_Follow_class->name = "Follow";
|
|
jsb_cocos2d_Follow_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Follow_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_Follow_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Follow_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_Follow_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_Follow_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_Follow_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_Follow_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("setBoundarySet", js_cocos2dx_Follow_setBoundarySet, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initWithTarget", js_cocos2dx_Follow_initWithTarget, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initWithTargetAndOffset", js_cocos2dx_Follow_initWithTargetAndOffset, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("isBoundarySet", js_cocos2dx_Follow_isBoundarySet, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_Follow_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_Follow_create, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("createWithOffset", js_cocos2dx_Follow_createWithOffset, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_Action_prototype);
|
|
jsb_cocos2d_Follow_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_Follow_class,
|
|
js_cocos2dx_Follow_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_Follow_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "Follow"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::Follow>(cx, jsb_cocos2d_Follow_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.Follow.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_Image_class;
|
|
JSObject *jsb_cocos2d_Image_prototype;
|
|
|
|
bool js_cocos2dx_Image_hasPremultipliedAlpha(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Image* cobj = (cocos2d::Image *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Image_hasPremultipliedAlpha : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->hasPremultipliedAlpha();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Image_hasPremultipliedAlpha : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Image_getDataLen(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Image* cobj = (cocos2d::Image *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Image_getDataLen : Invalid Native Object");
|
|
if (argc == 0) {
|
|
ssize_t ret = cobj->getDataLen();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ssize_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Image_getDataLen : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Image_saveToFile(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Image* cobj = (cocos2d::Image *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Image_saveToFile : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Image_saveToFile : Error processing arguments");
|
|
bool ret = cobj->saveToFile(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
if (argc == 2) {
|
|
std::string arg0;
|
|
bool arg1;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
arg1 = JS::ToBoolean(args.get(1));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Image_saveToFile : Error processing arguments");
|
|
bool ret = cobj->saveToFile(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Image_saveToFile : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Image_hasAlpha(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Image* cobj = (cocos2d::Image *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Image_hasAlpha : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->hasAlpha();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Image_hasAlpha : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Image_isCompressed(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Image* cobj = (cocos2d::Image *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Image_isCompressed : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->isCompressed();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Image_isCompressed : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Image_getHeight(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Image* cobj = (cocos2d::Image *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Image_getHeight : Invalid Native Object");
|
|
if (argc == 0) {
|
|
int ret = cobj->getHeight();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = int32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Image_getHeight : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Image_initWithImageFile(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Image* cobj = (cocos2d::Image *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Image_initWithImageFile : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Image_initWithImageFile : Error processing arguments");
|
|
bool ret = cobj->initWithImageFile(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Image_initWithImageFile : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Image_getWidth(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Image* cobj = (cocos2d::Image *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Image_getWidth : Invalid Native Object");
|
|
if (argc == 0) {
|
|
int ret = cobj->getWidth();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = int32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Image_getWidth : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Image_getBitPerPixel(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Image* cobj = (cocos2d::Image *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Image_getBitPerPixel : Invalid Native Object");
|
|
if (argc == 0) {
|
|
int ret = cobj->getBitPerPixel();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = int32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Image_getBitPerPixel : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Image_getFileType(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Image* cobj = (cocos2d::Image *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Image_getFileType : Invalid Native Object");
|
|
if (argc == 0) {
|
|
int ret = (int)cobj->getFileType();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = int32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Image_getFileType : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Image_getFilePath(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Image* cobj = (cocos2d::Image *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Image_getFilePath : Invalid Native Object");
|
|
if (argc == 0) {
|
|
std::string ret = cobj->getFilePath();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = std_string_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Image_getFilePath : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Image_getNumberOfMipmaps(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Image* cobj = (cocos2d::Image *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Image_getNumberOfMipmaps : Invalid Native Object");
|
|
if (argc == 0) {
|
|
int ret = cobj->getNumberOfMipmaps();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = int32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Image_getNumberOfMipmaps : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Image_getRenderFormat(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Image* cobj = (cocos2d::Image *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Image_getRenderFormat : Invalid Native Object");
|
|
if (argc == 0) {
|
|
int ret = (int)cobj->getRenderFormat();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = int32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Image_getRenderFormat : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Image_getData(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Image* cobj = (cocos2d::Image *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Image_getData : Invalid Native Object");
|
|
if (argc == 0) {
|
|
unsigned char* ret = cobj->getData();
|
|
jsval jsret = JSVAL_NULL;
|
|
#pragma warning NO CONVERSION FROM NATIVE FOR unsigned char*;
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Image_getData : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Image_getMipmaps(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Image* cobj = (cocos2d::Image *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Image_getMipmaps : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::_MipmapInfo* ret = cobj->getMipmaps();
|
|
jsval jsret = JSVAL_NULL;
|
|
#pragma warning NO CONVERSION FROM NATIVE FOR _MipmapInfo*;
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Image_getMipmaps : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Image_initWithRawData(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Image* cobj = (cocos2d::Image *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Image_initWithRawData : Invalid Native Object");
|
|
if (argc == 5) {
|
|
const unsigned char* arg0 = nullptr;
|
|
ssize_t arg1 = 0;
|
|
int arg2 = 0;
|
|
int arg3 = 0;
|
|
int arg4 = 0;
|
|
#pragma warning NO CONVERSION TO NATIVE FOR unsigned char*
|
|
ok = false;
|
|
ok &= jsval_to_ssize(cx, args.get(1), &arg1);
|
|
ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2);
|
|
ok &= jsval_to_int32(cx, args.get(3), (int32_t *)&arg3);
|
|
ok &= jsval_to_int32(cx, args.get(4), (int32_t *)&arg4);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Image_initWithRawData : Error processing arguments");
|
|
bool ret = cobj->initWithRawData(arg0, arg1, arg2, arg3, arg4);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
if (argc == 6) {
|
|
const unsigned char* arg0 = nullptr;
|
|
ssize_t arg1 = 0;
|
|
int arg2 = 0;
|
|
int arg3 = 0;
|
|
int arg4 = 0;
|
|
bool arg5;
|
|
#pragma warning NO CONVERSION TO NATIVE FOR unsigned char*
|
|
ok = false;
|
|
ok &= jsval_to_ssize(cx, args.get(1), &arg1);
|
|
ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2);
|
|
ok &= jsval_to_int32(cx, args.get(3), (int32_t *)&arg3);
|
|
ok &= jsval_to_int32(cx, args.get(4), (int32_t *)&arg4);
|
|
arg5 = JS::ToBoolean(args.get(5));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Image_initWithRawData : Error processing arguments");
|
|
bool ret = cobj->initWithRawData(arg0, arg1, arg2, arg3, arg4, arg5);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Image_initWithRawData : wrong number of arguments: %d, was expecting %d", argc, 5);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Image_setPVRImagesHavePremultipliedAlpha(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
bool arg0;
|
|
arg0 = JS::ToBoolean(args.get(0));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Image_setPVRImagesHavePremultipliedAlpha : Error processing arguments");
|
|
cocos2d::Image::setPVRImagesHavePremultipliedAlpha(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_Image_setPVRImagesHavePremultipliedAlpha : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_Image_setPNGPremultipliedAlphaEnabled(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
bool arg0;
|
|
arg0 = JS::ToBoolean(args.get(0));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Image_setPNGPremultipliedAlphaEnabled : Error processing arguments");
|
|
cocos2d::Image::setPNGPremultipliedAlphaEnabled(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_Image_setPNGPremultipliedAlphaEnabled : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_Image_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::Image* cobj = new (std::nothrow) cocos2d::Image();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::Image>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::Image"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
|
|
|
|
void js_register_cocos2dx_Image(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_Image_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_Image_class->name = "Image";
|
|
jsb_cocos2d_Image_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Image_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_Image_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Image_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_Image_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_Image_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_Image_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_Image_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("hasPremultipliedAlpha", js_cocos2dx_Image_hasPremultipliedAlpha, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getDataLen", js_cocos2dx_Image_getDataLen, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("saveToFile", js_cocos2dx_Image_saveToFile, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("hasAlpha", js_cocos2dx_Image_hasAlpha, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("isCompressed", js_cocos2dx_Image_isCompressed, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getHeight", js_cocos2dx_Image_getHeight, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initWithImageFile", js_cocos2dx_Image_initWithImageFile, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getWidth", js_cocos2dx_Image_getWidth, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getBitPerPixel", js_cocos2dx_Image_getBitPerPixel, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getFileType", js_cocos2dx_Image_getFileType, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getFilePath", js_cocos2dx_Image_getFilePath, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getNumberOfMipmaps", js_cocos2dx_Image_getNumberOfMipmaps, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getRenderFormat", js_cocos2dx_Image_getRenderFormat, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getData", js_cocos2dx_Image_getData, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getMipmaps", js_cocos2dx_Image_getMipmaps, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initWithRawData", js_cocos2dx_Image_initWithRawData, 5, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("setPVRImagesHavePremultipliedAlpha", js_cocos2dx_Image_setPVRImagesHavePremultipliedAlpha, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setPNGPremultipliedAlphaEnabled", js_cocos2dx_Image_setPNGPremultipliedAlphaEnabled, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
jsb_cocos2d_Image_prototype = JS_InitClass(
|
|
cx, global,
|
|
JS::NullPtr(),
|
|
jsb_cocos2d_Image_class,
|
|
js_cocos2dx_Image_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_Image_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "Image"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::Image>(cx, jsb_cocos2d_Image_class, proto, JS::NullPtr());
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_GLProgramState_class;
|
|
JSObject *jsb_cocos2d_GLProgramState_prototype;
|
|
|
|
bool js_cocos2dx_GLProgramState_setUniformCallback(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::GLProgramState* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::GLProgramState *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgramState_setUniformCallback : Invalid Native Object");
|
|
do {
|
|
if (argc == 2) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
if (!ok) { ok = true; break; }
|
|
std::function<void (cocos2d::GLProgram *, cocos2d::Uniform *)> arg1;
|
|
do {
|
|
if(JS_TypeOfValue(cx, args.get(1)) == JSTYPE_FUNCTION)
|
|
{
|
|
JS::RootedObject jstarget(cx, args.thisv().toObjectOrNull());
|
|
std::shared_ptr<JSFunctionWrapper> func(new JSFunctionWrapper(cx, jstarget, args.get(1), args.thisv()));
|
|
auto lambda = [=](cocos2d::GLProgram* larg0, cocos2d::Uniform* larg1) -> void {
|
|
JSB_AUTOCOMPARTMENT_WITH_GLOBAL_OBJCET
|
|
jsval largv[2];
|
|
if (larg0) {
|
|
largv[0] = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::GLProgram>(cx, (cocos2d::GLProgram*)larg0));
|
|
} else {
|
|
largv[0] = JSVAL_NULL;
|
|
};
|
|
largv[1] = uniform_to_jsval(cx, larg1);
|
|
JS::RootedValue rval(cx);
|
|
bool succeed = func->invoke(2, &largv[0], &rval);
|
|
if (!succeed && JS_IsExceptionPending(cx)) {
|
|
JS_ReportPendingException(cx);
|
|
}
|
|
};
|
|
arg1 = lambda;
|
|
}
|
|
else
|
|
{
|
|
arg1 = nullptr;
|
|
}
|
|
} while(0)
|
|
;
|
|
if (!ok) { ok = true; break; }
|
|
cobj->setUniformCallback(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 2) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
std::function<void (cocos2d::GLProgram *, cocos2d::Uniform *)> arg1;
|
|
do {
|
|
if(JS_TypeOfValue(cx, args.get(1)) == JSTYPE_FUNCTION)
|
|
{
|
|
JS::RootedObject jstarget(cx, args.thisv().toObjectOrNull());
|
|
std::shared_ptr<JSFunctionWrapper> func(new JSFunctionWrapper(cx, jstarget, args.get(1), args.thisv()));
|
|
auto lambda = [=](cocos2d::GLProgram* larg0, cocos2d::Uniform* larg1) -> void {
|
|
JSB_AUTOCOMPARTMENT_WITH_GLOBAL_OBJCET
|
|
jsval largv[2];
|
|
if (larg0) {
|
|
largv[0] = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::GLProgram>(cx, (cocos2d::GLProgram*)larg0));
|
|
} else {
|
|
largv[0] = JSVAL_NULL;
|
|
};
|
|
largv[1] = uniform_to_jsval(cx, larg1);
|
|
JS::RootedValue rval(cx);
|
|
bool succeed = func->invoke(2, &largv[0], &rval);
|
|
if (!succeed && JS_IsExceptionPending(cx)) {
|
|
JS_ReportPendingException(cx);
|
|
}
|
|
};
|
|
arg1 = lambda;
|
|
}
|
|
else
|
|
{
|
|
arg1 = nullptr;
|
|
}
|
|
} while(0)
|
|
;
|
|
if (!ok) { ok = true; break; }
|
|
cobj->setUniformCallback(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLProgramState_setUniformCallback : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLProgramState_getVertexAttribsFlags(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GLProgramState* cobj = (cocos2d::GLProgramState *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgramState_getVertexAttribsFlags : Invalid Native Object");
|
|
if (argc == 0) {
|
|
unsigned int ret = cobj->getVertexAttribsFlags();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = uint32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLProgramState_getVertexAttribsFlags : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLProgramState_applyAutoBinding(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GLProgramState* cobj = (cocos2d::GLProgramState *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgramState_applyAutoBinding : Invalid Native Object");
|
|
if (argc == 2) {
|
|
std::string arg0;
|
|
std::string arg1;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_GLProgramState_applyAutoBinding : Error processing arguments");
|
|
cobj->applyAutoBinding(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLProgramState_applyAutoBinding : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLProgramState_setUniformVec2(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::GLProgramState* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::GLProgramState *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgramState_setUniformVec2 : Invalid Native Object");
|
|
do {
|
|
if (argc == 2) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Vec2 arg1;
|
|
ok &= jsval_to_vector2(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
cobj->setUniformVec2(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 2) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Vec2 arg1;
|
|
ok &= jsval_to_vector2(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
cobj->setUniformVec2(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLProgramState_setUniformVec2 : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLProgramState_setUniformVec3(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::GLProgramState* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::GLProgramState *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgramState_setUniformVec3 : Invalid Native Object");
|
|
do {
|
|
if (argc == 2) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Vec3 arg1;
|
|
ok &= jsval_to_vector3(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
cobj->setUniformVec3(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 2) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Vec3 arg1;
|
|
ok &= jsval_to_vector3(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
cobj->setUniformVec3(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLProgramState_setUniformVec3 : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLProgramState_setVertexAttribCallback(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GLProgramState* cobj = (cocos2d::GLProgramState *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgramState_setVertexAttribCallback : Invalid Native Object");
|
|
if (argc == 2) {
|
|
std::string arg0;
|
|
std::function<void (cocos2d::VertexAttrib *)> arg1;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
do {
|
|
if(JS_TypeOfValue(cx, args.get(1)) == JSTYPE_FUNCTION)
|
|
{
|
|
JS::RootedObject jstarget(cx, args.thisv().toObjectOrNull());
|
|
std::shared_ptr<JSFunctionWrapper> func(new JSFunctionWrapper(cx, jstarget, args.get(1), args.thisv()));
|
|
auto lambda = [=](cocos2d::VertexAttrib* larg0) -> void {
|
|
JSB_AUTOCOMPARTMENT_WITH_GLOBAL_OBJCET
|
|
jsval largv[1];
|
|
if (larg0) {
|
|
largv[0] = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::VertexAttrib>(cx, (cocos2d::VertexAttrib*)larg0));
|
|
} else {
|
|
largv[0] = JSVAL_NULL;
|
|
};
|
|
JS::RootedValue rval(cx);
|
|
bool succeed = func->invoke(1, &largv[0], &rval);
|
|
if (!succeed && JS_IsExceptionPending(cx)) {
|
|
JS_ReportPendingException(cx);
|
|
}
|
|
};
|
|
arg1 = lambda;
|
|
}
|
|
else
|
|
{
|
|
arg1 = nullptr;
|
|
}
|
|
} while(0)
|
|
;
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_GLProgramState_setVertexAttribCallback : Error processing arguments");
|
|
cobj->setVertexAttribCallback(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLProgramState_setVertexAttribCallback : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLProgramState_apply(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GLProgramState* cobj = (cocos2d::GLProgramState *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgramState_apply : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Mat4 arg0;
|
|
ok &= jsval_to_matrix(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_GLProgramState_apply : Error processing arguments");
|
|
cobj->apply(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLProgramState_apply : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLProgramState_getNodeBinding(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GLProgramState* cobj = (cocos2d::GLProgramState *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgramState_getNodeBinding : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::Node* ret = cobj->getNodeBinding();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Node>(cx, (cocos2d::Node*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLProgramState_getNodeBinding : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLProgramState_applyGLProgram(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GLProgramState* cobj = (cocos2d::GLProgramState *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgramState_applyGLProgram : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Mat4 arg0;
|
|
ok &= jsval_to_matrix(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_GLProgramState_applyGLProgram : Error processing arguments");
|
|
cobj->applyGLProgram(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLProgramState_applyGLProgram : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLProgramState_setNodeBinding(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GLProgramState* cobj = (cocos2d::GLProgramState *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgramState_setNodeBinding : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Node* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_GLProgramState_setNodeBinding : Error processing arguments");
|
|
cobj->setNodeBinding(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLProgramState_setNodeBinding : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLProgramState_setUniformInt(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::GLProgramState* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::GLProgramState *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgramState_setUniformInt : Invalid Native Object");
|
|
do {
|
|
if (argc == 2) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
if (!ok) { ok = true; break; }
|
|
int arg1 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1);
|
|
if (!ok) { ok = true; break; }
|
|
cobj->setUniformInt(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 2) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
int arg1 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1);
|
|
if (!ok) { ok = true; break; }
|
|
cobj->setUniformInt(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLProgramState_setUniformInt : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLProgramState_setParameterAutoBinding(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GLProgramState* cobj = (cocos2d::GLProgramState *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgramState_setParameterAutoBinding : Invalid Native Object");
|
|
if (argc == 2) {
|
|
std::string arg0;
|
|
std::string arg1;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_GLProgramState_setParameterAutoBinding : Error processing arguments");
|
|
cobj->setParameterAutoBinding(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLProgramState_setParameterAutoBinding : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLProgramState_setUniformVec2v(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::GLProgramState* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::GLProgramState *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgramState_setUniformVec2v : Invalid Native Object");
|
|
do {
|
|
if (argc == 3) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
if (!ok) { ok = true; break; }
|
|
ssize_t arg1 = 0;
|
|
ok &= jsval_to_ssize(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
const cocos2d::Vec2* arg2 = nullptr;
|
|
std::vector<cocos2d::Vec2> tempData;ok &= jsval_to_vector_vec2(cx, args.get(2), &tempData);arg2=tempData.data();
|
|
if (!ok) { ok = true; break; }
|
|
cobj->setUniformVec2v(arg0, arg1, arg2);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 3) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
ssize_t arg1 = 0;
|
|
ok &= jsval_to_ssize(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
const cocos2d::Vec2* arg2 = nullptr;
|
|
std::vector<cocos2d::Vec2> tempData;ok &= jsval_to_vector_vec2(cx, args.get(2), &tempData);arg2=tempData.data();
|
|
if (!ok) { ok = true; break; }
|
|
cobj->setUniformVec2v(arg0, arg1, arg2);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLProgramState_setUniformVec2v : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLProgramState_getUniformCount(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GLProgramState* cobj = (cocos2d::GLProgramState *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgramState_getUniformCount : Invalid Native Object");
|
|
if (argc == 0) {
|
|
ssize_t ret = cobj->getUniformCount();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ssize_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLProgramState_getUniformCount : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLProgramState_applyAttributes(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GLProgramState* cobj = (cocos2d::GLProgramState *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgramState_applyAttributes : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->applyAttributes();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
if (argc == 1) {
|
|
bool arg0;
|
|
arg0 = JS::ToBoolean(args.get(0));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_GLProgramState_applyAttributes : Error processing arguments");
|
|
cobj->applyAttributes(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLProgramState_applyAttributes : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLProgramState_clone(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GLProgramState* cobj = (cocos2d::GLProgramState *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgramState_clone : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::GLProgramState* ret = cobj->clone();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::GLProgramState>(cx, (cocos2d::GLProgramState*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLProgramState_clone : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLProgramState_setGLProgram(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GLProgramState* cobj = (cocos2d::GLProgramState *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgramState_setGLProgram : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::GLProgram* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::GLProgram*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_GLProgramState_setGLProgram : Error processing arguments");
|
|
cobj->setGLProgram(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLProgramState_setGLProgram : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLProgramState_setUniformFloatv(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::GLProgramState* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::GLProgramState *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgramState_setUniformFloatv : Invalid Native Object");
|
|
do {
|
|
if (argc == 3) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
if (!ok) { ok = true; break; }
|
|
ssize_t arg1 = 0;
|
|
ok &= jsval_to_ssize(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
const float* arg2 = 0;
|
|
#pragma warning NO CONVERSION TO NATIVE FOR float*
|
|
ok = false;
|
|
if (!ok) { ok = true; break; }
|
|
cobj->setUniformFloatv(arg0, arg1, arg2);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 3) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
ssize_t arg1 = 0;
|
|
ok &= jsval_to_ssize(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
const float* arg2 = 0;
|
|
#pragma warning NO CONVERSION TO NATIVE FOR float*
|
|
ok = false;
|
|
if (!ok) { ok = true; break; }
|
|
cobj->setUniformFloatv(arg0, arg1, arg2);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLProgramState_setUniformFloatv : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLProgramState_getGLProgram(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GLProgramState* cobj = (cocos2d::GLProgramState *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgramState_getGLProgram : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::GLProgram* ret = cobj->getGLProgram();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::GLProgram>(cx, (cocos2d::GLProgram*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLProgramState_getGLProgram : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLProgramState_setUniformTexture(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::GLProgramState* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::GLProgramState *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgramState_setUniformTexture : Invalid Native Object");
|
|
do {
|
|
if (argc == 2) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
unsigned int arg1 = 0;
|
|
ok &= jsval_to_uint32(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
cobj->setUniformTexture(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 2) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Texture2D* arg1 = nullptr;
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::Texture2D*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
if (!ok) { ok = true; break; }
|
|
cobj->setUniformTexture(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 2) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Texture2D* arg1 = nullptr;
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::Texture2D*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
if (!ok) { ok = true; break; }
|
|
cobj->setUniformTexture(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 2) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
if (!ok) { ok = true; break; }
|
|
unsigned int arg1 = 0;
|
|
ok &= jsval_to_uint32(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
cobj->setUniformTexture(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLProgramState_setUniformTexture : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLProgramState_applyUniforms(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GLProgramState* cobj = (cocos2d::GLProgramState *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgramState_applyUniforms : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->applyUniforms();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLProgramState_applyUniforms : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLProgramState_setUniformFloat(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::GLProgramState* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::GLProgramState *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgramState_setUniformFloat : Invalid Native Object");
|
|
do {
|
|
if (argc == 2) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
if (!ok) { ok = true; break; }
|
|
double arg1 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
if (!ok) { ok = true; break; }
|
|
cobj->setUniformFloat(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 2) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
double arg1 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
if (!ok) { ok = true; break; }
|
|
cobj->setUniformFloat(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLProgramState_setUniformFloat : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLProgramState_setUniformMat4(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::GLProgramState* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::GLProgramState *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgramState_setUniformMat4 : Invalid Native Object");
|
|
do {
|
|
if (argc == 2) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Mat4 arg1;
|
|
ok &= jsval_to_matrix(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
cobj->setUniformMat4(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 2) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Mat4 arg1;
|
|
ok &= jsval_to_matrix(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
cobj->setUniformMat4(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLProgramState_setUniformMat4 : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLProgramState_setUniformVec3v(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::GLProgramState* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::GLProgramState *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgramState_setUniformVec3v : Invalid Native Object");
|
|
do {
|
|
if (argc == 3) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
if (!ok) { ok = true; break; }
|
|
ssize_t arg1 = 0;
|
|
ok &= jsval_to_ssize(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
const cocos2d::Vec3* arg2 = nullptr;
|
|
do {
|
|
if (args.get(2).isNull()) { arg2 = nullptr; break; }
|
|
if (!args.get(2).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(2).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg2 = (const cocos2d::Vec3*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg2, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
if (!ok) { ok = true; break; }
|
|
cobj->setUniformVec3v(arg0, arg1, arg2);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 3) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
ssize_t arg1 = 0;
|
|
ok &= jsval_to_ssize(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
const cocos2d::Vec3* arg2 = nullptr;
|
|
do {
|
|
if (args.get(2).isNull()) { arg2 = nullptr; break; }
|
|
if (!args.get(2).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(2).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg2 = (const cocos2d::Vec3*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg2, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
if (!ok) { ok = true; break; }
|
|
cobj->setUniformVec3v(arg0, arg1, arg2);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLProgramState_setUniformVec3v : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLProgramState_getVertexAttribCount(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GLProgramState* cobj = (cocos2d::GLProgramState *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgramState_getVertexAttribCount : Invalid Native Object");
|
|
if (argc == 0) {
|
|
ssize_t ret = cobj->getVertexAttribCount();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ssize_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLProgramState_getVertexAttribCount : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLProgramState_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
cocos2d::GLProgram* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::GLProgram*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_GLProgramState_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::GLProgramState::create(arg0);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::GLProgramState>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::GLProgramState"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_GLProgramState_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_GLProgramState_getOrCreateWithGLProgramName(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
|
|
do {
|
|
if (argc == 2) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Texture2D* arg1 = nullptr;
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::Texture2D*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::GLProgramState* ret = cocos2d::GLProgramState::getOrCreateWithGLProgramName(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::GLProgramState>(cx, (cocos2d::GLProgramState*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
|
|
do {
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::GLProgramState* ret = cocos2d::GLProgramState::getOrCreateWithGLProgramName(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::GLProgramState>(cx, (cocos2d::GLProgramState*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
JS_ReportError(cx, "js_cocos2dx_GLProgramState_getOrCreateWithGLProgramName : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLProgramState_getOrCreateWithGLProgram(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
cocos2d::GLProgram* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::GLProgram*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_GLProgramState_getOrCreateWithGLProgram : Error processing arguments");
|
|
|
|
cocos2d::GLProgramState* ret = cocos2d::GLProgramState::getOrCreateWithGLProgram(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::GLProgramState>(cx, (cocos2d::GLProgramState*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_GLProgramState_getOrCreateWithGLProgram : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_GLProgramState_getOrCreateWithShaders(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 3) {
|
|
std::string arg0;
|
|
std::string arg1;
|
|
std::string arg2;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
|
ok &= jsval_to_std_string(cx, args.get(2), &arg2);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_GLProgramState_getOrCreateWithShaders : Error processing arguments");
|
|
|
|
cocos2d::GLProgramState* ret = cocos2d::GLProgramState::getOrCreateWithShaders(arg0, arg1, arg2);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::GLProgramState>(cx, (cocos2d::GLProgramState*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_GLProgramState_getOrCreateWithShaders : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
|
|
void js_register_cocos2dx_GLProgramState(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_GLProgramState_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_GLProgramState_class->name = "GLProgramState";
|
|
jsb_cocos2d_GLProgramState_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_GLProgramState_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_GLProgramState_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_GLProgramState_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_GLProgramState_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_GLProgramState_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_GLProgramState_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_GLProgramState_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("setUniformCallback", js_cocos2dx_GLProgramState_setUniformCallback, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getVertexAttribsFlags", js_cocos2dx_GLProgramState_getVertexAttribsFlags, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("applyAutoBinding", js_cocos2dx_GLProgramState_applyAutoBinding, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setUniformVec2", js_cocos2dx_GLProgramState_setUniformVec2, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setUniformVec3", js_cocos2dx_GLProgramState_setUniformVec3, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setVertexAttribCallback", js_cocos2dx_GLProgramState_setVertexAttribCallback, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("apply", js_cocos2dx_GLProgramState_apply, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getNodeBinding", js_cocos2dx_GLProgramState_getNodeBinding, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("applyGLProgram", js_cocos2dx_GLProgramState_applyGLProgram, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setNodeBinding", js_cocos2dx_GLProgramState_setNodeBinding, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setUniformInt", js_cocos2dx_GLProgramState_setUniformInt, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setParameterAutoBinding", js_cocos2dx_GLProgramState_setParameterAutoBinding, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setUniformVec2v", js_cocos2dx_GLProgramState_setUniformVec2v, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getUniformCount", js_cocos2dx_GLProgramState_getUniformCount, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("applyAttributes", js_cocos2dx_GLProgramState_applyAttributes, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("clone", js_cocos2dx_GLProgramState_clone, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setGLProgram", js_cocos2dx_GLProgramState_setGLProgram, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setUniformFloatv", js_cocos2dx_GLProgramState_setUniformFloatv, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getGLProgram", js_cocos2dx_GLProgramState_getGLProgram, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setUniformTexture", js_cocos2dx_GLProgramState_setUniformTexture, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("applyUniforms", js_cocos2dx_GLProgramState_applyUniforms, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setUniformFloat", js_cocos2dx_GLProgramState_setUniformFloat, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setUniformMat4", js_cocos2dx_GLProgramState_setUniformMat4, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setUniformVec3v", js_cocos2dx_GLProgramState_setUniformVec3v, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getVertexAttribCount", js_cocos2dx_GLProgramState_getVertexAttribCount, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_GLProgramState_create, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getOrCreateWithGLProgramName", js_cocos2dx_GLProgramState_getOrCreateWithGLProgramName, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getOrCreateWithGLProgram", js_cocos2dx_GLProgramState_getOrCreateWithGLProgram, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getOrCreateWithShaders", js_cocos2dx_GLProgramState_getOrCreateWithShaders, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
jsb_cocos2d_GLProgramState_prototype = JS_InitClass(
|
|
cx, global,
|
|
JS::NullPtr(),
|
|
jsb_cocos2d_GLProgramState_class,
|
|
dummy_constructor<cocos2d::GLProgramState>, 0, // no constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_GLProgramState_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "GLProgramState"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::GLProgramState>(cx, jsb_cocos2d_GLProgramState_class, proto, JS::NullPtr());
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_SpriteFrame_class;
|
|
JSObject *jsb_cocos2d_SpriteFrame_prototype;
|
|
|
|
bool js_cocos2dx_SpriteFrame_setAnchorPoint(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::SpriteFrame* cobj = (cocos2d::SpriteFrame *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteFrame_setAnchorPoint : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Vec2 arg0;
|
|
ok &= jsval_to_vector2(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SpriteFrame_setAnchorPoint : Error processing arguments");
|
|
cobj->setAnchorPoint(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SpriteFrame_setAnchorPoint : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SpriteFrame_setTexture(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::SpriteFrame* cobj = (cocos2d::SpriteFrame *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteFrame_setTexture : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Texture2D* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Texture2D*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SpriteFrame_setTexture : Error processing arguments");
|
|
cobj->setTexture(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SpriteFrame_setTexture : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SpriteFrame_getTexture(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::SpriteFrame* cobj = (cocos2d::SpriteFrame *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteFrame_getTexture : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::Texture2D* ret = cobj->getTexture();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Texture2D>(cx, (cocos2d::Texture2D*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SpriteFrame_getTexture : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SpriteFrame_setOffsetInPixels(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::SpriteFrame* cobj = (cocos2d::SpriteFrame *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteFrame_setOffsetInPixels : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Vec2 arg0;
|
|
ok &= jsval_to_vector2(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SpriteFrame_setOffsetInPixels : Error processing arguments");
|
|
cobj->setOffsetInPixels(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SpriteFrame_setOffsetInPixels : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SpriteFrame_getOriginalSizeInPixels(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::SpriteFrame* cobj = (cocos2d::SpriteFrame *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteFrame_getOriginalSizeInPixels : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const cocos2d::Size& ret = cobj->getOriginalSizeInPixels();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ccsize_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SpriteFrame_getOriginalSizeInPixels : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SpriteFrame_setOriginalSize(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::SpriteFrame* cobj = (cocos2d::SpriteFrame *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteFrame_setOriginalSize : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Size arg0;
|
|
ok &= jsval_to_ccsize(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SpriteFrame_setOriginalSize : Error processing arguments");
|
|
cobj->setOriginalSize(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SpriteFrame_setOriginalSize : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SpriteFrame_getCenterRect(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::SpriteFrame* cobj = (cocos2d::SpriteFrame *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteFrame_getCenterRect : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const cocos2d::Rect& ret = cobj->getCenterRect();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ccrect_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SpriteFrame_getCenterRect : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SpriteFrame_setRectInPixels(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::SpriteFrame* cobj = (cocos2d::SpriteFrame *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteFrame_setRectInPixels : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Rect arg0;
|
|
ok &= jsval_to_ccrect(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SpriteFrame_setRectInPixels : Error processing arguments");
|
|
cobj->setRectInPixels(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SpriteFrame_setRectInPixels : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SpriteFrame_getRect(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::SpriteFrame* cobj = (cocos2d::SpriteFrame *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteFrame_getRect : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const cocos2d::Rect& ret = cobj->getRect();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ccrect_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SpriteFrame_getRect : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SpriteFrame_setCenterRectInPixels(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::SpriteFrame* cobj = (cocos2d::SpriteFrame *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteFrame_setCenterRectInPixels : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Rect arg0;
|
|
ok &= jsval_to_ccrect(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SpriteFrame_setCenterRectInPixels : Error processing arguments");
|
|
cobj->setCenterRectInPixels(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SpriteFrame_setCenterRectInPixels : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SpriteFrame_setOffset(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::SpriteFrame* cobj = (cocos2d::SpriteFrame *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteFrame_setOffset : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Vec2 arg0;
|
|
ok &= jsval_to_vector2(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SpriteFrame_setOffset : Error processing arguments");
|
|
cobj->setOffset(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SpriteFrame_setOffset : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SpriteFrame_initWithTextureFilename(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::SpriteFrame* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::SpriteFrame *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteFrame_initWithTextureFilename : Invalid Native Object");
|
|
do {
|
|
if (argc == 5) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Rect arg1;
|
|
ok &= jsval_to_ccrect(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
bool arg2;
|
|
arg2 = JS::ToBoolean(args.get(2));
|
|
cocos2d::Vec2 arg3;
|
|
ok &= jsval_to_vector2(cx, args.get(3), &arg3);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Size arg4;
|
|
ok &= jsval_to_ccsize(cx, args.get(4), &arg4);
|
|
if (!ok) { ok = true; break; }
|
|
bool ret = cobj->initWithTextureFilename(arg0, arg1, arg2, arg3, arg4);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 2) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Rect arg1;
|
|
ok &= jsval_to_ccrect(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
bool ret = cobj->initWithTextureFilename(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SpriteFrame_initWithTextureFilename : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SpriteFrame_setRect(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::SpriteFrame* cobj = (cocos2d::SpriteFrame *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteFrame_setRect : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Rect arg0;
|
|
ok &= jsval_to_ccrect(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SpriteFrame_setRect : Error processing arguments");
|
|
cobj->setRect(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SpriteFrame_setRect : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SpriteFrame_initWithTexture(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::SpriteFrame* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::SpriteFrame *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteFrame_initWithTexture : Invalid Native Object");
|
|
do {
|
|
if (argc == 5) {
|
|
cocos2d::Texture2D* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Texture2D*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Rect arg1;
|
|
ok &= jsval_to_ccrect(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
bool arg2;
|
|
arg2 = JS::ToBoolean(args.get(2));
|
|
cocos2d::Vec2 arg3;
|
|
ok &= jsval_to_vector2(cx, args.get(3), &arg3);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Size arg4;
|
|
ok &= jsval_to_ccsize(cx, args.get(4), &arg4);
|
|
if (!ok) { ok = true; break; }
|
|
bool ret = cobj->initWithTexture(arg0, arg1, arg2, arg3, arg4);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 2) {
|
|
cocos2d::Texture2D* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Texture2D*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Rect arg1;
|
|
ok &= jsval_to_ccrect(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
bool ret = cobj->initWithTexture(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SpriteFrame_initWithTexture : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SpriteFrame_getOriginalSize(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::SpriteFrame* cobj = (cocos2d::SpriteFrame *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteFrame_getOriginalSize : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const cocos2d::Size& ret = cobj->getOriginalSize();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ccsize_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SpriteFrame_getOriginalSize : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SpriteFrame_clone(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::SpriteFrame* cobj = (cocos2d::SpriteFrame *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteFrame_clone : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::SpriteFrame* ret = cobj->clone();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::SpriteFrame>(cx, (cocos2d::SpriteFrame*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SpriteFrame_clone : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SpriteFrame_getRectInPixels(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::SpriteFrame* cobj = (cocos2d::SpriteFrame *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteFrame_getRectInPixels : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const cocos2d::Rect& ret = cobj->getRectInPixels();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ccrect_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SpriteFrame_getRectInPixels : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SpriteFrame_isRotated(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::SpriteFrame* cobj = (cocos2d::SpriteFrame *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteFrame_isRotated : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->isRotated();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SpriteFrame_isRotated : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SpriteFrame_hasCenterRect(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::SpriteFrame* cobj = (cocos2d::SpriteFrame *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteFrame_hasCenterRect : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->hasCenterRect();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SpriteFrame_hasCenterRect : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SpriteFrame_setRotated(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::SpriteFrame* cobj = (cocos2d::SpriteFrame *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteFrame_setRotated : Invalid Native Object");
|
|
if (argc == 1) {
|
|
bool arg0;
|
|
arg0 = JS::ToBoolean(args.get(0));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SpriteFrame_setRotated : Error processing arguments");
|
|
cobj->setRotated(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SpriteFrame_setRotated : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SpriteFrame_getOffset(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::SpriteFrame* cobj = (cocos2d::SpriteFrame *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteFrame_getOffset : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const cocos2d::Vec2& ret = cobj->getOffset();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = vector2_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SpriteFrame_getOffset : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SpriteFrame_setOriginalSizeInPixels(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::SpriteFrame* cobj = (cocos2d::SpriteFrame *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteFrame_setOriginalSizeInPixels : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Size arg0;
|
|
ok &= jsval_to_ccsize(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SpriteFrame_setOriginalSizeInPixels : Error processing arguments");
|
|
cobj->setOriginalSizeInPixels(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SpriteFrame_setOriginalSizeInPixels : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SpriteFrame_getAnchorPoint(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::SpriteFrame* cobj = (cocos2d::SpriteFrame *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteFrame_getAnchorPoint : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const cocos2d::Vec2& ret = cobj->getAnchorPoint();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = vector2_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SpriteFrame_getAnchorPoint : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SpriteFrame_hasAnchorPoint(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::SpriteFrame* cobj = (cocos2d::SpriteFrame *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteFrame_hasAnchorPoint : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->hasAnchorPoint();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SpriteFrame_hasAnchorPoint : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SpriteFrame_getOffsetInPixels(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::SpriteFrame* cobj = (cocos2d::SpriteFrame *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteFrame_getOffsetInPixels : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const cocos2d::Vec2& ret = cobj->getOffsetInPixels();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = vector2_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SpriteFrame_getOffsetInPixels : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SpriteFrame_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
|
|
do {
|
|
if (argc == 5) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Rect arg1;
|
|
ok &= jsval_to_ccrect(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
bool arg2;
|
|
arg2 = JS::ToBoolean(args.get(2));
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Vec2 arg3;
|
|
ok &= jsval_to_vector2(cx, args.get(3), &arg3);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Size arg4;
|
|
ok &= jsval_to_ccsize(cx, args.get(4), &arg4);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::SpriteFrame* ret = cocos2d::SpriteFrame::create(arg0, arg1, arg2, arg3, arg4);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::SpriteFrame>(cx, (cocos2d::SpriteFrame*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
|
|
do {
|
|
if (argc == 2) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Rect arg1;
|
|
ok &= jsval_to_ccrect(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::SpriteFrame* ret = cocos2d::SpriteFrame::create(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::SpriteFrame>(cx, (cocos2d::SpriteFrame*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
JS_ReportError(cx, "js_cocos2dx_SpriteFrame_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SpriteFrame_createWithTexture(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
|
|
do {
|
|
if (argc == 5) {
|
|
cocos2d::Texture2D* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Texture2D*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Rect arg1;
|
|
ok &= jsval_to_ccrect(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
bool arg2;
|
|
arg2 = JS::ToBoolean(args.get(2));
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Vec2 arg3;
|
|
ok &= jsval_to_vector2(cx, args.get(3), &arg3);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Size arg4;
|
|
ok &= jsval_to_ccsize(cx, args.get(4), &arg4);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::SpriteFrame* ret = cocos2d::SpriteFrame::createWithTexture(arg0, arg1, arg2, arg3, arg4);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::SpriteFrame>(cx, (cocos2d::SpriteFrame*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
|
|
do {
|
|
if (argc == 2) {
|
|
cocos2d::Texture2D* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Texture2D*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Rect arg1;
|
|
ok &= jsval_to_ccrect(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::SpriteFrame* ret = cocos2d::SpriteFrame::createWithTexture(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::SpriteFrame>(cx, (cocos2d::SpriteFrame*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
JS_ReportError(cx, "js_cocos2dx_SpriteFrame_createWithTexture : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SpriteFrame_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::SpriteFrame* cobj = new (std::nothrow) cocos2d::SpriteFrame();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::SpriteFrame>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::SpriteFrame"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_SpriteFrame_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::SpriteFrame *nobj = new (std::nothrow) cocos2d::SpriteFrame();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::SpriteFrame");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
|
|
void js_register_cocos2dx_SpriteFrame(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_SpriteFrame_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_SpriteFrame_class->name = "SpriteFrame";
|
|
jsb_cocos2d_SpriteFrame_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_SpriteFrame_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_SpriteFrame_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_SpriteFrame_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_SpriteFrame_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_SpriteFrame_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_SpriteFrame_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_SpriteFrame_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("setAnchorPoint", js_cocos2dx_SpriteFrame_setAnchorPoint, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setTexture", js_cocos2dx_SpriteFrame_setTexture, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getTexture", js_cocos2dx_SpriteFrame_getTexture, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setOffsetInPixels", js_cocos2dx_SpriteFrame_setOffsetInPixels, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getOriginalSizeInPixels", js_cocos2dx_SpriteFrame_getOriginalSizeInPixels, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setOriginalSize", js_cocos2dx_SpriteFrame_setOriginalSize, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getCenterRect", js_cocos2dx_SpriteFrame_getCenterRect, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setRectInPixels", js_cocos2dx_SpriteFrame_setRectInPixels, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getRect", js_cocos2dx_SpriteFrame_getRect, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setCenterRectInPixels", js_cocos2dx_SpriteFrame_setCenterRectInPixels, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setOffset", js_cocos2dx_SpriteFrame_setOffset, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initWithTextureFilename", js_cocos2dx_SpriteFrame_initWithTextureFilename, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setRect", js_cocos2dx_SpriteFrame_setRect, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initWithTexture", js_cocos2dx_SpriteFrame_initWithTexture, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getOriginalSize", js_cocos2dx_SpriteFrame_getOriginalSize, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("clone", js_cocos2dx_SpriteFrame_clone, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getRectInPixels", js_cocos2dx_SpriteFrame_getRectInPixels, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("isRotated", js_cocos2dx_SpriteFrame_isRotated, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("hasCenterRect", js_cocos2dx_SpriteFrame_hasCenterRect, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setRotated", js_cocos2dx_SpriteFrame_setRotated, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getOffset", js_cocos2dx_SpriteFrame_getOffset, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setOriginalSizeInPixels", js_cocos2dx_SpriteFrame_setOriginalSizeInPixels, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getAnchorPoint", js_cocos2dx_SpriteFrame_getAnchorPoint, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("hasAnchorPoint", js_cocos2dx_SpriteFrame_hasAnchorPoint, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getOffsetInPixels", js_cocos2dx_SpriteFrame_getOffsetInPixels, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_SpriteFrame_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_SpriteFrame_create, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("createWithTexture", js_cocos2dx_SpriteFrame_createWithTexture, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
jsb_cocos2d_SpriteFrame_prototype = JS_InitClass(
|
|
cx, global,
|
|
JS::NullPtr(),
|
|
jsb_cocos2d_SpriteFrame_class,
|
|
js_cocos2dx_SpriteFrame_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_SpriteFrame_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "SpriteFrame"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::SpriteFrame>(cx, jsb_cocos2d_SpriteFrame_class, proto, JS::NullPtr());
|
|
anonEvaluate(cx, global, "(function () { cc.SpriteFrame.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_AnimationFrame_class;
|
|
JSObject *jsb_cocos2d_AnimationFrame_prototype;
|
|
|
|
bool js_cocos2dx_AnimationFrame_setSpriteFrame(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::AnimationFrame* cobj = (cocos2d::AnimationFrame *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_AnimationFrame_setSpriteFrame : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::SpriteFrame* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::SpriteFrame*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_AnimationFrame_setSpriteFrame : Error processing arguments");
|
|
cobj->setSpriteFrame(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_AnimationFrame_setSpriteFrame : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_AnimationFrame_getUserInfo(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::AnimationFrame* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::AnimationFrame *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_AnimationFrame_getUserInfo : Invalid Native Object");
|
|
do {
|
|
if (argc == 0) {
|
|
cocos2d::ValueMap& ret = cobj->getUserInfo();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ccvaluemap_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 0) {
|
|
const cocos2d::ValueMap& ret = cobj->getUserInfo();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ccvaluemap_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_AnimationFrame_getUserInfo : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_AnimationFrame_setDelayUnits(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::AnimationFrame* cobj = (cocos2d::AnimationFrame *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_AnimationFrame_setDelayUnits : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_AnimationFrame_setDelayUnits : Error processing arguments");
|
|
cobj->setDelayUnits(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_AnimationFrame_setDelayUnits : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_AnimationFrame_clone(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::AnimationFrame* cobj = (cocos2d::AnimationFrame *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_AnimationFrame_clone : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::AnimationFrame* ret = cobj->clone();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::AnimationFrame>(cx, (cocos2d::AnimationFrame*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_AnimationFrame_clone : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_AnimationFrame_getSpriteFrame(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::AnimationFrame* cobj = (cocos2d::AnimationFrame *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_AnimationFrame_getSpriteFrame : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::SpriteFrame* ret = cobj->getSpriteFrame();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::SpriteFrame>(cx, (cocos2d::SpriteFrame*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_AnimationFrame_getSpriteFrame : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_AnimationFrame_getDelayUnits(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::AnimationFrame* cobj = (cocos2d::AnimationFrame *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_AnimationFrame_getDelayUnits : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getDelayUnits();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_AnimationFrame_getDelayUnits : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_AnimationFrame_setUserInfo(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::AnimationFrame* cobj = (cocos2d::AnimationFrame *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_AnimationFrame_setUserInfo : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::ValueMap arg0;
|
|
ok &= jsval_to_ccvaluemap(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_AnimationFrame_setUserInfo : Error processing arguments");
|
|
cobj->setUserInfo(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_AnimationFrame_setUserInfo : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_AnimationFrame_initWithSpriteFrame(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::AnimationFrame* cobj = (cocos2d::AnimationFrame *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_AnimationFrame_initWithSpriteFrame : Invalid Native Object");
|
|
if (argc == 3) {
|
|
cocos2d::SpriteFrame* arg0 = nullptr;
|
|
double arg1 = 0;
|
|
cocos2d::ValueMap arg2;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::SpriteFrame*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
ok &= jsval_to_ccvaluemap(cx, args.get(2), &arg2);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_AnimationFrame_initWithSpriteFrame : Error processing arguments");
|
|
bool ret = cobj->initWithSpriteFrame(arg0, arg1, arg2);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_AnimationFrame_initWithSpriteFrame : wrong number of arguments: %d, was expecting %d", argc, 3);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_AnimationFrame_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 3) {
|
|
cocos2d::SpriteFrame* arg0 = nullptr;
|
|
double arg1 = 0;
|
|
cocos2d::ValueMap arg2;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::SpriteFrame*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
ok &= jsval_to_ccvaluemap(cx, args.get(2), &arg2);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_AnimationFrame_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::AnimationFrame::create(arg0, arg1, arg2);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::AnimationFrame>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::AnimationFrame"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_AnimationFrame_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_AnimationFrame_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::AnimationFrame* cobj = new (std::nothrow) cocos2d::AnimationFrame();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::AnimationFrame>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::AnimationFrame"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_AnimationFrame_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::AnimationFrame *nobj = new (std::nothrow) cocos2d::AnimationFrame();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::AnimationFrame");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
|
|
void js_register_cocos2dx_AnimationFrame(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_AnimationFrame_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_AnimationFrame_class->name = "AnimationFrame";
|
|
jsb_cocos2d_AnimationFrame_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_AnimationFrame_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_AnimationFrame_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_AnimationFrame_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_AnimationFrame_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_AnimationFrame_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_AnimationFrame_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_AnimationFrame_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("setSpriteFrame", js_cocos2dx_AnimationFrame_setSpriteFrame, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getUserInfo", js_cocos2dx_AnimationFrame_getUserInfo, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setDelayUnits", js_cocos2dx_AnimationFrame_setDelayUnits, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("clone", js_cocos2dx_AnimationFrame_clone, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getSpriteFrame", js_cocos2dx_AnimationFrame_getSpriteFrame, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getDelayUnits", js_cocos2dx_AnimationFrame_getDelayUnits, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setUserInfo", js_cocos2dx_AnimationFrame_setUserInfo, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initWithSpriteFrame", js_cocos2dx_AnimationFrame_initWithSpriteFrame, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_AnimationFrame_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_AnimationFrame_create, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
jsb_cocos2d_AnimationFrame_prototype = JS_InitClass(
|
|
cx, global,
|
|
JS::NullPtr(),
|
|
jsb_cocos2d_AnimationFrame_class,
|
|
js_cocos2dx_AnimationFrame_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_AnimationFrame_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "AnimationFrame"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::AnimationFrame>(cx, jsb_cocos2d_AnimationFrame_class, proto, JS::NullPtr());
|
|
anonEvaluate(cx, global, "(function () { cc.AnimationFrame.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_Animation_class;
|
|
JSObject *jsb_cocos2d_Animation_prototype;
|
|
|
|
bool js_cocos2dx_Animation_getLoops(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Animation* cobj = (cocos2d::Animation *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Animation_getLoops : Invalid Native Object");
|
|
if (argc == 0) {
|
|
unsigned int ret = cobj->getLoops();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = uint32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Animation_getLoops : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Animation_addSpriteFrame(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Animation* cobj = (cocos2d::Animation *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Animation_addSpriteFrame : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::SpriteFrame* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::SpriteFrame*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Animation_addSpriteFrame : Error processing arguments");
|
|
cobj->addSpriteFrame(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Animation_addSpriteFrame : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Animation_setRestoreOriginalFrame(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Animation* cobj = (cocos2d::Animation *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Animation_setRestoreOriginalFrame : Invalid Native Object");
|
|
if (argc == 1) {
|
|
bool arg0;
|
|
arg0 = JS::ToBoolean(args.get(0));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Animation_setRestoreOriginalFrame : Error processing arguments");
|
|
cobj->setRestoreOriginalFrame(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Animation_setRestoreOriginalFrame : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Animation_clone(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Animation* cobj = (cocos2d::Animation *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Animation_clone : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::Animation* ret = cobj->clone();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Animation>(cx, (cocos2d::Animation*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Animation_clone : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Animation_getDuration(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Animation* cobj = (cocos2d::Animation *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Animation_getDuration : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getDuration();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Animation_getDuration : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Animation_initWithAnimationFrames(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Animation* cobj = (cocos2d::Animation *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Animation_initWithAnimationFrames : Invalid Native Object");
|
|
if (argc == 3) {
|
|
cocos2d::Vector<cocos2d::AnimationFrame *> arg0;
|
|
double arg1 = 0;
|
|
unsigned int arg2 = 0;
|
|
ok &= jsval_to_ccvector(cx, args.get(0), &arg0);
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
ok &= jsval_to_uint32(cx, args.get(2), &arg2);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Animation_initWithAnimationFrames : Error processing arguments");
|
|
bool ret = cobj->initWithAnimationFrames(arg0, arg1, arg2);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Animation_initWithAnimationFrames : wrong number of arguments: %d, was expecting %d", argc, 3);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Animation_init(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Animation* cobj = (cocos2d::Animation *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Animation_init : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->init();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Animation_init : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Animation_setFrames(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Animation* cobj = (cocos2d::Animation *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Animation_setFrames : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Vector<cocos2d::AnimationFrame *> arg0;
|
|
ok &= jsval_to_ccvector(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Animation_setFrames : Error processing arguments");
|
|
cobj->setFrames(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Animation_setFrames : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Animation_getFrames(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Animation* cobj = (cocos2d::Animation *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Animation_getFrames : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const cocos2d::Vector<cocos2d::AnimationFrame *>& ret = cobj->getFrames();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ccvector_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Animation_getFrames : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Animation_setLoops(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Animation* cobj = (cocos2d::Animation *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Animation_setLoops : Invalid Native Object");
|
|
if (argc == 1) {
|
|
unsigned int arg0 = 0;
|
|
ok &= jsval_to_uint32(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Animation_setLoops : Error processing arguments");
|
|
cobj->setLoops(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Animation_setLoops : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Animation_setDelayPerUnit(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Animation* cobj = (cocos2d::Animation *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Animation_setDelayPerUnit : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Animation_setDelayPerUnit : Error processing arguments");
|
|
cobj->setDelayPerUnit(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Animation_setDelayPerUnit : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Animation_addSpriteFrameWithFile(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Animation* cobj = (cocos2d::Animation *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Animation_addSpriteFrameWithFile : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Animation_addSpriteFrameWithFile : Error processing arguments");
|
|
cobj->addSpriteFrameWithFile(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Animation_addSpriteFrameWithFile : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Animation_getTotalDelayUnits(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Animation* cobj = (cocos2d::Animation *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Animation_getTotalDelayUnits : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getTotalDelayUnits();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Animation_getTotalDelayUnits : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Animation_getDelayPerUnit(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Animation* cobj = (cocos2d::Animation *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Animation_getDelayPerUnit : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getDelayPerUnit();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Animation_getDelayPerUnit : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Animation_initWithSpriteFrames(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Animation* cobj = (cocos2d::Animation *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Animation_initWithSpriteFrames : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Vector<cocos2d::SpriteFrame *> arg0;
|
|
ok &= jsval_to_ccvector(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Animation_initWithSpriteFrames : Error processing arguments");
|
|
bool ret = cobj->initWithSpriteFrames(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
if (argc == 2) {
|
|
cocos2d::Vector<cocos2d::SpriteFrame *> arg0;
|
|
double arg1 = 0;
|
|
ok &= jsval_to_ccvector(cx, args.get(0), &arg0);
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Animation_initWithSpriteFrames : Error processing arguments");
|
|
bool ret = cobj->initWithSpriteFrames(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
if (argc == 3) {
|
|
cocos2d::Vector<cocos2d::SpriteFrame *> arg0;
|
|
double arg1 = 0;
|
|
unsigned int arg2 = 0;
|
|
ok &= jsval_to_ccvector(cx, args.get(0), &arg0);
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
ok &= jsval_to_uint32(cx, args.get(2), &arg2);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Animation_initWithSpriteFrames : Error processing arguments");
|
|
bool ret = cobj->initWithSpriteFrames(arg0, arg1, arg2);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Animation_initWithSpriteFrames : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Animation_getRestoreOriginalFrame(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Animation* cobj = (cocos2d::Animation *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Animation_getRestoreOriginalFrame : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->getRestoreOriginalFrame();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Animation_getRestoreOriginalFrame : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Animation_addSpriteFrameWithTexture(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Animation* cobj = (cocos2d::Animation *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Animation_addSpriteFrameWithTexture : Invalid Native Object");
|
|
if (argc == 2) {
|
|
cocos2d::Texture2D* arg0 = nullptr;
|
|
cocos2d::Rect arg1;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Texture2D*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
ok &= jsval_to_ccrect(cx, args.get(1), &arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Animation_addSpriteFrameWithTexture : Error processing arguments");
|
|
cobj->addSpriteFrameWithTexture(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Animation_addSpriteFrameWithTexture : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Animation_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
|
|
do {
|
|
if (argc == 2) {
|
|
cocos2d::Vector<cocos2d::AnimationFrame *> arg0;
|
|
ok &= jsval_to_ccvector(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
double arg1 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Animation* ret = cocos2d::Animation::create(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Animation>(cx, (cocos2d::Animation*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
do {
|
|
if (argc == 3) {
|
|
cocos2d::Vector<cocos2d::AnimationFrame *> arg0;
|
|
ok &= jsval_to_ccvector(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
double arg1 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
if (!ok) { ok = true; break; }
|
|
unsigned int arg2 = 0;
|
|
ok &= jsval_to_uint32(cx, args.get(2), &arg2);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Animation* ret = cocos2d::Animation::create(arg0, arg1, arg2);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Animation>(cx, (cocos2d::Animation*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
|
|
do {
|
|
if (argc == 0) {
|
|
cocos2d::Animation* ret = cocos2d::Animation::create();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Animation>(cx, (cocos2d::Animation*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
JS_ReportError(cx, "js_cocos2dx_Animation_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Animation_createWithSpriteFrames(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
cocos2d::Vector<cocos2d::SpriteFrame *> arg0;
|
|
ok &= jsval_to_ccvector(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Animation_createWithSpriteFrames : Error processing arguments");
|
|
|
|
auto ret = cocos2d::Animation::createWithSpriteFrames(arg0);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::Animation>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::Animation"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
if (argc == 2) {
|
|
cocos2d::Vector<cocos2d::SpriteFrame *> arg0;
|
|
double arg1 = 0;
|
|
ok &= jsval_to_ccvector(cx, args.get(0), &arg0);
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Animation_createWithSpriteFrames : Error processing arguments");
|
|
|
|
auto ret = cocos2d::Animation::createWithSpriteFrames(arg0, arg1);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::Animation>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::Animation"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
if (argc == 3) {
|
|
cocos2d::Vector<cocos2d::SpriteFrame *> arg0;
|
|
double arg1 = 0;
|
|
unsigned int arg2 = 0;
|
|
ok &= jsval_to_ccvector(cx, args.get(0), &arg0);
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
ok &= jsval_to_uint32(cx, args.get(2), &arg2);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Animation_createWithSpriteFrames : Error processing arguments");
|
|
|
|
auto ret = cocos2d::Animation::createWithSpriteFrames(arg0, arg1, arg2);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::Animation>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::Animation"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_Animation_createWithSpriteFrames : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_Animation_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::Animation* cobj = new (std::nothrow) cocos2d::Animation();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::Animation>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::Animation"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_Animation_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::Animation *nobj = new (std::nothrow) cocos2d::Animation();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::Animation");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
|
|
void js_register_cocos2dx_Animation(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_Animation_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_Animation_class->name = "Animation";
|
|
jsb_cocos2d_Animation_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Animation_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_Animation_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Animation_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_Animation_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_Animation_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_Animation_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_Animation_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("getLoops", js_cocos2dx_Animation_getLoops, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("addSpriteFrame", js_cocos2dx_Animation_addSpriteFrame, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setRestoreOriginalFrame", js_cocos2dx_Animation_setRestoreOriginalFrame, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("clone", js_cocos2dx_Animation_clone, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getDuration", js_cocos2dx_Animation_getDuration, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initWithAnimationFrames", js_cocos2dx_Animation_initWithAnimationFrames, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("init", js_cocos2dx_Animation_init, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setFrames", js_cocos2dx_Animation_setFrames, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getFrames", js_cocos2dx_Animation_getFrames, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setLoops", js_cocos2dx_Animation_setLoops, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setDelayPerUnit", js_cocos2dx_Animation_setDelayPerUnit, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("addSpriteFrameWithFile", js_cocos2dx_Animation_addSpriteFrameWithFile, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getTotalDelayUnits", js_cocos2dx_Animation_getTotalDelayUnits, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getDelayPerUnit", js_cocos2dx_Animation_getDelayPerUnit, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initWithSpriteFrames", js_cocos2dx_Animation_initWithSpriteFrames, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getRestoreOriginalFrame", js_cocos2dx_Animation_getRestoreOriginalFrame, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("addSpriteFrameWithTexture", js_cocos2dx_Animation_addSpriteFrameWithTexture, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_Animation_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("createWithAnimationFrames", js_cocos2dx_Animation_create, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("createWithSpriteFrames", js_cocos2dx_Animation_createWithSpriteFrames, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
jsb_cocos2d_Animation_prototype = JS_InitClass(
|
|
cx, global,
|
|
JS::NullPtr(),
|
|
jsb_cocos2d_Animation_class,
|
|
js_cocos2dx_Animation_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_Animation_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "Animation"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::Animation>(cx, jsb_cocos2d_Animation_class, proto, JS::NullPtr());
|
|
anonEvaluate(cx, global, "(function () { cc.Animation.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_ActionInterval_class;
|
|
JSObject *jsb_cocos2d_ActionInterval_prototype;
|
|
|
|
bool js_cocos2dx_ActionInterval_getAmplitudeRate(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ActionInterval* cobj = (cocos2d::ActionInterval *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ActionInterval_getAmplitudeRate : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getAmplitudeRate();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ActionInterval_getAmplitudeRate : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ActionInterval_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ActionInterval* cobj = (cocos2d::ActionInterval *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ActionInterval_initWithDuration : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ActionInterval_initWithDuration : Error processing arguments");
|
|
bool ret = cobj->initWithDuration(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ActionInterval_initWithDuration : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ActionInterval_setAmplitudeRate(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ActionInterval* cobj = (cocos2d::ActionInterval *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ActionInterval_setAmplitudeRate : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ActionInterval_setAmplitudeRate : Error processing arguments");
|
|
cobj->setAmplitudeRate(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ActionInterval_setAmplitudeRate : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ActionInterval_getElapsed(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ActionInterval* cobj = (cocos2d::ActionInterval *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ActionInterval_getElapsed : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getElapsed();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ActionInterval_getElapsed : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
|
|
extern JSObject *jsb_cocos2d_FiniteTimeAction_prototype;
|
|
|
|
void js_register_cocos2dx_ActionInterval(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_ActionInterval_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_ActionInterval_class->name = "ActionInterval";
|
|
jsb_cocos2d_ActionInterval_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_ActionInterval_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_ActionInterval_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_ActionInterval_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_ActionInterval_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_ActionInterval_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_ActionInterval_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_ActionInterval_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("getAmplitudeRate", js_cocos2dx_ActionInterval_getAmplitudeRate, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initWithDuration", js_cocos2dx_ActionInterval_initWithDuration, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setAmplitudeRate", js_cocos2dx_ActionInterval_setAmplitudeRate, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getElapsed", js_cocos2dx_ActionInterval_getElapsed, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JSFunctionSpec *st_funcs = NULL;
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_FiniteTimeAction_prototype);
|
|
jsb_cocos2d_ActionInterval_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_ActionInterval_class,
|
|
empty_constructor, 0,
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_ActionInterval_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "ActionInterval"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::ActionInterval>(cx, jsb_cocos2d_ActionInterval_class, proto, parent_proto);
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_Sequence_class;
|
|
JSObject *jsb_cocos2d_Sequence_prototype;
|
|
|
|
bool js_cocos2dx_Sequence_init(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Sequence* cobj = (cocos2d::Sequence *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Sequence_init : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Vector<cocos2d::FiniteTimeAction *> arg0;
|
|
ok &= jsval_to_ccvector(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Sequence_init : Error processing arguments");
|
|
bool ret = cobj->init(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Sequence_init : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Sequence_initWithTwoActions(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Sequence* cobj = (cocos2d::Sequence *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Sequence_initWithTwoActions : Invalid Native Object");
|
|
if (argc == 2) {
|
|
cocos2d::FiniteTimeAction* arg0 = nullptr;
|
|
cocos2d::FiniteTimeAction* arg1 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::FiniteTimeAction*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::FiniteTimeAction*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Sequence_initWithTwoActions : Error processing arguments");
|
|
bool ret = cobj->initWithTwoActions(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Sequence_initWithTwoActions : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Sequence_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::Sequence* cobj = new (std::nothrow) cocos2d::Sequence();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::Sequence>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::Sequence"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_Sequence_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::Sequence *nobj = new (std::nothrow) cocos2d::Sequence();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::Sequence");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_ActionInterval_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_Sequence(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_Sequence_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_Sequence_class->name = "Sequence";
|
|
jsb_cocos2d_Sequence_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Sequence_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_Sequence_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Sequence_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_Sequence_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_Sequence_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_Sequence_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_Sequence_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("init", js_cocos2dx_Sequence_init, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initWithTwoActions", js_cocos2dx_Sequence_initWithTwoActions, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_Sequence_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JSFunctionSpec *st_funcs = NULL;
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_ActionInterval_prototype);
|
|
jsb_cocos2d_Sequence_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_Sequence_class,
|
|
js_cocos2dx_Sequence_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_Sequence_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "Sequence"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::Sequence>(cx, jsb_cocos2d_Sequence_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.Sequence.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_Repeat_class;
|
|
JSObject *jsb_cocos2d_Repeat_prototype;
|
|
|
|
bool js_cocos2dx_Repeat_setInnerAction(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Repeat* cobj = (cocos2d::Repeat *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Repeat_setInnerAction : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::FiniteTimeAction* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::FiniteTimeAction*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Repeat_setInnerAction : Error processing arguments");
|
|
cobj->setInnerAction(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Repeat_setInnerAction : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Repeat_initWithAction(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Repeat* cobj = (cocos2d::Repeat *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Repeat_initWithAction : Invalid Native Object");
|
|
if (argc == 2) {
|
|
cocos2d::FiniteTimeAction* arg0 = nullptr;
|
|
unsigned int arg1 = 0;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::FiniteTimeAction*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
ok &= jsval_to_uint32(cx, args.get(1), &arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Repeat_initWithAction : Error processing arguments");
|
|
bool ret = cobj->initWithAction(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Repeat_initWithAction : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Repeat_getInnerAction(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Repeat* cobj = (cocos2d::Repeat *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Repeat_getInnerAction : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::FiniteTimeAction* ret = cobj->getInnerAction();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::FiniteTimeAction>(cx, (cocos2d::FiniteTimeAction*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Repeat_getInnerAction : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Repeat_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 2) {
|
|
cocos2d::FiniteTimeAction* arg0 = nullptr;
|
|
unsigned int arg1 = 0;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::FiniteTimeAction*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
ok &= jsval_to_uint32(cx, args.get(1), &arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Repeat_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::Repeat::create(arg0, arg1);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::Repeat>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::Repeat"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_Repeat_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_Repeat_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::Repeat* cobj = new (std::nothrow) cocos2d::Repeat();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::Repeat>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::Repeat"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_Repeat_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::Repeat *nobj = new (std::nothrow) cocos2d::Repeat();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::Repeat");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_ActionInterval_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_Repeat(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_Repeat_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_Repeat_class->name = "Repeat";
|
|
jsb_cocos2d_Repeat_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Repeat_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_Repeat_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Repeat_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_Repeat_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_Repeat_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_Repeat_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_Repeat_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("setInnerAction", js_cocos2dx_Repeat_setInnerAction, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initWithAction", js_cocos2dx_Repeat_initWithAction, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getInnerAction", js_cocos2dx_Repeat_getInnerAction, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_Repeat_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_Repeat_create, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_ActionInterval_prototype);
|
|
jsb_cocos2d_Repeat_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_Repeat_class,
|
|
js_cocos2dx_Repeat_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_Repeat_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "Repeat"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::Repeat>(cx, jsb_cocos2d_Repeat_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.Repeat.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_RepeatForever_class;
|
|
JSObject *jsb_cocos2d_RepeatForever_prototype;
|
|
|
|
bool js_cocos2dx_RepeatForever_setInnerAction(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::RepeatForever* cobj = (cocos2d::RepeatForever *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_RepeatForever_setInnerAction : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::ActionInterval* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_RepeatForever_setInnerAction : Error processing arguments");
|
|
cobj->setInnerAction(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_RepeatForever_setInnerAction : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_RepeatForever_initWithAction(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::RepeatForever* cobj = (cocos2d::RepeatForever *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_RepeatForever_initWithAction : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::ActionInterval* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_RepeatForever_initWithAction : Error processing arguments");
|
|
bool ret = cobj->initWithAction(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_RepeatForever_initWithAction : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_RepeatForever_getInnerAction(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::RepeatForever* cobj = (cocos2d::RepeatForever *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_RepeatForever_getInnerAction : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::ActionInterval* ret = cobj->getInnerAction();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::ActionInterval>(cx, (cocos2d::ActionInterval*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_RepeatForever_getInnerAction : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_RepeatForever_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
cocos2d::ActionInterval* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_RepeatForever_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::RepeatForever::create(arg0);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::RepeatForever>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::RepeatForever"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_RepeatForever_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_RepeatForever_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::RepeatForever* cobj = new (std::nothrow) cocos2d::RepeatForever();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::RepeatForever>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::RepeatForever"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_RepeatForever_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::RepeatForever *nobj = new (std::nothrow) cocos2d::RepeatForever();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::RepeatForever");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_ActionInterval_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_RepeatForever(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_RepeatForever_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_RepeatForever_class->name = "RepeatForever";
|
|
jsb_cocos2d_RepeatForever_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_RepeatForever_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_RepeatForever_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_RepeatForever_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_RepeatForever_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_RepeatForever_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_RepeatForever_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_RepeatForever_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("setInnerAction", js_cocos2dx_RepeatForever_setInnerAction, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initWithAction", js_cocos2dx_RepeatForever_initWithAction, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getInnerAction", js_cocos2dx_RepeatForever_getInnerAction, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_RepeatForever_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_RepeatForever_create, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_ActionInterval_prototype);
|
|
jsb_cocos2d_RepeatForever_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_RepeatForever_class,
|
|
js_cocos2dx_RepeatForever_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_RepeatForever_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "RepeatForever"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::RepeatForever>(cx, jsb_cocos2d_RepeatForever_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.RepeatForever.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_Spawn_class;
|
|
JSObject *jsb_cocos2d_Spawn_prototype;
|
|
|
|
bool js_cocos2dx_Spawn_init(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Spawn* cobj = (cocos2d::Spawn *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Spawn_init : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Vector<cocos2d::FiniteTimeAction *> arg0;
|
|
ok &= jsval_to_ccvector(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Spawn_init : Error processing arguments");
|
|
bool ret = cobj->init(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Spawn_init : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Spawn_initWithTwoActions(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Spawn* cobj = (cocos2d::Spawn *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Spawn_initWithTwoActions : Invalid Native Object");
|
|
if (argc == 2) {
|
|
cocos2d::FiniteTimeAction* arg0 = nullptr;
|
|
cocos2d::FiniteTimeAction* arg1 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::FiniteTimeAction*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::FiniteTimeAction*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Spawn_initWithTwoActions : Error processing arguments");
|
|
bool ret = cobj->initWithTwoActions(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Spawn_initWithTwoActions : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Spawn_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::Spawn* cobj = new (std::nothrow) cocos2d::Spawn();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::Spawn>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::Spawn"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_Spawn_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::Spawn *nobj = new (std::nothrow) cocos2d::Spawn();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::Spawn");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_ActionInterval_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_Spawn(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_Spawn_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_Spawn_class->name = "Spawn";
|
|
jsb_cocos2d_Spawn_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Spawn_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_Spawn_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Spawn_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_Spawn_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_Spawn_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_Spawn_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_Spawn_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("init", js_cocos2dx_Spawn_init, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initWithTwoActions", js_cocos2dx_Spawn_initWithTwoActions, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_Spawn_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JSFunctionSpec *st_funcs = NULL;
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_ActionInterval_prototype);
|
|
jsb_cocos2d_Spawn_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_Spawn_class,
|
|
js_cocos2dx_Spawn_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_Spawn_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "Spawn"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::Spawn>(cx, jsb_cocos2d_Spawn_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.Spawn.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_RotateTo_class;
|
|
JSObject *jsb_cocos2d_RotateTo_prototype;
|
|
|
|
bool js_cocos2dx_RotateTo_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::RotateTo* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::RotateTo *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_RotateTo_initWithDuration : Invalid Native Object");
|
|
do {
|
|
if (argc == 2) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Vec3 arg1;
|
|
ok &= jsval_to_vector3(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
bool ret = cobj->initWithDuration(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 3) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
if (!ok) { ok = true; break; }
|
|
double arg1 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
if (!ok) { ok = true; break; }
|
|
double arg2 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
if (!ok) { ok = true; break; }
|
|
bool ret = cobj->initWithDuration(arg0, arg1, arg2);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_RotateTo_initWithDuration : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_RotateTo_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
|
|
do {
|
|
if (argc == 2) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
if (!ok) { ok = true; break; }
|
|
double arg1 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::RotateTo* ret = cocos2d::RotateTo::create(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::RotateTo>(cx, (cocos2d::RotateTo*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
|
|
do {
|
|
if (argc == 3) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
if (!ok) { ok = true; break; }
|
|
double arg1 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
if (!ok) { ok = true; break; }
|
|
double arg2 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::RotateTo* ret = cocos2d::RotateTo::create(arg0, arg1, arg2);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::RotateTo>(cx, (cocos2d::RotateTo*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
|
|
do {
|
|
if (argc == 2) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Vec3 arg1;
|
|
ok &= jsval_to_vector3(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::RotateTo* ret = cocos2d::RotateTo::create(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::RotateTo>(cx, (cocos2d::RotateTo*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
JS_ReportError(cx, "js_cocos2dx_RotateTo_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_RotateTo_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::RotateTo* cobj = new (std::nothrow) cocos2d::RotateTo();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::RotateTo>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::RotateTo"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_RotateTo_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::RotateTo *nobj = new (std::nothrow) cocos2d::RotateTo();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::RotateTo");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_ActionInterval_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_RotateTo(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_RotateTo_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_RotateTo_class->name = "RotateTo";
|
|
jsb_cocos2d_RotateTo_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_RotateTo_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_RotateTo_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_RotateTo_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_RotateTo_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_RotateTo_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_RotateTo_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_RotateTo_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("initWithDuration", js_cocos2dx_RotateTo_initWithDuration, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_RotateTo_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_RotateTo_create, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_ActionInterval_prototype);
|
|
jsb_cocos2d_RotateTo_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_RotateTo_class,
|
|
js_cocos2dx_RotateTo_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_RotateTo_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "RotateTo"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::RotateTo>(cx, jsb_cocos2d_RotateTo_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.RotateTo.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_RotateBy_class;
|
|
JSObject *jsb_cocos2d_RotateBy_prototype;
|
|
|
|
bool js_cocos2dx_RotateBy_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::RotateBy* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::RotateBy *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_RotateBy_initWithDuration : Invalid Native Object");
|
|
do {
|
|
if (argc == 3) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
if (!ok) { ok = true; break; }
|
|
double arg1 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
if (!ok) { ok = true; break; }
|
|
double arg2 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
if (!ok) { ok = true; break; }
|
|
bool ret = cobj->initWithDuration(arg0, arg1, arg2);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 2) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
if (!ok) { ok = true; break; }
|
|
double arg1 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
if (!ok) { ok = true; break; }
|
|
bool ret = cobj->initWithDuration(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 2) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Vec3 arg1;
|
|
ok &= jsval_to_vector3(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
bool ret = cobj->initWithDuration(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_RotateBy_initWithDuration : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_RotateBy_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
|
|
do {
|
|
if (argc == 3) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
if (!ok) { ok = true; break; }
|
|
double arg1 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
if (!ok) { ok = true; break; }
|
|
double arg2 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::RotateBy* ret = cocos2d::RotateBy::create(arg0, arg1, arg2);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::RotateBy>(cx, (cocos2d::RotateBy*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
|
|
do {
|
|
if (argc == 2) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
if (!ok) { ok = true; break; }
|
|
double arg1 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::RotateBy* ret = cocos2d::RotateBy::create(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::RotateBy>(cx, (cocos2d::RotateBy*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
|
|
do {
|
|
if (argc == 2) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Vec3 arg1;
|
|
ok &= jsval_to_vector3(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::RotateBy* ret = cocos2d::RotateBy::create(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::RotateBy>(cx, (cocos2d::RotateBy*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
JS_ReportError(cx, "js_cocos2dx_RotateBy_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_RotateBy_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::RotateBy* cobj = new (std::nothrow) cocos2d::RotateBy();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::RotateBy>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::RotateBy"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_RotateBy_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::RotateBy *nobj = new (std::nothrow) cocos2d::RotateBy();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::RotateBy");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_ActionInterval_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_RotateBy(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_RotateBy_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_RotateBy_class->name = "RotateBy";
|
|
jsb_cocos2d_RotateBy_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_RotateBy_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_RotateBy_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_RotateBy_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_RotateBy_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_RotateBy_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_RotateBy_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_RotateBy_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("initWithDuration", js_cocos2dx_RotateBy_initWithDuration, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_RotateBy_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_RotateBy_create, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_ActionInterval_prototype);
|
|
jsb_cocos2d_RotateBy_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_RotateBy_class,
|
|
js_cocos2dx_RotateBy_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_RotateBy_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "RotateBy"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::RotateBy>(cx, jsb_cocos2d_RotateBy_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.RotateBy.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_MoveBy_class;
|
|
JSObject *jsb_cocos2d_MoveBy_prototype;
|
|
|
|
bool js_cocos2dx_MoveBy_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::MoveBy* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::MoveBy *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_MoveBy_initWithDuration : Invalid Native Object");
|
|
do {
|
|
if (argc == 2) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Vec3 arg1;
|
|
ok &= jsval_to_vector3(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
bool ret = cobj->initWithDuration(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 2) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Vec2 arg1;
|
|
ok &= jsval_to_vector2(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
bool ret = cobj->initWithDuration(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_MoveBy_initWithDuration : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_MoveBy_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
|
|
do {
|
|
if (argc == 2) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Vec3 arg1;
|
|
ok &= jsval_to_vector3(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::MoveBy* ret = cocos2d::MoveBy::create(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::MoveBy>(cx, (cocos2d::MoveBy*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
|
|
do {
|
|
if (argc == 2) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Vec2 arg1;
|
|
ok &= jsval_to_vector2(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::MoveBy* ret = cocos2d::MoveBy::create(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::MoveBy>(cx, (cocos2d::MoveBy*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
JS_ReportError(cx, "js_cocos2dx_MoveBy_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_MoveBy_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::MoveBy* cobj = new (std::nothrow) cocos2d::MoveBy();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::MoveBy>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::MoveBy"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_MoveBy_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::MoveBy *nobj = new (std::nothrow) cocos2d::MoveBy();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::MoveBy");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_ActionInterval_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_MoveBy(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_MoveBy_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_MoveBy_class->name = "MoveBy";
|
|
jsb_cocos2d_MoveBy_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_MoveBy_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_MoveBy_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_MoveBy_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_MoveBy_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_MoveBy_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_MoveBy_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_MoveBy_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("initWithDuration", js_cocos2dx_MoveBy_initWithDuration, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_MoveBy_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_MoveBy_create, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_ActionInterval_prototype);
|
|
jsb_cocos2d_MoveBy_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_MoveBy_class,
|
|
js_cocos2dx_MoveBy_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_MoveBy_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "MoveBy"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::MoveBy>(cx, jsb_cocos2d_MoveBy_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.MoveBy.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_MoveTo_class;
|
|
JSObject *jsb_cocos2d_MoveTo_prototype;
|
|
|
|
bool js_cocos2dx_MoveTo_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::MoveTo* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::MoveTo *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_MoveTo_initWithDuration : Invalid Native Object");
|
|
do {
|
|
if (argc == 2) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Vec3 arg1;
|
|
ok &= jsval_to_vector3(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
bool ret = cobj->initWithDuration(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 2) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Vec2 arg1;
|
|
ok &= jsval_to_vector2(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
bool ret = cobj->initWithDuration(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_MoveTo_initWithDuration : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_MoveTo_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
|
|
do {
|
|
if (argc == 2) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Vec3 arg1;
|
|
ok &= jsval_to_vector3(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::MoveTo* ret = cocos2d::MoveTo::create(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::MoveTo>(cx, (cocos2d::MoveTo*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
|
|
do {
|
|
if (argc == 2) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Vec2 arg1;
|
|
ok &= jsval_to_vector2(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::MoveTo* ret = cocos2d::MoveTo::create(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::MoveTo>(cx, (cocos2d::MoveTo*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
JS_ReportError(cx, "js_cocos2dx_MoveTo_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_MoveTo_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::MoveTo* cobj = new (std::nothrow) cocos2d::MoveTo();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::MoveTo>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::MoveTo"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_MoveTo_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::MoveTo *nobj = new (std::nothrow) cocos2d::MoveTo();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::MoveTo");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_MoveBy_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_MoveTo(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_MoveTo_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_MoveTo_class->name = "MoveTo";
|
|
jsb_cocos2d_MoveTo_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_MoveTo_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_MoveTo_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_MoveTo_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_MoveTo_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_MoveTo_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_MoveTo_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_MoveTo_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("initWithDuration", js_cocos2dx_MoveTo_initWithDuration, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_MoveTo_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_MoveTo_create, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_MoveBy_prototype);
|
|
jsb_cocos2d_MoveTo_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_MoveTo_class,
|
|
js_cocos2dx_MoveTo_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_MoveTo_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "MoveTo"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::MoveTo>(cx, jsb_cocos2d_MoveTo_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.MoveTo.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_SkewTo_class;
|
|
JSObject *jsb_cocos2d_SkewTo_prototype;
|
|
|
|
bool js_cocos2dx_SkewTo_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::SkewTo* cobj = (cocos2d::SkewTo *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SkewTo_initWithDuration : Invalid Native Object");
|
|
if (argc == 3) {
|
|
double arg0 = 0;
|
|
double arg1 = 0;
|
|
double arg2 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SkewTo_initWithDuration : Error processing arguments");
|
|
bool ret = cobj->initWithDuration(arg0, arg1, arg2);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SkewTo_initWithDuration : wrong number of arguments: %d, was expecting %d", argc, 3);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SkewTo_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 3) {
|
|
double arg0 = 0;
|
|
double arg1 = 0;
|
|
double arg2 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SkewTo_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::SkewTo::create(arg0, arg1, arg2);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::SkewTo>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::SkewTo"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_SkewTo_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_SkewTo_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::SkewTo* cobj = new (std::nothrow) cocos2d::SkewTo();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::SkewTo>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::SkewTo"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_SkewTo_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::SkewTo *nobj = new (std::nothrow) cocos2d::SkewTo();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::SkewTo");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_ActionInterval_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_SkewTo(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_SkewTo_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_SkewTo_class->name = "SkewTo";
|
|
jsb_cocos2d_SkewTo_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_SkewTo_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_SkewTo_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_SkewTo_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_SkewTo_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_SkewTo_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_SkewTo_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_SkewTo_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("initWithDuration", js_cocos2dx_SkewTo_initWithDuration, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_SkewTo_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_SkewTo_create, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_ActionInterval_prototype);
|
|
jsb_cocos2d_SkewTo_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_SkewTo_class,
|
|
js_cocos2dx_SkewTo_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_SkewTo_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "SkewTo"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::SkewTo>(cx, jsb_cocos2d_SkewTo_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.SkewTo.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_SkewBy_class;
|
|
JSObject *jsb_cocos2d_SkewBy_prototype;
|
|
|
|
bool js_cocos2dx_SkewBy_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::SkewBy* cobj = (cocos2d::SkewBy *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SkewBy_initWithDuration : Invalid Native Object");
|
|
if (argc == 3) {
|
|
double arg0 = 0;
|
|
double arg1 = 0;
|
|
double arg2 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SkewBy_initWithDuration : Error processing arguments");
|
|
bool ret = cobj->initWithDuration(arg0, arg1, arg2);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SkewBy_initWithDuration : wrong number of arguments: %d, was expecting %d", argc, 3);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SkewBy_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 3) {
|
|
double arg0 = 0;
|
|
double arg1 = 0;
|
|
double arg2 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SkewBy_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::SkewBy::create(arg0, arg1, arg2);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::SkewBy>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::SkewBy"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_SkewBy_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_SkewBy_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::SkewBy* cobj = new (std::nothrow) cocos2d::SkewBy();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::SkewBy>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::SkewBy"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_SkewBy_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::SkewBy *nobj = new (std::nothrow) cocos2d::SkewBy();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::SkewBy");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_SkewTo_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_SkewBy(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_SkewBy_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_SkewBy_class->name = "SkewBy";
|
|
jsb_cocos2d_SkewBy_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_SkewBy_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_SkewBy_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_SkewBy_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_SkewBy_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_SkewBy_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_SkewBy_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_SkewBy_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("initWithDuration", js_cocos2dx_SkewBy_initWithDuration, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_SkewBy_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_SkewBy_create, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_SkewTo_prototype);
|
|
jsb_cocos2d_SkewBy_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_SkewBy_class,
|
|
js_cocos2dx_SkewBy_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_SkewBy_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "SkewBy"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::SkewBy>(cx, jsb_cocos2d_SkewBy_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.SkewBy.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_JumpBy_class;
|
|
JSObject *jsb_cocos2d_JumpBy_prototype;
|
|
|
|
bool js_cocos2dx_JumpBy_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::JumpBy* cobj = (cocos2d::JumpBy *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_JumpBy_initWithDuration : Invalid Native Object");
|
|
if (argc == 4) {
|
|
double arg0 = 0;
|
|
cocos2d::Vec2 arg1;
|
|
double arg2 = 0;
|
|
int arg3 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
ok &= jsval_to_vector2(cx, args.get(1), &arg1);
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
ok &= jsval_to_int32(cx, args.get(3), (int32_t *)&arg3);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_JumpBy_initWithDuration : Error processing arguments");
|
|
bool ret = cobj->initWithDuration(arg0, arg1, arg2, arg3);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_JumpBy_initWithDuration : wrong number of arguments: %d, was expecting %d", argc, 4);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_JumpBy_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 4) {
|
|
double arg0 = 0;
|
|
cocos2d::Vec2 arg1;
|
|
double arg2 = 0;
|
|
int arg3 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
ok &= jsval_to_vector2(cx, args.get(1), &arg1);
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
ok &= jsval_to_int32(cx, args.get(3), (int32_t *)&arg3);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_JumpBy_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::JumpBy::create(arg0, arg1, arg2, arg3);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::JumpBy>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::JumpBy"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_JumpBy_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_JumpBy_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::JumpBy* cobj = new (std::nothrow) cocos2d::JumpBy();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::JumpBy>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::JumpBy"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_JumpBy_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::JumpBy *nobj = new (std::nothrow) cocos2d::JumpBy();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::JumpBy");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_ActionInterval_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_JumpBy(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_JumpBy_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_JumpBy_class->name = "JumpBy";
|
|
jsb_cocos2d_JumpBy_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_JumpBy_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_JumpBy_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_JumpBy_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_JumpBy_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_JumpBy_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_JumpBy_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_JumpBy_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("initWithDuration", js_cocos2dx_JumpBy_initWithDuration, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_JumpBy_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_JumpBy_create, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_ActionInterval_prototype);
|
|
jsb_cocos2d_JumpBy_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_JumpBy_class,
|
|
js_cocos2dx_JumpBy_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_JumpBy_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "JumpBy"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::JumpBy>(cx, jsb_cocos2d_JumpBy_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.JumpBy.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_JumpTo_class;
|
|
JSObject *jsb_cocos2d_JumpTo_prototype;
|
|
|
|
bool js_cocos2dx_JumpTo_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::JumpTo* cobj = (cocos2d::JumpTo *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_JumpTo_initWithDuration : Invalid Native Object");
|
|
if (argc == 4) {
|
|
double arg0 = 0;
|
|
cocos2d::Vec2 arg1;
|
|
double arg2 = 0;
|
|
int arg3 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
ok &= jsval_to_vector2(cx, args.get(1), &arg1);
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
ok &= jsval_to_int32(cx, args.get(3), (int32_t *)&arg3);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_JumpTo_initWithDuration : Error processing arguments");
|
|
bool ret = cobj->initWithDuration(arg0, arg1, arg2, arg3);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_JumpTo_initWithDuration : wrong number of arguments: %d, was expecting %d", argc, 4);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_JumpTo_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 4) {
|
|
double arg0 = 0;
|
|
cocos2d::Vec2 arg1;
|
|
double arg2 = 0;
|
|
int arg3 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
ok &= jsval_to_vector2(cx, args.get(1), &arg1);
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
ok &= jsval_to_int32(cx, args.get(3), (int32_t *)&arg3);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_JumpTo_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::JumpTo::create(arg0, arg1, arg2, arg3);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::JumpTo>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::JumpTo"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_JumpTo_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_JumpTo_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::JumpTo* cobj = new (std::nothrow) cocos2d::JumpTo();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::JumpTo>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::JumpTo"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_JumpTo_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::JumpTo *nobj = new (std::nothrow) cocos2d::JumpTo();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::JumpTo");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_JumpBy_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_JumpTo(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_JumpTo_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_JumpTo_class->name = "JumpTo";
|
|
jsb_cocos2d_JumpTo_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_JumpTo_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_JumpTo_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_JumpTo_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_JumpTo_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_JumpTo_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_JumpTo_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_JumpTo_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("initWithDuration", js_cocos2dx_JumpTo_initWithDuration, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_JumpTo_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_JumpTo_create, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_JumpBy_prototype);
|
|
jsb_cocos2d_JumpTo_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_JumpTo_class,
|
|
js_cocos2dx_JumpTo_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_JumpTo_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "JumpTo"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::JumpTo>(cx, jsb_cocos2d_JumpTo_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.JumpTo.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_BezierBy_class;
|
|
JSObject *jsb_cocos2d_BezierBy_prototype;
|
|
|
|
bool js_cocos2dx_BezierBy_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::BezierBy* cobj = new (std::nothrow) cocos2d::BezierBy();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::BezierBy>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::BezierBy"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_BezierBy_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::BezierBy *nobj = new (std::nothrow) cocos2d::BezierBy();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::BezierBy");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_ActionInterval_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_BezierBy(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_BezierBy_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_BezierBy_class->name = "BezierBy";
|
|
jsb_cocos2d_BezierBy_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_BezierBy_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_BezierBy_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_BezierBy_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_BezierBy_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_BezierBy_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_BezierBy_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_BezierBy_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("ctor", js_cocos2dx_BezierBy_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JSFunctionSpec *st_funcs = NULL;
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_ActionInterval_prototype);
|
|
jsb_cocos2d_BezierBy_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_BezierBy_class,
|
|
js_cocos2dx_BezierBy_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_BezierBy_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "BezierBy"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::BezierBy>(cx, jsb_cocos2d_BezierBy_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.BezierBy.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_BezierTo_class;
|
|
JSObject *jsb_cocos2d_BezierTo_prototype;
|
|
|
|
bool js_cocos2dx_BezierTo_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::BezierTo* cobj = new (std::nothrow) cocos2d::BezierTo();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::BezierTo>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::BezierTo"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_BezierTo_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::BezierTo *nobj = new (std::nothrow) cocos2d::BezierTo();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::BezierTo");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_BezierBy_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_BezierTo(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_BezierTo_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_BezierTo_class->name = "BezierTo";
|
|
jsb_cocos2d_BezierTo_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_BezierTo_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_BezierTo_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_BezierTo_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_BezierTo_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_BezierTo_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_BezierTo_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_BezierTo_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("ctor", js_cocos2dx_BezierTo_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JSFunctionSpec *st_funcs = NULL;
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_BezierBy_prototype);
|
|
jsb_cocos2d_BezierTo_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_BezierTo_class,
|
|
js_cocos2dx_BezierTo_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_BezierTo_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "BezierTo"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::BezierTo>(cx, jsb_cocos2d_BezierTo_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.BezierTo.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_ScaleTo_class;
|
|
JSObject *jsb_cocos2d_ScaleTo_prototype;
|
|
|
|
bool js_cocos2dx_ScaleTo_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::ScaleTo* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::ScaleTo *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ScaleTo_initWithDuration : Invalid Native Object");
|
|
do {
|
|
if (argc == 3) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
if (!ok) { ok = true; break; }
|
|
double arg1 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
if (!ok) { ok = true; break; }
|
|
double arg2 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
if (!ok) { ok = true; break; }
|
|
bool ret = cobj->initWithDuration(arg0, arg1, arg2);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 2) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
if (!ok) { ok = true; break; }
|
|
double arg1 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
if (!ok) { ok = true; break; }
|
|
bool ret = cobj->initWithDuration(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 4) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
if (!ok) { ok = true; break; }
|
|
double arg1 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
if (!ok) { ok = true; break; }
|
|
double arg2 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
if (!ok) { ok = true; break; }
|
|
double arg3 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(3), &arg3) && !std::isnan(arg3);
|
|
if (!ok) { ok = true; break; }
|
|
bool ret = cobj->initWithDuration(arg0, arg1, arg2, arg3);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ScaleTo_initWithDuration : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ScaleTo_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
|
|
do {
|
|
if (argc == 3) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
if (!ok) { ok = true; break; }
|
|
double arg1 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
if (!ok) { ok = true; break; }
|
|
double arg2 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::ScaleTo* ret = cocos2d::ScaleTo::create(arg0, arg1, arg2);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::ScaleTo>(cx, (cocos2d::ScaleTo*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
|
|
do {
|
|
if (argc == 2) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
if (!ok) { ok = true; break; }
|
|
double arg1 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::ScaleTo* ret = cocos2d::ScaleTo::create(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::ScaleTo>(cx, (cocos2d::ScaleTo*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
|
|
do {
|
|
if (argc == 4) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
if (!ok) { ok = true; break; }
|
|
double arg1 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
if (!ok) { ok = true; break; }
|
|
double arg2 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
if (!ok) { ok = true; break; }
|
|
double arg3 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(3), &arg3) && !std::isnan(arg3);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::ScaleTo* ret = cocos2d::ScaleTo::create(arg0, arg1, arg2, arg3);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::ScaleTo>(cx, (cocos2d::ScaleTo*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
JS_ReportError(cx, "js_cocos2dx_ScaleTo_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ScaleTo_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::ScaleTo* cobj = new (std::nothrow) cocos2d::ScaleTo();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::ScaleTo>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::ScaleTo"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_ScaleTo_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::ScaleTo *nobj = new (std::nothrow) cocos2d::ScaleTo();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::ScaleTo");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_ActionInterval_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_ScaleTo(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_ScaleTo_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_ScaleTo_class->name = "ScaleTo";
|
|
jsb_cocos2d_ScaleTo_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_ScaleTo_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_ScaleTo_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_ScaleTo_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_ScaleTo_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_ScaleTo_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_ScaleTo_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_ScaleTo_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("initWithDuration", js_cocos2dx_ScaleTo_initWithDuration, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_ScaleTo_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_ScaleTo_create, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_ActionInterval_prototype);
|
|
jsb_cocos2d_ScaleTo_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_ScaleTo_class,
|
|
js_cocos2dx_ScaleTo_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_ScaleTo_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "ScaleTo"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::ScaleTo>(cx, jsb_cocos2d_ScaleTo_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.ScaleTo.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_ScaleBy_class;
|
|
JSObject *jsb_cocos2d_ScaleBy_prototype;
|
|
|
|
bool js_cocos2dx_ScaleBy_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
|
|
do {
|
|
if (argc == 3) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
if (!ok) { ok = true; break; }
|
|
double arg1 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
if (!ok) { ok = true; break; }
|
|
double arg2 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::ScaleBy* ret = cocos2d::ScaleBy::create(arg0, arg1, arg2);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::ScaleBy>(cx, (cocos2d::ScaleBy*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
|
|
do {
|
|
if (argc == 2) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
if (!ok) { ok = true; break; }
|
|
double arg1 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::ScaleBy* ret = cocos2d::ScaleBy::create(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::ScaleBy>(cx, (cocos2d::ScaleBy*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
|
|
do {
|
|
if (argc == 4) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
if (!ok) { ok = true; break; }
|
|
double arg1 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
if (!ok) { ok = true; break; }
|
|
double arg2 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
if (!ok) { ok = true; break; }
|
|
double arg3 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(3), &arg3) && !std::isnan(arg3);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::ScaleBy* ret = cocos2d::ScaleBy::create(arg0, arg1, arg2, arg3);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::ScaleBy>(cx, (cocos2d::ScaleBy*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
JS_ReportError(cx, "js_cocos2dx_ScaleBy_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ScaleBy_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::ScaleBy* cobj = new (std::nothrow) cocos2d::ScaleBy();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::ScaleBy>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::ScaleBy"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_ScaleBy_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::ScaleBy *nobj = new (std::nothrow) cocos2d::ScaleBy();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::ScaleBy");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_ScaleTo_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_ScaleBy(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_ScaleBy_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_ScaleBy_class->name = "ScaleBy";
|
|
jsb_cocos2d_ScaleBy_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_ScaleBy_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_ScaleBy_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_ScaleBy_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_ScaleBy_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_ScaleBy_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_ScaleBy_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_ScaleBy_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("ctor", js_cocos2dx_ScaleBy_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_ScaleBy_create, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_ScaleTo_prototype);
|
|
jsb_cocos2d_ScaleBy_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_ScaleBy_class,
|
|
js_cocos2dx_ScaleBy_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_ScaleBy_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "ScaleBy"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::ScaleBy>(cx, jsb_cocos2d_ScaleBy_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.ScaleBy.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_Blink_class;
|
|
JSObject *jsb_cocos2d_Blink_prototype;
|
|
|
|
bool js_cocos2dx_Blink_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Blink* cobj = (cocos2d::Blink *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Blink_initWithDuration : Invalid Native Object");
|
|
if (argc == 2) {
|
|
double arg0 = 0;
|
|
int arg1 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Blink_initWithDuration : Error processing arguments");
|
|
bool ret = cobj->initWithDuration(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Blink_initWithDuration : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Blink_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 2) {
|
|
double arg0 = 0;
|
|
int arg1 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Blink_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::Blink::create(arg0, arg1);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::Blink>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::Blink"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_Blink_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_Blink_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::Blink* cobj = new (std::nothrow) cocos2d::Blink();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::Blink>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::Blink"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_Blink_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::Blink *nobj = new (std::nothrow) cocos2d::Blink();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::Blink");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_ActionInterval_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_Blink(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_Blink_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_Blink_class->name = "Blink";
|
|
jsb_cocos2d_Blink_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Blink_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_Blink_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Blink_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_Blink_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_Blink_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_Blink_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_Blink_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("initWithDuration", js_cocos2dx_Blink_initWithDuration, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_Blink_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_Blink_create, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_ActionInterval_prototype);
|
|
jsb_cocos2d_Blink_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_Blink_class,
|
|
js_cocos2dx_Blink_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_Blink_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "Blink"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::Blink>(cx, jsb_cocos2d_Blink_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.Blink.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_FadeTo_class;
|
|
JSObject *jsb_cocos2d_FadeTo_prototype;
|
|
|
|
bool js_cocos2dx_FadeTo_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::FadeTo* cobj = (cocos2d::FadeTo *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FadeTo_initWithDuration : Invalid Native Object");
|
|
if (argc == 2) {
|
|
double arg0 = 0;
|
|
uint16_t arg1;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
ok &= jsval_to_uint16(cx, args.get(1), &arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FadeTo_initWithDuration : Error processing arguments");
|
|
bool ret = cobj->initWithDuration(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_FadeTo_initWithDuration : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_FadeTo_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 2) {
|
|
double arg0 = 0;
|
|
uint16_t arg1;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
ok &= jsval_to_uint16(cx, args.get(1), &arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FadeTo_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::FadeTo::create(arg0, arg1);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::FadeTo>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::FadeTo"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_FadeTo_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_FadeTo_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::FadeTo* cobj = new (std::nothrow) cocos2d::FadeTo();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::FadeTo>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::FadeTo"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_FadeTo_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::FadeTo *nobj = new (std::nothrow) cocos2d::FadeTo();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::FadeTo");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_ActionInterval_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_FadeTo(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_FadeTo_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_FadeTo_class->name = "FadeTo";
|
|
jsb_cocos2d_FadeTo_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_FadeTo_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_FadeTo_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_FadeTo_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_FadeTo_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_FadeTo_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_FadeTo_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_FadeTo_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("initWithDuration", js_cocos2dx_FadeTo_initWithDuration, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_FadeTo_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_FadeTo_create, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_ActionInterval_prototype);
|
|
jsb_cocos2d_FadeTo_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_FadeTo_class,
|
|
js_cocos2dx_FadeTo_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_FadeTo_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "FadeTo"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::FadeTo>(cx, jsb_cocos2d_FadeTo_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.FadeTo.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_FadeIn_class;
|
|
JSObject *jsb_cocos2d_FadeIn_prototype;
|
|
|
|
bool js_cocos2dx_FadeIn_setReverseAction(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::FadeIn* cobj = (cocos2d::FadeIn *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FadeIn_setReverseAction : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::FadeTo* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::FadeTo*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FadeIn_setReverseAction : Error processing arguments");
|
|
cobj->setReverseAction(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_FadeIn_setReverseAction : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_FadeIn_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FadeIn_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::FadeIn::create(arg0);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::FadeIn>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::FadeIn"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_FadeIn_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_FadeIn_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::FadeIn* cobj = new (std::nothrow) cocos2d::FadeIn();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::FadeIn>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::FadeIn"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_FadeIn_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::FadeIn *nobj = new (std::nothrow) cocos2d::FadeIn();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::FadeIn");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_FadeTo_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_FadeIn(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_FadeIn_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_FadeIn_class->name = "FadeIn";
|
|
jsb_cocos2d_FadeIn_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_FadeIn_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_FadeIn_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_FadeIn_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_FadeIn_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_FadeIn_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_FadeIn_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_FadeIn_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("setReverseAction", js_cocos2dx_FadeIn_setReverseAction, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_FadeIn_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_FadeIn_create, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_FadeTo_prototype);
|
|
jsb_cocos2d_FadeIn_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_FadeIn_class,
|
|
js_cocos2dx_FadeIn_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_FadeIn_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "FadeIn"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::FadeIn>(cx, jsb_cocos2d_FadeIn_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.FadeIn.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_FadeOut_class;
|
|
JSObject *jsb_cocos2d_FadeOut_prototype;
|
|
|
|
bool js_cocos2dx_FadeOut_setReverseAction(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::FadeOut* cobj = (cocos2d::FadeOut *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FadeOut_setReverseAction : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::FadeTo* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::FadeTo*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FadeOut_setReverseAction : Error processing arguments");
|
|
cobj->setReverseAction(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_FadeOut_setReverseAction : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_FadeOut_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FadeOut_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::FadeOut::create(arg0);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::FadeOut>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::FadeOut"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_FadeOut_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_FadeOut_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::FadeOut* cobj = new (std::nothrow) cocos2d::FadeOut();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::FadeOut>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::FadeOut"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_FadeOut_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::FadeOut *nobj = new (std::nothrow) cocos2d::FadeOut();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::FadeOut");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_FadeTo_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_FadeOut(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_FadeOut_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_FadeOut_class->name = "FadeOut";
|
|
jsb_cocos2d_FadeOut_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_FadeOut_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_FadeOut_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_FadeOut_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_FadeOut_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_FadeOut_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_FadeOut_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_FadeOut_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("setReverseAction", js_cocos2dx_FadeOut_setReverseAction, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_FadeOut_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_FadeOut_create, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_FadeTo_prototype);
|
|
jsb_cocos2d_FadeOut_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_FadeOut_class,
|
|
js_cocos2dx_FadeOut_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_FadeOut_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "FadeOut"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::FadeOut>(cx, jsb_cocos2d_FadeOut_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.FadeOut.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_TintTo_class;
|
|
JSObject *jsb_cocos2d_TintTo_prototype;
|
|
|
|
bool js_cocos2dx_TintTo_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TintTo* cobj = (cocos2d::TintTo *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TintTo_initWithDuration : Invalid Native Object");
|
|
if (argc == 4) {
|
|
double arg0 = 0;
|
|
uint16_t arg1;
|
|
uint16_t arg2;
|
|
uint16_t arg3;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
ok &= jsval_to_uint16(cx, args.get(1), &arg1);
|
|
ok &= jsval_to_uint16(cx, args.get(2), &arg2);
|
|
ok &= jsval_to_uint16(cx, args.get(3), &arg3);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TintTo_initWithDuration : Error processing arguments");
|
|
bool ret = cobj->initWithDuration(arg0, arg1, arg2, arg3);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TintTo_initWithDuration : wrong number of arguments: %d, was expecting %d", argc, 4);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TintTo_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
|
|
do {
|
|
if (argc == 2) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Color3B arg1;
|
|
ok &= jsval_to_cccolor3b(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::TintTo* ret = cocos2d::TintTo::create(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::TintTo>(cx, (cocos2d::TintTo*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
|
|
do {
|
|
if (argc == 4) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
if (!ok) { ok = true; break; }
|
|
uint16_t arg1;
|
|
ok &= jsval_to_uint16(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
uint16_t arg2;
|
|
ok &= jsval_to_uint16(cx, args.get(2), &arg2);
|
|
if (!ok) { ok = true; break; }
|
|
uint16_t arg3;
|
|
ok &= jsval_to_uint16(cx, args.get(3), &arg3);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::TintTo* ret = cocos2d::TintTo::create(arg0, arg1, arg2, arg3);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::TintTo>(cx, (cocos2d::TintTo*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
JS_ReportError(cx, "js_cocos2dx_TintTo_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TintTo_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::TintTo* cobj = new (std::nothrow) cocos2d::TintTo();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TintTo>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::TintTo"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_TintTo_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::TintTo *nobj = new (std::nothrow) cocos2d::TintTo();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::TintTo");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_ActionInterval_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_TintTo(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_TintTo_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_TintTo_class->name = "TintTo";
|
|
jsb_cocos2d_TintTo_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TintTo_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_TintTo_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TintTo_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_TintTo_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_TintTo_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_TintTo_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_TintTo_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("initWithDuration", js_cocos2dx_TintTo_initWithDuration, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_TintTo_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_TintTo_create, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_ActionInterval_prototype);
|
|
jsb_cocos2d_TintTo_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_TintTo_class,
|
|
js_cocos2dx_TintTo_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_TintTo_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "TintTo"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::TintTo>(cx, jsb_cocos2d_TintTo_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.TintTo.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_TintBy_class;
|
|
JSObject *jsb_cocos2d_TintBy_prototype;
|
|
|
|
bool js_cocos2dx_TintBy_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TintBy* cobj = (cocos2d::TintBy *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TintBy_initWithDuration : Invalid Native Object");
|
|
if (argc == 4) {
|
|
double arg0 = 0;
|
|
int32_t arg1 = 0;
|
|
int32_t arg2 = 0;
|
|
int32_t arg3 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
ok &= jsval_to_int32(cx, args.get(1), &arg1);
|
|
ok &= jsval_to_int32(cx, args.get(2), &arg2);
|
|
ok &= jsval_to_int32(cx, args.get(3), &arg3);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TintBy_initWithDuration : Error processing arguments");
|
|
bool ret = cobj->initWithDuration(arg0, arg1, arg2, arg3);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TintBy_initWithDuration : wrong number of arguments: %d, was expecting %d", argc, 4);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TintBy_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 4) {
|
|
double arg0 = 0;
|
|
int32_t arg1 = 0;
|
|
int32_t arg2 = 0;
|
|
int32_t arg3 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
ok &= jsval_to_int32(cx, args.get(1), &arg1);
|
|
ok &= jsval_to_int32(cx, args.get(2), &arg2);
|
|
ok &= jsval_to_int32(cx, args.get(3), &arg3);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TintBy_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::TintBy::create(arg0, arg1, arg2, arg3);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TintBy>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::TintBy"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_TintBy_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_TintBy_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::TintBy* cobj = new (std::nothrow) cocos2d::TintBy();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TintBy>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::TintBy"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_TintBy_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::TintBy *nobj = new (std::nothrow) cocos2d::TintBy();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::TintBy");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_ActionInterval_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_TintBy(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_TintBy_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_TintBy_class->name = "TintBy";
|
|
jsb_cocos2d_TintBy_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TintBy_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_TintBy_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TintBy_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_TintBy_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_TintBy_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_TintBy_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_TintBy_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("initWithDuration", js_cocos2dx_TintBy_initWithDuration, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_TintBy_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_TintBy_create, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_ActionInterval_prototype);
|
|
jsb_cocos2d_TintBy_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_TintBy_class,
|
|
js_cocos2dx_TintBy_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_TintBy_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "TintBy"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::TintBy>(cx, jsb_cocos2d_TintBy_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.TintBy.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_DelayTime_class;
|
|
JSObject *jsb_cocos2d_DelayTime_prototype;
|
|
|
|
bool js_cocos2dx_DelayTime_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_DelayTime_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::DelayTime::create(arg0);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::DelayTime>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::DelayTime"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_DelayTime_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_DelayTime_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::DelayTime* cobj = new (std::nothrow) cocos2d::DelayTime();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::DelayTime>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::DelayTime"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_DelayTime_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::DelayTime *nobj = new (std::nothrow) cocos2d::DelayTime();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::DelayTime");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_ActionInterval_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_DelayTime(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_DelayTime_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_DelayTime_class->name = "DelayTime";
|
|
jsb_cocos2d_DelayTime_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_DelayTime_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_DelayTime_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_DelayTime_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_DelayTime_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_DelayTime_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_DelayTime_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_DelayTime_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("ctor", js_cocos2dx_DelayTime_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_DelayTime_create, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_ActionInterval_prototype);
|
|
jsb_cocos2d_DelayTime_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_DelayTime_class,
|
|
js_cocos2dx_DelayTime_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_DelayTime_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "DelayTime"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::DelayTime>(cx, jsb_cocos2d_DelayTime_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.DelayTime.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_ReverseTime_class;
|
|
JSObject *jsb_cocos2d_ReverseTime_prototype;
|
|
|
|
bool js_cocos2dx_ReverseTime_initWithAction(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ReverseTime* cobj = (cocos2d::ReverseTime *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ReverseTime_initWithAction : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::FiniteTimeAction* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::FiniteTimeAction*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ReverseTime_initWithAction : Error processing arguments");
|
|
bool ret = cobj->initWithAction(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ReverseTime_initWithAction : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ReverseTime_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
cocos2d::FiniteTimeAction* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::FiniteTimeAction*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ReverseTime_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::ReverseTime::create(arg0);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::ReverseTime>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::ReverseTime"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_ReverseTime_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_ReverseTime_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::ReverseTime* cobj = new (std::nothrow) cocos2d::ReverseTime();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::ReverseTime>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::ReverseTime"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_ReverseTime_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::ReverseTime *nobj = new (std::nothrow) cocos2d::ReverseTime();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::ReverseTime");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_ActionInterval_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_ReverseTime(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_ReverseTime_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_ReverseTime_class->name = "ReverseTime";
|
|
jsb_cocos2d_ReverseTime_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_ReverseTime_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_ReverseTime_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_ReverseTime_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_ReverseTime_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_ReverseTime_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_ReverseTime_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_ReverseTime_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("initWithAction", js_cocos2dx_ReverseTime_initWithAction, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_ReverseTime_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_ReverseTime_create, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_ActionInterval_prototype);
|
|
jsb_cocos2d_ReverseTime_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_ReverseTime_class,
|
|
js_cocos2dx_ReverseTime_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_ReverseTime_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "ReverseTime"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::ReverseTime>(cx, jsb_cocos2d_ReverseTime_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.ReverseTime.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_Animate_class;
|
|
JSObject *jsb_cocos2d_Animate_prototype;
|
|
|
|
bool js_cocos2dx_Animate_initWithAnimation(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Animate* cobj = (cocos2d::Animate *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Animate_initWithAnimation : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Animation* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Animation*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Animate_initWithAnimation : Error processing arguments");
|
|
bool ret = cobj->initWithAnimation(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Animate_initWithAnimation : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Animate_getAnimation(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::Animate* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::Animate *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Animate_getAnimation : Invalid Native Object");
|
|
do {
|
|
if (argc == 0) {
|
|
const cocos2d::Animation* ret = cobj->getAnimation();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Animation>(cx, (cocos2d::Animation*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 0) {
|
|
cocos2d::Animation* ret = cobj->getAnimation();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Animation>(cx, (cocos2d::Animation*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Animate_getAnimation : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Animate_getCurrentFrameIndex(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Animate* cobj = (cocos2d::Animate *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Animate_getCurrentFrameIndex : Invalid Native Object");
|
|
if (argc == 0) {
|
|
int ret = cobj->getCurrentFrameIndex();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = int32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Animate_getCurrentFrameIndex : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Animate_setAnimation(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Animate* cobj = (cocos2d::Animate *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Animate_setAnimation : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Animation* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Animation*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Animate_setAnimation : Error processing arguments");
|
|
cobj->setAnimation(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Animate_setAnimation : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Animate_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
cocos2d::Animation* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Animation*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Animate_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::Animate::create(arg0);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::Animate>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::Animate"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_Animate_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_Animate_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::Animate* cobj = new (std::nothrow) cocos2d::Animate();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::Animate>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::Animate"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_Animate_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::Animate *nobj = new (std::nothrow) cocos2d::Animate();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::Animate");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_ActionInterval_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_Animate(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_Animate_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_Animate_class->name = "Animate";
|
|
jsb_cocos2d_Animate_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Animate_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_Animate_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Animate_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_Animate_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_Animate_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_Animate_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_Animate_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("initWithAnimation", js_cocos2dx_Animate_initWithAnimation, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getAnimation", js_cocos2dx_Animate_getAnimation, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getCurrentFrameIndex", js_cocos2dx_Animate_getCurrentFrameIndex, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setAnimation", js_cocos2dx_Animate_setAnimation, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_Animate_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_Animate_create, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_ActionInterval_prototype);
|
|
jsb_cocos2d_Animate_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_Animate_class,
|
|
js_cocos2dx_Animate_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_Animate_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "Animate"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::Animate>(cx, jsb_cocos2d_Animate_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.Animate.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_TargetedAction_class;
|
|
JSObject *jsb_cocos2d_TargetedAction_prototype;
|
|
|
|
bool js_cocos2dx_TargetedAction_getForcedTarget(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::TargetedAction* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::TargetedAction *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TargetedAction_getForcedTarget : Invalid Native Object");
|
|
do {
|
|
if (argc == 0) {
|
|
const cocos2d::Node* ret = cobj->getForcedTarget();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Node>(cx, (cocos2d::Node*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 0) {
|
|
cocos2d::Node* ret = cobj->getForcedTarget();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Node>(cx, (cocos2d::Node*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TargetedAction_getForcedTarget : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TargetedAction_initWithTarget(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TargetedAction* cobj = (cocos2d::TargetedAction *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TargetedAction_initWithTarget : Invalid Native Object");
|
|
if (argc == 2) {
|
|
cocos2d::Node* arg0 = nullptr;
|
|
cocos2d::FiniteTimeAction* arg1 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::FiniteTimeAction*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TargetedAction_initWithTarget : Error processing arguments");
|
|
bool ret = cobj->initWithTarget(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TargetedAction_initWithTarget : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TargetedAction_setForcedTarget(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TargetedAction* cobj = (cocos2d::TargetedAction *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TargetedAction_setForcedTarget : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Node* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TargetedAction_setForcedTarget : Error processing arguments");
|
|
cobj->setForcedTarget(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TargetedAction_setForcedTarget : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TargetedAction_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 2) {
|
|
cocos2d::Node* arg0 = nullptr;
|
|
cocos2d::FiniteTimeAction* arg1 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::FiniteTimeAction*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TargetedAction_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::TargetedAction::create(arg0, arg1);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TargetedAction>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::TargetedAction"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_TargetedAction_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_TargetedAction_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::TargetedAction* cobj = new (std::nothrow) cocos2d::TargetedAction();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TargetedAction>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::TargetedAction"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_TargetedAction_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::TargetedAction *nobj = new (std::nothrow) cocos2d::TargetedAction();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::TargetedAction");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_ActionInterval_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_TargetedAction(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_TargetedAction_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_TargetedAction_class->name = "TargetedAction";
|
|
jsb_cocos2d_TargetedAction_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TargetedAction_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_TargetedAction_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TargetedAction_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_TargetedAction_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_TargetedAction_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_TargetedAction_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_TargetedAction_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("getForcedTarget", js_cocos2dx_TargetedAction_getForcedTarget, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initWithTarget", js_cocos2dx_TargetedAction_initWithTarget, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setForcedTarget", js_cocos2dx_TargetedAction_setForcedTarget, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_TargetedAction_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_TargetedAction_create, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_ActionInterval_prototype);
|
|
jsb_cocos2d_TargetedAction_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_TargetedAction_class,
|
|
js_cocos2dx_TargetedAction_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_TargetedAction_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "TargetedAction"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::TargetedAction>(cx, jsb_cocos2d_TargetedAction_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.TargetedAction.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_ActionFloat_class;
|
|
JSObject *jsb_cocos2d_ActionFloat_prototype;
|
|
|
|
bool js_cocos2dx_ActionFloat_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ActionFloat* cobj = (cocos2d::ActionFloat *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ActionFloat_initWithDuration : Invalid Native Object");
|
|
if (argc == 4) {
|
|
double arg0 = 0;
|
|
double arg1 = 0;
|
|
double arg2 = 0;
|
|
std::function<void (float)> arg3;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
do {
|
|
if(JS_TypeOfValue(cx, args.get(3)) == JSTYPE_FUNCTION)
|
|
{
|
|
JS::RootedObject jstarget(cx, args.thisv().toObjectOrNull());
|
|
std::shared_ptr<JSFunctionWrapper> func(new JSFunctionWrapper(cx, jstarget, args.get(3), args.thisv()));
|
|
auto lambda = [=](float larg0) -> void {
|
|
JSB_AUTOCOMPARTMENT_WITH_GLOBAL_OBJCET
|
|
jsval largv[1];
|
|
largv[0] = DOUBLE_TO_JSVAL(larg0);
|
|
JS::RootedValue rval(cx);
|
|
bool succeed = func->invoke(1, &largv[0], &rval);
|
|
if (!succeed && JS_IsExceptionPending(cx)) {
|
|
JS_ReportPendingException(cx);
|
|
}
|
|
};
|
|
arg3 = lambda;
|
|
}
|
|
else
|
|
{
|
|
arg3 = nullptr;
|
|
}
|
|
} while(0)
|
|
;
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ActionFloat_initWithDuration : Error processing arguments");
|
|
bool ret = cobj->initWithDuration(arg0, arg1, arg2, arg3);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ActionFloat_initWithDuration : wrong number of arguments: %d, was expecting %d", argc, 4);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ActionFloat_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 4) {
|
|
double arg0 = 0;
|
|
double arg1 = 0;
|
|
double arg2 = 0;
|
|
std::function<void (float)> arg3;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
do {
|
|
if(JS_TypeOfValue(cx, args.get(3)) == JSTYPE_FUNCTION)
|
|
{
|
|
JS::RootedObject jstarget(cx, args.thisv().toObjectOrNull());
|
|
std::shared_ptr<JSFunctionWrapper> func(new JSFunctionWrapper(cx, jstarget, args.get(3), args.thisv()));
|
|
auto lambda = [=](float larg0) -> void {
|
|
JSB_AUTOCOMPARTMENT_WITH_GLOBAL_OBJCET
|
|
jsval largv[1];
|
|
largv[0] = DOUBLE_TO_JSVAL(larg0);
|
|
JS::RootedValue rval(cx);
|
|
bool succeed = func->invoke(1, &largv[0], &rval);
|
|
if (!succeed && JS_IsExceptionPending(cx)) {
|
|
JS_ReportPendingException(cx);
|
|
}
|
|
};
|
|
arg3 = lambda;
|
|
}
|
|
else
|
|
{
|
|
arg3 = nullptr;
|
|
}
|
|
} while(0)
|
|
;
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ActionFloat_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::ActionFloat::create(arg0, arg1, arg2, arg3);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::ActionFloat>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::ActionFloat"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_ActionFloat_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_ActionFloat_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::ActionFloat* cobj = new (std::nothrow) cocos2d::ActionFloat();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::ActionFloat>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::ActionFloat"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_ActionFloat_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::ActionFloat *nobj = new (std::nothrow) cocos2d::ActionFloat();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::ActionFloat");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_ActionInterval_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_ActionFloat(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_ActionFloat_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_ActionFloat_class->name = "ActionFloat";
|
|
jsb_cocos2d_ActionFloat_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_ActionFloat_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_ActionFloat_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_ActionFloat_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_ActionFloat_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_ActionFloat_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_ActionFloat_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_ActionFloat_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("initWithDuration", js_cocos2dx_ActionFloat_initWithDuration, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_ActionFloat_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_ActionFloat_create, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_ActionInterval_prototype);
|
|
jsb_cocos2d_ActionFloat_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_ActionFloat_class,
|
|
js_cocos2dx_ActionFloat_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_ActionFloat_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "ActionFloat"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::ActionFloat>(cx, jsb_cocos2d_ActionFloat_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.ActionFloat.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_Configuration_class;
|
|
JSObject *jsb_cocos2d_Configuration_prototype;
|
|
|
|
bool js_cocos2dx_Configuration_supportsPVRTC(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Configuration* cobj = (cocos2d::Configuration *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Configuration_supportsPVRTC : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->supportsPVRTC();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Configuration_supportsPVRTC : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Configuration_supportsOESDepth24(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Configuration* cobj = (cocos2d::Configuration *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Configuration_supportsOESDepth24 : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->supportsOESDepth24();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Configuration_supportsOESDepth24 : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Configuration_getMaxModelviewStackDepth(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Configuration* cobj = (cocos2d::Configuration *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Configuration_getMaxModelviewStackDepth : Invalid Native Object");
|
|
if (argc == 0) {
|
|
int ret = cobj->getMaxModelviewStackDepth();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = int32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Configuration_getMaxModelviewStackDepth : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Configuration_supportsShareableVAO(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Configuration* cobj = (cocos2d::Configuration *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Configuration_supportsShareableVAO : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->supportsShareableVAO();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Configuration_supportsShareableVAO : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Configuration_supportsBGRA8888(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Configuration* cobj = (cocos2d::Configuration *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Configuration_supportsBGRA8888 : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->supportsBGRA8888();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Configuration_supportsBGRA8888 : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Configuration_checkForGLExtension(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Configuration* cobj = (cocos2d::Configuration *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Configuration_checkForGLExtension : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Configuration_checkForGLExtension : Error processing arguments");
|
|
bool ret = cobj->checkForGLExtension(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Configuration_checkForGLExtension : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Configuration_supportsATITC(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Configuration* cobj = (cocos2d::Configuration *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Configuration_supportsATITC : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->supportsATITC();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Configuration_supportsATITC : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Configuration_supportsNPOT(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Configuration* cobj = (cocos2d::Configuration *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Configuration_supportsNPOT : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->supportsNPOT();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Configuration_supportsNPOT : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Configuration_init(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Configuration* cobj = (cocos2d::Configuration *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Configuration_init : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->init();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Configuration_init : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Configuration_getAnimate3DQuality(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Configuration* cobj = (cocos2d::Configuration *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Configuration_getAnimate3DQuality : Invalid Native Object");
|
|
if (argc == 0) {
|
|
int ret = (int)cobj->getAnimate3DQuality();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = int32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Configuration_getAnimate3DQuality : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Configuration_getMaxSupportPointLightInShader(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Configuration* cobj = (cocos2d::Configuration *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Configuration_getMaxSupportPointLightInShader : Invalid Native Object");
|
|
if (argc == 0) {
|
|
int ret = cobj->getMaxSupportPointLightInShader();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = int32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Configuration_getMaxSupportPointLightInShader : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Configuration_getMaxTextureSize(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Configuration* cobj = (cocos2d::Configuration *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Configuration_getMaxTextureSize : Invalid Native Object");
|
|
if (argc == 0) {
|
|
int ret = cobj->getMaxTextureSize();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = int32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Configuration_getMaxTextureSize : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Configuration_setValue(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Configuration* cobj = (cocos2d::Configuration *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Configuration_setValue : Invalid Native Object");
|
|
if (argc == 2) {
|
|
std::string arg0;
|
|
cocos2d::Value arg1;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
ok &= jsval_to_ccvalue(cx, args.get(1), &arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Configuration_setValue : Error processing arguments");
|
|
cobj->setValue(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Configuration_setValue : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Configuration_getMaxSupportSpotLightInShader(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Configuration* cobj = (cocos2d::Configuration *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Configuration_getMaxSupportSpotLightInShader : Invalid Native Object");
|
|
if (argc == 0) {
|
|
int ret = cobj->getMaxSupportSpotLightInShader();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = int32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Configuration_getMaxSupportSpotLightInShader : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Configuration_supportsETC(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Configuration* cobj = (cocos2d::Configuration *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Configuration_supportsETC : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->supportsETC();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Configuration_supportsETC : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Configuration_getMaxSupportDirLightInShader(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Configuration* cobj = (cocos2d::Configuration *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Configuration_getMaxSupportDirLightInShader : Invalid Native Object");
|
|
if (argc == 0) {
|
|
int ret = cobj->getMaxSupportDirLightInShader();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = int32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Configuration_getMaxSupportDirLightInShader : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Configuration_loadConfigFile(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Configuration* cobj = (cocos2d::Configuration *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Configuration_loadConfigFile : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Configuration_loadConfigFile : Error processing arguments");
|
|
cobj->loadConfigFile(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Configuration_loadConfigFile : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Configuration_supportsDiscardFramebuffer(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Configuration* cobj = (cocos2d::Configuration *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Configuration_supportsDiscardFramebuffer : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->supportsDiscardFramebuffer();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Configuration_supportsDiscardFramebuffer : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Configuration_supportsOESPackedDepthStencil(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Configuration* cobj = (cocos2d::Configuration *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Configuration_supportsOESPackedDepthStencil : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->supportsOESPackedDepthStencil();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Configuration_supportsOESPackedDepthStencil : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Configuration_supportsS3TC(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Configuration* cobj = (cocos2d::Configuration *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Configuration_supportsS3TC : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->supportsS3TC();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Configuration_supportsS3TC : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Configuration_getInfo(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Configuration* cobj = (cocos2d::Configuration *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Configuration_getInfo : Invalid Native Object");
|
|
if (argc == 0) {
|
|
std::string ret = cobj->getInfo();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = std_string_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Configuration_getInfo : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Configuration_getMaxTextureUnits(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Configuration* cobj = (cocos2d::Configuration *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Configuration_getMaxTextureUnits : Invalid Native Object");
|
|
if (argc == 0) {
|
|
int ret = cobj->getMaxTextureUnits();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = int32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Configuration_getMaxTextureUnits : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Configuration_getValue(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Configuration* cobj = (cocos2d::Configuration *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Configuration_getValue : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Configuration_getValue : Error processing arguments");
|
|
const cocos2d::Value& ret = cobj->getValue(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ccvalue_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
if (argc == 2) {
|
|
std::string arg0;
|
|
cocos2d::Value arg1;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
ok &= jsval_to_ccvalue(cx, args.get(1), &arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Configuration_getValue : Error processing arguments");
|
|
const cocos2d::Value& ret = cobj->getValue(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ccvalue_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Configuration_getValue : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Configuration_gatherGPUInfo(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Configuration* cobj = (cocos2d::Configuration *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Configuration_gatherGPUInfo : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->gatherGPUInfo();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Configuration_gatherGPUInfo : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Configuration_supportsMapBuffer(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Configuration* cobj = (cocos2d::Configuration *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Configuration_supportsMapBuffer : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->supportsMapBuffer();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Configuration_supportsMapBuffer : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Configuration_destroyInstance(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
if (argc == 0) {
|
|
cocos2d::Configuration::destroyInstance();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_Configuration_destroyInstance : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_Configuration_getInstance(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
if (argc == 0) {
|
|
|
|
auto ret = cocos2d::Configuration::getInstance();
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::Configuration>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_get_or_create_jsobject(cx, ret, typeClass, "cocos2d::Configuration"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_Configuration_getInstance : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
|
|
void js_register_cocos2dx_Configuration(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_Configuration_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_Configuration_class->name = "Configuration";
|
|
jsb_cocos2d_Configuration_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Configuration_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_Configuration_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Configuration_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_Configuration_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_Configuration_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_Configuration_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_Configuration_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("supportsPVRTC", js_cocos2dx_Configuration_supportsPVRTC, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("supportsOESDepth24", js_cocos2dx_Configuration_supportsOESDepth24, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getMaxModelviewStackDepth", js_cocos2dx_Configuration_getMaxModelviewStackDepth, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("supportsShareableVAO", js_cocos2dx_Configuration_supportsShareableVAO, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("supportsBGRA8888", js_cocos2dx_Configuration_supportsBGRA8888, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("checkForGLExtension", js_cocos2dx_Configuration_checkForGLExtension, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("supportsATITC", js_cocos2dx_Configuration_supportsATITC, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("supportsNPOT", js_cocos2dx_Configuration_supportsNPOT, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("init", js_cocos2dx_Configuration_init, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getAnimate3DQuality", js_cocos2dx_Configuration_getAnimate3DQuality, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getMaxSupportPointLightInShader", js_cocos2dx_Configuration_getMaxSupportPointLightInShader, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getMaxTextureSize", js_cocos2dx_Configuration_getMaxTextureSize, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setValue", js_cocos2dx_Configuration_setValue, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getMaxSupportSpotLightInShader", js_cocos2dx_Configuration_getMaxSupportSpotLightInShader, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("supportsETC", js_cocos2dx_Configuration_supportsETC, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getMaxSupportDirLightInShader", js_cocos2dx_Configuration_getMaxSupportDirLightInShader, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("loadConfigFile", js_cocos2dx_Configuration_loadConfigFile, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("supportsDiscardFramebuffer", js_cocos2dx_Configuration_supportsDiscardFramebuffer, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("supportsOESPackedDepthStencil", js_cocos2dx_Configuration_supportsOESPackedDepthStencil, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("supportsS3TC", js_cocos2dx_Configuration_supportsS3TC, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("dumpInfo", js_cocos2dx_Configuration_getInfo, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getMaxTextureUnits", js_cocos2dx_Configuration_getMaxTextureUnits, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getValue", js_cocos2dx_Configuration_getValue, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("gatherGPUInfo", js_cocos2dx_Configuration_gatherGPUInfo, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("supportsMapBuffer", js_cocos2dx_Configuration_supportsMapBuffer, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("destroyInstance", js_cocos2dx_Configuration_destroyInstance, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getInstance", js_cocos2dx_Configuration_getInstance, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
jsb_cocos2d_Configuration_prototype = JS_InitClass(
|
|
cx, global,
|
|
JS::NullPtr(),
|
|
jsb_cocos2d_Configuration_class,
|
|
empty_constructor, 0,
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_Configuration_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "Configuration"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::Configuration>(cx, jsb_cocos2d_Configuration_class, proto, JS::NullPtr());
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_Properties_class;
|
|
JSObject *jsb_cocos2d_Properties_prototype;
|
|
|
|
bool js_cocos2dx_Properties_getVariable(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Properties* cobj = (cocos2d::Properties *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Properties_getVariable : Invalid Native Object");
|
|
if (argc == 2) {
|
|
const char* arg0 = nullptr;
|
|
const char* arg1 = nullptr;
|
|
std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str();
|
|
std::string arg1_tmp; ok &= jsval_to_std_string(cx, args.get(1), &arg1_tmp); arg1 = arg1_tmp.c_str();
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Properties_getVariable : Error processing arguments");
|
|
const char* ret = cobj->getVariable(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = c_string_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Properties_getVariable : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Properties_getString(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Properties* cobj = (cocos2d::Properties *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Properties_getString : Invalid Native Object");
|
|
if (argc == 2) {
|
|
const char* arg0 = nullptr;
|
|
const char* arg1 = nullptr;
|
|
std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str();
|
|
std::string arg1_tmp; ok &= jsval_to_std_string(cx, args.get(1), &arg1_tmp); arg1 = arg1_tmp.c_str();
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Properties_getString : Error processing arguments");
|
|
const char* ret = cobj->getString(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = c_string_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Properties_getString : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Properties_getLong(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Properties* cobj = (cocos2d::Properties *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Properties_getLong : Invalid Native Object");
|
|
if (argc == 1) {
|
|
const char* arg0 = nullptr;
|
|
std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str();
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Properties_getLong : Error processing arguments");
|
|
long ret = cobj->getLong(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = long_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Properties_getLong : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Properties_getNamespace(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::Properties* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::Properties *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Properties_getNamespace : Invalid Native Object");
|
|
do {
|
|
if (argc == 0) {
|
|
const char* ret = cobj->getNamespace();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = c_string_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 1) {
|
|
const char* arg0 = nullptr;
|
|
std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str();
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Properties* ret = cobj->getNamespace(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Properties>(cx, (cocos2d::Properties*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 2) {
|
|
const char* arg0 = nullptr;
|
|
std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str();
|
|
if (!ok) { ok = true; break; }
|
|
bool arg1;
|
|
arg1 = JS::ToBoolean(args.get(1));
|
|
cocos2d::Properties* ret = cobj->getNamespace(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Properties>(cx, (cocos2d::Properties*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 3) {
|
|
const char* arg0 = nullptr;
|
|
std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str();
|
|
if (!ok) { ok = true; break; }
|
|
bool arg1;
|
|
arg1 = JS::ToBoolean(args.get(1));
|
|
bool arg2;
|
|
arg2 = JS::ToBoolean(args.get(2));
|
|
cocos2d::Properties* ret = cobj->getNamespace(arg0, arg1, arg2);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Properties>(cx, (cocos2d::Properties*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Properties_getNamespace : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Properties_getPath(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Properties* cobj = (cocos2d::Properties *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Properties_getPath : Invalid Native Object");
|
|
if (argc == 2) {
|
|
const char* arg0 = nullptr;
|
|
std::string* arg1 = nullptr;
|
|
std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str();
|
|
#pragma warning NO CONVERSION TO NATIVE FOR std::string*
|
|
ok = false;
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Properties_getPath : Error processing arguments");
|
|
bool ret = cobj->getPath(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Properties_getPath : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Properties_getMat4(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Properties* cobj = (cocos2d::Properties *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Properties_getMat4 : Invalid Native Object");
|
|
if (argc == 2) {
|
|
const char* arg0 = nullptr;
|
|
cocos2d::Mat4* arg1 = nullptr;
|
|
std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str();
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::Mat4*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Properties_getMat4 : Error processing arguments");
|
|
bool ret = cobj->getMat4(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Properties_getMat4 : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Properties_exists(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Properties* cobj = (cocos2d::Properties *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Properties_exists : Invalid Native Object");
|
|
if (argc == 1) {
|
|
const char* arg0 = nullptr;
|
|
std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str();
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Properties_exists : Error processing arguments");
|
|
bool ret = cobj->exists(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Properties_exists : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Properties_setString(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Properties* cobj = (cocos2d::Properties *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Properties_setString : Invalid Native Object");
|
|
if (argc == 2) {
|
|
const char* arg0 = nullptr;
|
|
const char* arg1 = nullptr;
|
|
std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str();
|
|
std::string arg1_tmp; ok &= jsval_to_std_string(cx, args.get(1), &arg1_tmp); arg1 = arg1_tmp.c_str();
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Properties_setString : Error processing arguments");
|
|
bool ret = cobj->setString(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Properties_setString : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Properties_getId(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Properties* cobj = (cocos2d::Properties *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Properties_getId : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const char* ret = cobj->getId();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = c_string_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Properties_getId : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Properties_rewind(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Properties* cobj = (cocos2d::Properties *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Properties_rewind : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->rewind();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Properties_rewind : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Properties_setVariable(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Properties* cobj = (cocos2d::Properties *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Properties_setVariable : Invalid Native Object");
|
|
if (argc == 2) {
|
|
const char* arg0 = nullptr;
|
|
const char* arg1 = nullptr;
|
|
std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str();
|
|
std::string arg1_tmp; ok &= jsval_to_std_string(cx, args.get(1), &arg1_tmp); arg1 = arg1_tmp.c_str();
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Properties_setVariable : Error processing arguments");
|
|
cobj->setVariable(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Properties_setVariable : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Properties_getBool(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Properties* cobj = (cocos2d::Properties *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Properties_getBool : Invalid Native Object");
|
|
if (argc == 1) {
|
|
const char* arg0 = nullptr;
|
|
std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str();
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Properties_getBool : Error processing arguments");
|
|
bool ret = cobj->getBool(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
if (argc == 2) {
|
|
const char* arg0 = nullptr;
|
|
bool arg1;
|
|
std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str();
|
|
arg1 = JS::ToBoolean(args.get(1));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Properties_getBool : Error processing arguments");
|
|
bool ret = cobj->getBool(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Properties_getBool : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Properties_getColor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::Properties* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::Properties *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Properties_getColor : Invalid Native Object");
|
|
do {
|
|
if (argc == 2) {
|
|
const char* arg0 = nullptr;
|
|
std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str();
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Vec4* arg1 = nullptr;
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::Vec4*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
if (!ok) { ok = true; break; }
|
|
bool ret = cobj->getColor(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 2) {
|
|
const char* arg0 = nullptr;
|
|
std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str();
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Vec3* arg1 = nullptr;
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::Vec3*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
if (!ok) { ok = true; break; }
|
|
bool ret = cobj->getColor(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Properties_getColor : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Properties_getType(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Properties* cobj = (cocos2d::Properties *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Properties_getType : Invalid Native Object");
|
|
if (argc == 1) {
|
|
const char* arg0 = nullptr;
|
|
std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str();
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Properties_getType : Error processing arguments");
|
|
int ret = (int)cobj->getType(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = int32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Properties_getType : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Properties_getNextNamespace(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Properties* cobj = (cocos2d::Properties *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Properties_getNextNamespace : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::Properties* ret = cobj->getNextNamespace();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Properties>(cx, (cocos2d::Properties*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Properties_getNextNamespace : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Properties_getInt(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Properties* cobj = (cocos2d::Properties *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Properties_getInt : Invalid Native Object");
|
|
if (argc == 1) {
|
|
const char* arg0 = nullptr;
|
|
std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str();
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Properties_getInt : Error processing arguments");
|
|
int ret = cobj->getInt(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = int32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Properties_getInt : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Properties_getVec3(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Properties* cobj = (cocos2d::Properties *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Properties_getVec3 : Invalid Native Object");
|
|
if (argc == 2) {
|
|
const char* arg0 = nullptr;
|
|
cocos2d::Vec3* arg1 = nullptr;
|
|
std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str();
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::Vec3*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Properties_getVec3 : Error processing arguments");
|
|
bool ret = cobj->getVec3(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Properties_getVec3 : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Properties_getVec2(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Properties* cobj = (cocos2d::Properties *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Properties_getVec2 : Invalid Native Object");
|
|
if (argc == 2) {
|
|
const char* arg0 = nullptr;
|
|
cocos2d::Vec2* arg1 = nullptr;
|
|
std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str();
|
|
std::vector<cocos2d::Vec2> tempData;ok &= jsval_to_vector_vec2(cx, args.get(1), &tempData);arg1=tempData.data();
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Properties_getVec2 : Error processing arguments");
|
|
bool ret = cobj->getVec2(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Properties_getVec2 : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Properties_getVec4(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Properties* cobj = (cocos2d::Properties *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Properties_getVec4 : Invalid Native Object");
|
|
if (argc == 2) {
|
|
const char* arg0 = nullptr;
|
|
cocos2d::Vec4* arg1 = nullptr;
|
|
std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str();
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::Vec4*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Properties_getVec4 : Error processing arguments");
|
|
bool ret = cobj->getVec4(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Properties_getVec4 : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Properties_getNextProperty(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Properties* cobj = (cocos2d::Properties *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Properties_getNextProperty : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const char* ret = cobj->getNextProperty();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = c_string_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Properties_getNextProperty : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Properties_getFloat(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Properties* cobj = (cocos2d::Properties *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Properties_getFloat : Invalid Native Object");
|
|
if (argc == 1) {
|
|
const char* arg0 = nullptr;
|
|
std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str();
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Properties_getFloat : Error processing arguments");
|
|
double ret = cobj->getFloat(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Properties_getFloat : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Properties_getQuaternionFromAxisAngle(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Properties* cobj = (cocos2d::Properties *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Properties_getQuaternionFromAxisAngle : Invalid Native Object");
|
|
if (argc == 2) {
|
|
const char* arg0 = nullptr;
|
|
cocos2d::Quaternion* arg1 = nullptr;
|
|
std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str();
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::Quaternion*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Properties_getQuaternionFromAxisAngle : Error processing arguments");
|
|
bool ret = cobj->getQuaternionFromAxisAngle(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Properties_getQuaternionFromAxisAngle : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Properties_parseColor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
|
|
do {
|
|
if (argc == 2) {
|
|
const char* arg0 = nullptr;
|
|
std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str();
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Vec4* arg1 = nullptr;
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::Vec4*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
if (!ok) { ok = true; break; }
|
|
bool ret = cocos2d::Properties::parseColor(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
|
|
do {
|
|
if (argc == 2) {
|
|
const char* arg0 = nullptr;
|
|
std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str();
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Vec3* arg1 = nullptr;
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::Vec3*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
if (!ok) { ok = true; break; }
|
|
bool ret = cocos2d::Properties::parseColor(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
JS_ReportError(cx, "js_cocos2dx_Properties_parseColor : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Properties_parseVec3(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 2) {
|
|
const char* arg0 = nullptr;
|
|
cocos2d::Vec3* arg1 = nullptr;
|
|
std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str();
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::Vec3*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Properties_parseVec3 : Error processing arguments");
|
|
|
|
bool ret = cocos2d::Properties::parseVec3(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_Properties_parseVec3 : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_Properties_parseAxisAngle(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 2) {
|
|
const char* arg0 = nullptr;
|
|
cocos2d::Quaternion* arg1 = nullptr;
|
|
std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str();
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::Quaternion*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Properties_parseAxisAngle : Error processing arguments");
|
|
|
|
bool ret = cocos2d::Properties::parseAxisAngle(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_Properties_parseAxisAngle : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_Properties_parseVec2(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 2) {
|
|
const char* arg0 = nullptr;
|
|
cocos2d::Vec2* arg1 = nullptr;
|
|
std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str();
|
|
std::vector<cocos2d::Vec2> tempData;ok &= jsval_to_vector_vec2(cx, args.get(1), &tempData);arg1=tempData.data();
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Properties_parseVec2 : Error processing arguments");
|
|
|
|
bool ret = cocos2d::Properties::parseVec2(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_Properties_parseVec2 : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_Properties_createNonRefCounted(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Properties_createNonRefCounted : Error processing arguments");
|
|
|
|
cocos2d::Properties* ret = cocos2d::Properties::createNonRefCounted(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Properties>(cx, (cocos2d::Properties*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_Properties_createNonRefCounted : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_Properties_parseVec4(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 2) {
|
|
const char* arg0 = nullptr;
|
|
cocos2d::Vec4* arg1 = nullptr;
|
|
std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str();
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::Vec4*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Properties_parseVec4 : Error processing arguments");
|
|
|
|
bool ret = cocos2d::Properties::parseVec4(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_Properties_parseVec4 : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
|
|
void js_register_cocos2dx_Properties(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_Properties_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_Properties_class->name = "Properties";
|
|
jsb_cocos2d_Properties_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Properties_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_Properties_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Properties_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_Properties_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_Properties_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_Properties_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_Properties_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("getVariable", js_cocos2dx_Properties_getVariable, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getString", js_cocos2dx_Properties_getString, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getLong", js_cocos2dx_Properties_getLong, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getNamespace", js_cocos2dx_Properties_getNamespace, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getPath", js_cocos2dx_Properties_getPath, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getMat4", js_cocos2dx_Properties_getMat4, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("exists", js_cocos2dx_Properties_exists, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setString", js_cocos2dx_Properties_setString, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getId", js_cocos2dx_Properties_getId, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("rewind", js_cocos2dx_Properties_rewind, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setVariable", js_cocos2dx_Properties_setVariable, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getBool", js_cocos2dx_Properties_getBool, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getColor", js_cocos2dx_Properties_getColor, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getType", js_cocos2dx_Properties_getType, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getNextNamespace", js_cocos2dx_Properties_getNextNamespace, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getInt", js_cocos2dx_Properties_getInt, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getVec3", js_cocos2dx_Properties_getVec3, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getVec2", js_cocos2dx_Properties_getVec2, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getVec4", js_cocos2dx_Properties_getVec4, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getNextProperty", js_cocos2dx_Properties_getNextProperty, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getFloat", js_cocos2dx_Properties_getFloat, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getQuaternionFromAxisAngle", js_cocos2dx_Properties_getQuaternionFromAxisAngle, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("parseColor", js_cocos2dx_Properties_parseColor, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("parseVec3", js_cocos2dx_Properties_parseVec3, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("parseAxisAngle", js_cocos2dx_Properties_parseAxisAngle, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("parseVec2", js_cocos2dx_Properties_parseVec2, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("createNonRefCounted", js_cocos2dx_Properties_createNonRefCounted, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("parseVec4", js_cocos2dx_Properties_parseVec4, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
jsb_cocos2d_Properties_prototype = JS_InitClass(
|
|
cx, global,
|
|
JS::NullPtr(),
|
|
jsb_cocos2d_Properties_class,
|
|
dummy_constructor<cocos2d::Properties>, 0, // no constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_Properties_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "Properties"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::FalseHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::Properties>(cx, jsb_cocos2d_Properties_class, proto, JS::NullPtr());
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_FileUtils_class;
|
|
JSObject *jsb_cocos2d_FileUtils_prototype;
|
|
|
|
bool js_cocos2dx_FileUtils_fullPathForFilename(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::FileUtils* cobj = (cocos2d::FileUtils *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FileUtils_fullPathForFilename : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FileUtils_fullPathForFilename : Error processing arguments");
|
|
std::string ret = cobj->fullPathForFilename(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = std_string_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_FileUtils_fullPathForFilename : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_FileUtils_getStringFromFile(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::FileUtils* cobj = (cocos2d::FileUtils *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FileUtils_getStringFromFile : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FileUtils_getStringFromFile : Error processing arguments");
|
|
std::string ret = cobj->getStringFromFile(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = std_string_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_FileUtils_getStringFromFile : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_FileUtils_removeFile(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::FileUtils* cobj = (cocos2d::FileUtils *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FileUtils_removeFile : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FileUtils_removeFile : Error processing arguments");
|
|
bool ret = cobj->removeFile(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_FileUtils_removeFile : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_FileUtils_isAbsolutePath(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::FileUtils* cobj = (cocos2d::FileUtils *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FileUtils_isAbsolutePath : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FileUtils_isAbsolutePath : Error processing arguments");
|
|
bool ret = cobj->isAbsolutePath(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_FileUtils_isAbsolutePath : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_FileUtils_renameFile(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::FileUtils* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::FileUtils *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FileUtils_renameFile : Invalid Native Object");
|
|
do {
|
|
if (argc == 2) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
std::string arg1;
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
bool ret = cobj->renameFile(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 3) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
std::string arg1;
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
std::string arg2;
|
|
ok &= jsval_to_std_string(cx, args.get(2), &arg2);
|
|
if (!ok) { ok = true; break; }
|
|
bool ret = cobj->renameFile(arg0, arg1, arg2);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_FileUtils_renameFile : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_FileUtils_loadFilenameLookupDictionaryFromFile(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::FileUtils* cobj = (cocos2d::FileUtils *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FileUtils_loadFilenameLookupDictionaryFromFile : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FileUtils_loadFilenameLookupDictionaryFromFile : Error processing arguments");
|
|
cobj->loadFilenameLookupDictionaryFromFile(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_FileUtils_loadFilenameLookupDictionaryFromFile : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_FileUtils_isPopupNotify(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::FileUtils* cobj = (cocos2d::FileUtils *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FileUtils_isPopupNotify : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->isPopupNotify();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_FileUtils_isPopupNotify : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_FileUtils_getValueVectorFromFile(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::FileUtils* cobj = (cocos2d::FileUtils *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FileUtils_getValueVectorFromFile : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FileUtils_getValueVectorFromFile : Error processing arguments");
|
|
cocos2d::ValueVector ret = cobj->getValueVectorFromFile(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ccvaluevector_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_FileUtils_getValueVectorFromFile : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_FileUtils_getSearchPaths(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::FileUtils* cobj = (cocos2d::FileUtils *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FileUtils_getSearchPaths : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const std::vector<std::string>& ret = cobj->getSearchPaths();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = std_vector_string_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_FileUtils_getSearchPaths : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_FileUtils_writeToFile(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::FileUtils* cobj = (cocos2d::FileUtils *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FileUtils_writeToFile : Invalid Native Object");
|
|
if (argc == 2) {
|
|
cocos2d::ValueMap arg0;
|
|
std::string arg1;
|
|
ok &= jsval_to_ccvaluemap(cx, args.get(0), &arg0);
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FileUtils_writeToFile : Error processing arguments");
|
|
bool ret = cobj->writeToFile(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_FileUtils_writeToFile : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_FileUtils_getValueMapFromFile(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::FileUtils* cobj = (cocos2d::FileUtils *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FileUtils_getValueMapFromFile : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FileUtils_getValueMapFromFile : Error processing arguments");
|
|
cocos2d::ValueMap ret = cobj->getValueMapFromFile(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ccvaluemap_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_FileUtils_getValueMapFromFile : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_FileUtils_getFileSize(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::FileUtils* cobj = (cocos2d::FileUtils *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FileUtils_getFileSize : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FileUtils_getFileSize : Error processing arguments");
|
|
long ret = cobj->getFileSize(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = long_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_FileUtils_getFileSize : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_FileUtils_getValueMapFromData(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::FileUtils* cobj = (cocos2d::FileUtils *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FileUtils_getValueMapFromData : Invalid Native Object");
|
|
if (argc == 2) {
|
|
const char* arg0 = nullptr;
|
|
int arg1 = 0;
|
|
std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str();
|
|
ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FileUtils_getValueMapFromData : Error processing arguments");
|
|
cocos2d::ValueMap ret = cobj->getValueMapFromData(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ccvaluemap_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_FileUtils_getValueMapFromData : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_FileUtils_removeDirectory(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::FileUtils* cobj = (cocos2d::FileUtils *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FileUtils_removeDirectory : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FileUtils_removeDirectory : Error processing arguments");
|
|
bool ret = cobj->removeDirectory(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_FileUtils_removeDirectory : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_FileUtils_setSearchPaths(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::FileUtils* cobj = (cocos2d::FileUtils *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FileUtils_setSearchPaths : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::vector<std::string> arg0;
|
|
ok &= jsval_to_std_vector_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FileUtils_setSearchPaths : Error processing arguments");
|
|
cobj->setSearchPaths(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_FileUtils_setSearchPaths : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_FileUtils_writeStringToFile(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::FileUtils* cobj = (cocos2d::FileUtils *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FileUtils_writeStringToFile : Invalid Native Object");
|
|
if (argc == 2) {
|
|
std::string arg0;
|
|
std::string arg1;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FileUtils_writeStringToFile : Error processing arguments");
|
|
bool ret = cobj->writeStringToFile(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_FileUtils_writeStringToFile : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_FileUtils_setSearchResolutionsOrder(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::FileUtils* cobj = (cocos2d::FileUtils *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FileUtils_setSearchResolutionsOrder : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::vector<std::string> arg0;
|
|
ok &= jsval_to_std_vector_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FileUtils_setSearchResolutionsOrder : Error processing arguments");
|
|
cobj->setSearchResolutionsOrder(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_FileUtils_setSearchResolutionsOrder : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_FileUtils_addSearchResolutionsOrder(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::FileUtils* cobj = (cocos2d::FileUtils *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FileUtils_addSearchResolutionsOrder : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FileUtils_addSearchResolutionsOrder : Error processing arguments");
|
|
cobj->addSearchResolutionsOrder(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
if (argc == 2) {
|
|
std::string arg0;
|
|
bool arg1;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
arg1 = JS::ToBoolean(args.get(1));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FileUtils_addSearchResolutionsOrder : Error processing arguments");
|
|
cobj->addSearchResolutionsOrder(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_FileUtils_addSearchResolutionsOrder : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_FileUtils_addSearchPath(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::FileUtils* cobj = (cocos2d::FileUtils *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FileUtils_addSearchPath : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FileUtils_addSearchPath : Error processing arguments");
|
|
cobj->addSearchPath(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
if (argc == 2) {
|
|
std::string arg0;
|
|
bool arg1;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
arg1 = JS::ToBoolean(args.get(1));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FileUtils_addSearchPath : Error processing arguments");
|
|
cobj->addSearchPath(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_FileUtils_addSearchPath : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_FileUtils_writeValueVectorToFile(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::FileUtils* cobj = (cocos2d::FileUtils *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FileUtils_writeValueVectorToFile : Invalid Native Object");
|
|
if (argc == 2) {
|
|
cocos2d::ValueVector arg0;
|
|
std::string arg1;
|
|
ok &= jsval_to_ccvaluevector(cx, args.get(0), &arg0);
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FileUtils_writeValueVectorToFile : Error processing arguments");
|
|
bool ret = cobj->writeValueVectorToFile(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_FileUtils_writeValueVectorToFile : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_FileUtils_isFileExist(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::FileUtils* cobj = (cocos2d::FileUtils *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FileUtils_isFileExist : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FileUtils_isFileExist : Error processing arguments");
|
|
bool ret = cobj->isFileExist(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_FileUtils_isFileExist : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_FileUtils_purgeCachedEntries(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::FileUtils* cobj = (cocos2d::FileUtils *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FileUtils_purgeCachedEntries : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->purgeCachedEntries();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_FileUtils_purgeCachedEntries : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_FileUtils_fullPathFromRelativeFile(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::FileUtils* cobj = (cocos2d::FileUtils *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FileUtils_fullPathFromRelativeFile : Invalid Native Object");
|
|
if (argc == 2) {
|
|
std::string arg0;
|
|
std::string arg1;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FileUtils_fullPathFromRelativeFile : Error processing arguments");
|
|
std::string ret = cobj->fullPathFromRelativeFile(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = std_string_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_FileUtils_fullPathFromRelativeFile : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_FileUtils_getSuitableFOpen(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::FileUtils* cobj = (cocos2d::FileUtils *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FileUtils_getSuitableFOpen : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FileUtils_getSuitableFOpen : Error processing arguments");
|
|
std::string ret = cobj->getSuitableFOpen(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = std_string_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_FileUtils_getSuitableFOpen : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_FileUtils_writeValueMapToFile(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::FileUtils* cobj = (cocos2d::FileUtils *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FileUtils_writeValueMapToFile : Invalid Native Object");
|
|
if (argc == 2) {
|
|
cocos2d::ValueMap arg0;
|
|
std::string arg1;
|
|
ok &= jsval_to_ccvaluemap(cx, args.get(0), &arg0);
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FileUtils_writeValueMapToFile : Error processing arguments");
|
|
bool ret = cobj->writeValueMapToFile(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_FileUtils_writeValueMapToFile : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_FileUtils_getFileExtension(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::FileUtils* cobj = (cocos2d::FileUtils *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FileUtils_getFileExtension : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FileUtils_getFileExtension : Error processing arguments");
|
|
std::string ret = cobj->getFileExtension(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = std_string_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_FileUtils_getFileExtension : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_FileUtils_setWritablePath(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::FileUtils* cobj = (cocos2d::FileUtils *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FileUtils_setWritablePath : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FileUtils_setWritablePath : Error processing arguments");
|
|
cobj->setWritablePath(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_FileUtils_setWritablePath : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_FileUtils_setPopupNotify(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::FileUtils* cobj = (cocos2d::FileUtils *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FileUtils_setPopupNotify : Invalid Native Object");
|
|
if (argc == 1) {
|
|
bool arg0;
|
|
arg0 = JS::ToBoolean(args.get(0));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FileUtils_setPopupNotify : Error processing arguments");
|
|
cobj->setPopupNotify(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_FileUtils_setPopupNotify : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_FileUtils_isDirectoryExist(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::FileUtils* cobj = (cocos2d::FileUtils *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FileUtils_isDirectoryExist : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FileUtils_isDirectoryExist : Error processing arguments");
|
|
bool ret = cobj->isDirectoryExist(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_FileUtils_isDirectoryExist : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_FileUtils_setDefaultResourceRootPath(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::FileUtils* cobj = (cocos2d::FileUtils *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FileUtils_setDefaultResourceRootPath : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FileUtils_setDefaultResourceRootPath : Error processing arguments");
|
|
cobj->setDefaultResourceRootPath(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_FileUtils_setDefaultResourceRootPath : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_FileUtils_getSearchResolutionsOrder(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::FileUtils* cobj = (cocos2d::FileUtils *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FileUtils_getSearchResolutionsOrder : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const std::vector<std::string>& ret = cobj->getSearchResolutionsOrder();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = std_vector_string_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_FileUtils_getSearchResolutionsOrder : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_FileUtils_createDirectory(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::FileUtils* cobj = (cocos2d::FileUtils *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FileUtils_createDirectory : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FileUtils_createDirectory : Error processing arguments");
|
|
bool ret = cobj->createDirectory(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_FileUtils_createDirectory : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_FileUtils_getWritablePath(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::FileUtils* cobj = (cocos2d::FileUtils *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FileUtils_getWritablePath : Invalid Native Object");
|
|
if (argc == 0) {
|
|
std::string ret = cobj->getWritablePath();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = std_string_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_FileUtils_getWritablePath : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_FileUtils_setDelegate(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
cocos2d::FileUtils* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::FileUtils*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FileUtils_setDelegate : Error processing arguments");
|
|
cocos2d::FileUtils::setDelegate(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_FileUtils_setDelegate : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_FileUtils_getInstance(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
if (argc == 0) {
|
|
|
|
cocos2d::FileUtils* ret = cocos2d::FileUtils::getInstance();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::FileUtils>(cx, (cocos2d::FileUtils*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_FileUtils_getInstance : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
|
|
void js_register_cocos2dx_FileUtils(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_FileUtils_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_FileUtils_class->name = "FileUtils";
|
|
jsb_cocos2d_FileUtils_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_FileUtils_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_FileUtils_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_FileUtils_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_FileUtils_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_FileUtils_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_FileUtils_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_FileUtils_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("fullPathForFilename", js_cocos2dx_FileUtils_fullPathForFilename, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getStringFromFile", js_cocos2dx_FileUtils_getStringFromFile, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("removeFile", js_cocos2dx_FileUtils_removeFile, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("isAbsolutePath", js_cocos2dx_FileUtils_isAbsolutePath, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("renameFile", js_cocos2dx_FileUtils_renameFile, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("loadFilenameLookup", js_cocos2dx_FileUtils_loadFilenameLookupDictionaryFromFile, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("isPopupNotify", js_cocos2dx_FileUtils_isPopupNotify, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getValueVectorFromFile", js_cocos2dx_FileUtils_getValueVectorFromFile, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getSearchPaths", js_cocos2dx_FileUtils_getSearchPaths, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("writeToFile", js_cocos2dx_FileUtils_writeToFile, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getValueMapFromFile", js_cocos2dx_FileUtils_getValueMapFromFile, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getFileSize", js_cocos2dx_FileUtils_getFileSize, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getValueMapFromData", js_cocos2dx_FileUtils_getValueMapFromData, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("removeDirectory", js_cocos2dx_FileUtils_removeDirectory, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setSearchPaths", js_cocos2dx_FileUtils_setSearchPaths, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("writeStringToFile", js_cocos2dx_FileUtils_writeStringToFile, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setSearchResolutionsOrder", js_cocos2dx_FileUtils_setSearchResolutionsOrder, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("addSearchResolutionsOrder", js_cocos2dx_FileUtils_addSearchResolutionsOrder, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("addSearchPath", js_cocos2dx_FileUtils_addSearchPath, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("writeValueVectorToFile", js_cocos2dx_FileUtils_writeValueVectorToFile, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("isFileExist", js_cocos2dx_FileUtils_isFileExist, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("purgeCachedEntries", js_cocos2dx_FileUtils_purgeCachedEntries, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("fullPathFromRelativeFile", js_cocos2dx_FileUtils_fullPathFromRelativeFile, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getSuitableFOpen", js_cocos2dx_FileUtils_getSuitableFOpen, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("writeValueMapToFile", js_cocos2dx_FileUtils_writeValueMapToFile, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getFileExtension", js_cocos2dx_FileUtils_getFileExtension, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setWritablePath", js_cocos2dx_FileUtils_setWritablePath, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setPopupNotify", js_cocos2dx_FileUtils_setPopupNotify, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("isDirectoryExist", js_cocos2dx_FileUtils_isDirectoryExist, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setDefaultResourceRootPath", js_cocos2dx_FileUtils_setDefaultResourceRootPath, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getSearchResolutionsOrder", js_cocos2dx_FileUtils_getSearchResolutionsOrder, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("createDirectory", js_cocos2dx_FileUtils_createDirectory, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getWritablePath", js_cocos2dx_FileUtils_getWritablePath, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("setDelegate", js_cocos2dx_FileUtils_setDelegate, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getInstance", js_cocos2dx_FileUtils_getInstance, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
jsb_cocos2d_FileUtils_prototype = JS_InitClass(
|
|
cx, global,
|
|
JS::NullPtr(),
|
|
jsb_cocos2d_FileUtils_class,
|
|
empty_constructor, 0,
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_FileUtils_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "FileUtils"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::FalseHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::FileUtils>(cx, jsb_cocos2d_FileUtils_class, proto, JS::NullPtr());
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_EventAcceleration_class;
|
|
JSObject *jsb_cocos2d_EventAcceleration_prototype;
|
|
|
|
bool js_cocos2dx_EventAcceleration_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::Acceleration arg0;
|
|
ok &= jsval_to_ccacceleration(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EventAcceleration_constructor : Error processing arguments");
|
|
cocos2d::EventAcceleration* cobj = new (std::nothrow) cocos2d::EventAcceleration(arg0);
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EventAcceleration>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::EventAcceleration"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_Event_prototype;
|
|
|
|
void js_register_cocos2dx_EventAcceleration(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_EventAcceleration_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_EventAcceleration_class->name = "EventAcceleration";
|
|
jsb_cocos2d_EventAcceleration_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EventAcceleration_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_EventAcceleration_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EventAcceleration_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_EventAcceleration_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_EventAcceleration_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_EventAcceleration_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_EventAcceleration_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FS_END
|
|
};
|
|
|
|
JSFunctionSpec *st_funcs = NULL;
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_Event_prototype);
|
|
jsb_cocos2d_EventAcceleration_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_EventAcceleration_class,
|
|
js_cocos2dx_EventAcceleration_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_EventAcceleration_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "EventAcceleration"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::EventAcceleration>(cx, jsb_cocos2d_EventAcceleration_class, proto, parent_proto);
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_EventCustom_class;
|
|
JSObject *jsb_cocos2d_EventCustom_prototype;
|
|
|
|
bool js_cocos2dx_EventCustom_getEventName(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::EventCustom* cobj = (cocos2d::EventCustom *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventCustom_getEventName : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const std::string& ret = cobj->getEventName();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = std_string_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_EventCustom_getEventName : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_EventCustom_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EventCustom_constructor : Error processing arguments");
|
|
cocos2d::EventCustom* cobj = new (std::nothrow) cocos2d::EventCustom(arg0);
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EventCustom>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::EventCustom"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_Event_prototype;
|
|
|
|
void js_register_cocos2dx_EventCustom(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_EventCustom_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_EventCustom_class->name = "EventCustom";
|
|
jsb_cocos2d_EventCustom_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EventCustom_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_EventCustom_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EventCustom_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_EventCustom_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_EventCustom_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_EventCustom_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_EventCustom_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("getEventName", js_cocos2dx_EventCustom_getEventName, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JSFunctionSpec *st_funcs = NULL;
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_Event_prototype);
|
|
jsb_cocos2d_EventCustom_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_EventCustom_class,
|
|
js_cocos2dx_EventCustom_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_EventCustom_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "EventCustom"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::EventCustom>(cx, jsb_cocos2d_EventCustom_class, proto, parent_proto);
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_EventListener_class;
|
|
JSObject *jsb_cocos2d_EventListener_prototype;
|
|
|
|
bool js_cocos2dx_EventListener_setEnabled(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::EventListener* cobj = (cocos2d::EventListener *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventListener_setEnabled : Invalid Native Object");
|
|
if (argc == 1) {
|
|
bool arg0;
|
|
arg0 = JS::ToBoolean(args.get(0));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EventListener_setEnabled : Error processing arguments");
|
|
cobj->setEnabled(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_EventListener_setEnabled : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_EventListener_isEnabled(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::EventListener* cobj = (cocos2d::EventListener *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventListener_isEnabled : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->isEnabled();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_EventListener_isEnabled : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_EventListener_clone(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::EventListener* cobj = (cocos2d::EventListener *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventListener_clone : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::EventListener* ret = cobj->clone();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::EventListener>(cx, (cocos2d::EventListener*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_EventListener_clone : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_EventListener_checkAvailable(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::EventListener* cobj = (cocos2d::EventListener *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventListener_checkAvailable : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->checkAvailable();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_EventListener_checkAvailable : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
|
|
void js_register_cocos2dx_EventListener(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_EventListener_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_EventListener_class->name = "EventListener";
|
|
jsb_cocos2d_EventListener_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EventListener_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_EventListener_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EventListener_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_EventListener_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_EventListener_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_EventListener_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_EventListener_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("setEnabled", js_cocos2dx_EventListener_setEnabled, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("isEnabled", js_cocos2dx_EventListener_isEnabled, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("clone", js_cocos2dx_EventListener_clone, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("checkAvailable", js_cocos2dx_EventListener_checkAvailable, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JSFunctionSpec *st_funcs = NULL;
|
|
|
|
jsb_cocos2d_EventListener_prototype = JS_InitClass(
|
|
cx, global,
|
|
JS::NullPtr(),
|
|
jsb_cocos2d_EventListener_class,
|
|
empty_constructor, 0,
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_EventListener_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "EventListener"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::EventListener>(cx, jsb_cocos2d_EventListener_class, proto, JS::NullPtr());
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_EventDispatcher_class;
|
|
JSObject *jsb_cocos2d_EventDispatcher_prototype;
|
|
|
|
bool js_cocos2dx_EventDispatcher_setEnabled(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::EventDispatcher* cobj = (cocos2d::EventDispatcher *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventDispatcher_setEnabled : Invalid Native Object");
|
|
if (argc == 1) {
|
|
bool arg0;
|
|
arg0 = JS::ToBoolean(args.get(0));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EventDispatcher_setEnabled : Error processing arguments");
|
|
cobj->setEnabled(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_EventDispatcher_setEnabled : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_EventDispatcher_removeAllEventListeners(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::EventDispatcher* cobj = (cocos2d::EventDispatcher *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventDispatcher_removeAllEventListeners : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->removeAllEventListeners();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_EventDispatcher_removeAllEventListeners : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_EventDispatcher_addEventListenerWithSceneGraphPriority(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::EventDispatcher* cobj = (cocos2d::EventDispatcher *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventDispatcher_addEventListenerWithSceneGraphPriority : Invalid Native Object");
|
|
if (argc == 2) {
|
|
cocos2d::EventListener* arg0 = nullptr;
|
|
cocos2d::Node* arg1 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::EventListener*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EventDispatcher_addEventListenerWithSceneGraphPriority : Error processing arguments");
|
|
cobj->addEventListenerWithSceneGraphPriority(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_EventDispatcher_addEventListenerWithSceneGraphPriority : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_EventDispatcher_addCustomEventListener(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::EventDispatcher* cobj = (cocos2d::EventDispatcher *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventDispatcher_addCustomEventListener : Invalid Native Object");
|
|
if (argc == 2) {
|
|
std::string arg0;
|
|
std::function<void (cocos2d::EventCustom *)> arg1;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
do {
|
|
if(JS_TypeOfValue(cx, args.get(1)) == JSTYPE_FUNCTION)
|
|
{
|
|
JS::RootedObject jstarget(cx, args.thisv().toObjectOrNull());
|
|
std::shared_ptr<JSFunctionWrapper> func(new JSFunctionWrapper(cx, jstarget, args.get(1), args.thisv()));
|
|
auto lambda = [=](cocos2d::EventCustom* larg0) -> void {
|
|
JSB_AUTOCOMPARTMENT_WITH_GLOBAL_OBJCET
|
|
jsval largv[1];
|
|
if (larg0) {
|
|
largv[0] = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::EventCustom>(cx, (cocos2d::EventCustom*)larg0));
|
|
} else {
|
|
largv[0] = JSVAL_NULL;
|
|
};
|
|
JS::RootedValue rval(cx);
|
|
bool succeed = func->invoke(1, &largv[0], &rval);
|
|
if (!succeed && JS_IsExceptionPending(cx)) {
|
|
JS_ReportPendingException(cx);
|
|
}
|
|
};
|
|
arg1 = lambda;
|
|
}
|
|
else
|
|
{
|
|
arg1 = nullptr;
|
|
}
|
|
} while(0)
|
|
;
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EventDispatcher_addCustomEventListener : Error processing arguments");
|
|
cocos2d::EventListenerCustom* ret = cobj->addCustomEventListener(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::EventListenerCustom>(cx, (cocos2d::EventListenerCustom*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_EventDispatcher_addCustomEventListener : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_EventDispatcher_addEventListenerWithFixedPriority(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::EventDispatcher* cobj = (cocos2d::EventDispatcher *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventDispatcher_addEventListenerWithFixedPriority : Invalid Native Object");
|
|
if (argc == 2) {
|
|
cocos2d::EventListener* arg0 = nullptr;
|
|
int arg1 = 0;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::EventListener*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EventDispatcher_addEventListenerWithFixedPriority : Error processing arguments");
|
|
cobj->addEventListenerWithFixedPriority(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_EventDispatcher_addEventListenerWithFixedPriority : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_EventDispatcher_removeEventListenersForTarget(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::EventDispatcher* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::EventDispatcher *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventDispatcher_removeEventListenersForTarget : Invalid Native Object");
|
|
do {
|
|
if (argc == 1) {
|
|
cocos2d::Node* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
if (!ok) { ok = true; break; }
|
|
cobj->removeEventListenersForTarget(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 2) {
|
|
cocos2d::Node* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
if (!ok) { ok = true; break; }
|
|
bool arg1;
|
|
arg1 = JS::ToBoolean(args.get(1));
|
|
cobj->removeEventListenersForTarget(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 1) {
|
|
cocos2d::EventListener::Type arg0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cobj->removeEventListenersForType(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_EventDispatcher_removeEventListenersForTarget : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_EventDispatcher_resumeEventListenersForTarget(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::EventDispatcher* cobj = (cocos2d::EventDispatcher *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventDispatcher_resumeEventListenersForTarget : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Node* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EventDispatcher_resumeEventListenersForTarget : Error processing arguments");
|
|
cobj->resumeEventListenersForTarget(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
if (argc == 2) {
|
|
cocos2d::Node* arg0 = nullptr;
|
|
bool arg1;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
arg1 = JS::ToBoolean(args.get(1));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EventDispatcher_resumeEventListenersForTarget : Error processing arguments");
|
|
cobj->resumeEventListenersForTarget(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_EventDispatcher_resumeEventListenersForTarget : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_EventDispatcher_setPriority(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::EventDispatcher* cobj = (cocos2d::EventDispatcher *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventDispatcher_setPriority : Invalid Native Object");
|
|
if (argc == 2) {
|
|
cocos2d::EventListener* arg0 = nullptr;
|
|
int arg1 = 0;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::EventListener*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EventDispatcher_setPriority : Error processing arguments");
|
|
cobj->setPriority(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_EventDispatcher_setPriority : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_EventDispatcher_dispatchEvent(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::EventDispatcher* cobj = (cocos2d::EventDispatcher *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventDispatcher_dispatchEvent : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Event* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Event*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EventDispatcher_dispatchEvent : Error processing arguments");
|
|
cobj->dispatchEvent(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_EventDispatcher_dispatchEvent : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_EventDispatcher_pauseEventListenersForTarget(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::EventDispatcher* cobj = (cocos2d::EventDispatcher *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventDispatcher_pauseEventListenersForTarget : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Node* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EventDispatcher_pauseEventListenersForTarget : Error processing arguments");
|
|
cobj->pauseEventListenersForTarget(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
if (argc == 2) {
|
|
cocos2d::Node* arg0 = nullptr;
|
|
bool arg1;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
arg1 = JS::ToBoolean(args.get(1));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EventDispatcher_pauseEventListenersForTarget : Error processing arguments");
|
|
cobj->pauseEventListenersForTarget(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_EventDispatcher_pauseEventListenersForTarget : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_EventDispatcher_removeCustomEventListeners(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::EventDispatcher* cobj = (cocos2d::EventDispatcher *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventDispatcher_removeCustomEventListeners : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EventDispatcher_removeCustomEventListeners : Error processing arguments");
|
|
cobj->removeCustomEventListeners(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_EventDispatcher_removeCustomEventListeners : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_EventDispatcher_removeEventListener(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::EventDispatcher* cobj = (cocos2d::EventDispatcher *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventDispatcher_removeEventListener : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::EventListener* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::EventListener*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EventDispatcher_removeEventListener : Error processing arguments");
|
|
cobj->removeEventListener(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_EventDispatcher_removeEventListener : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_EventDispatcher_isEnabled(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::EventDispatcher* cobj = (cocos2d::EventDispatcher *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventDispatcher_isEnabled : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->isEnabled();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_EventDispatcher_isEnabled : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_EventDispatcher_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::EventDispatcher* cobj = new (std::nothrow) cocos2d::EventDispatcher();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EventDispatcher>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::EventDispatcher"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
|
|
|
|
void js_register_cocos2dx_EventDispatcher(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_EventDispatcher_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_EventDispatcher_class->name = "EventDispatcher";
|
|
jsb_cocos2d_EventDispatcher_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EventDispatcher_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_EventDispatcher_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EventDispatcher_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_EventDispatcher_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_EventDispatcher_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_EventDispatcher_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_EventDispatcher_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("setEnabled", js_cocos2dx_EventDispatcher_setEnabled, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("removeAllListeners", js_cocos2dx_EventDispatcher_removeAllEventListeners, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("addEventListenerWithSceneGraphPriority", js_cocos2dx_EventDispatcher_addEventListenerWithSceneGraphPriority, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("addCustomListener", js_cocos2dx_EventDispatcher_addCustomEventListener, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("addEventListenerWithFixedPriority", js_cocos2dx_EventDispatcher_addEventListenerWithFixedPriority, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("removeListeners", js_cocos2dx_EventDispatcher_removeEventListenersForTarget, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("resumeTarget", js_cocos2dx_EventDispatcher_resumeEventListenersForTarget, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setPriority", js_cocos2dx_EventDispatcher_setPriority, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("dispatchEvent", js_cocos2dx_EventDispatcher_dispatchEvent, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("pauseTarget", js_cocos2dx_EventDispatcher_pauseEventListenersForTarget, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("removeCustomListeners", js_cocos2dx_EventDispatcher_removeCustomEventListeners, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("removeListener", js_cocos2dx_EventDispatcher_removeEventListener, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("isEnabled", js_cocos2dx_EventDispatcher_isEnabled, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JSFunctionSpec *st_funcs = NULL;
|
|
|
|
jsb_cocos2d_EventDispatcher_prototype = JS_InitClass(
|
|
cx, global,
|
|
JS::NullPtr(),
|
|
jsb_cocos2d_EventDispatcher_class,
|
|
js_cocos2dx_EventDispatcher_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_EventDispatcher_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "EventDispatcher"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::EventDispatcher>(cx, jsb_cocos2d_EventDispatcher_class, proto, JS::NullPtr());
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_EventFocus_class;
|
|
JSObject *jsb_cocos2d_EventFocus_prototype;
|
|
|
|
bool js_cocos2dx_EventFocus_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::ui::Widget* arg0 = nullptr;
|
|
cocos2d::ui::Widget* arg1 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::ui::Widget*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::ui::Widget*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EventFocus_constructor : Error processing arguments");
|
|
cocos2d::EventFocus* cobj = new (std::nothrow) cocos2d::EventFocus(arg0, arg1);
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EventFocus>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::EventFocus"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_Event_prototype;
|
|
|
|
void js_register_cocos2dx_EventFocus(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_EventFocus_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_EventFocus_class->name = "EventFocus";
|
|
jsb_cocos2d_EventFocus_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EventFocus_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_EventFocus_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EventFocus_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_EventFocus_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_EventFocus_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_EventFocus_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_EventFocus_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FS_END
|
|
};
|
|
|
|
JSFunctionSpec *st_funcs = NULL;
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_Event_prototype);
|
|
jsb_cocos2d_EventFocus_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_EventFocus_class,
|
|
js_cocos2dx_EventFocus_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_EventFocus_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "EventFocus"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::EventFocus>(cx, jsb_cocos2d_EventFocus_class, proto, parent_proto);
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_EventListenerAcceleration_class;
|
|
JSObject *jsb_cocos2d_EventListenerAcceleration_prototype;
|
|
|
|
bool js_cocos2dx_EventListenerAcceleration_init(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::EventListenerAcceleration* cobj = (cocos2d::EventListenerAcceleration *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventListenerAcceleration_init : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::function<void (cocos2d::Acceleration *, cocos2d::Event *)> arg0;
|
|
do {
|
|
if(JS_TypeOfValue(cx, args.get(0)) == JSTYPE_FUNCTION)
|
|
{
|
|
JS::RootedObject jstarget(cx, args.thisv().toObjectOrNull());
|
|
std::shared_ptr<JSFunctionWrapper> func(new JSFunctionWrapper(cx, jstarget, args.get(0), args.thisv()));
|
|
auto lambda = [=](cocos2d::Acceleration* larg0, cocos2d::Event* larg1) -> void {
|
|
JSB_AUTOCOMPARTMENT_WITH_GLOBAL_OBJCET
|
|
jsval largv[2];
|
|
largv[0] = ccacceleration_to_jsval(cx, *larg0);
|
|
if (larg1) {
|
|
largv[1] = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Event>(cx, (cocos2d::Event*)larg1));
|
|
} else {
|
|
largv[1] = JSVAL_NULL;
|
|
};
|
|
JS::RootedValue rval(cx);
|
|
bool succeed = func->invoke(2, &largv[0], &rval);
|
|
if (!succeed && JS_IsExceptionPending(cx)) {
|
|
JS_ReportPendingException(cx);
|
|
}
|
|
};
|
|
arg0 = lambda;
|
|
}
|
|
else
|
|
{
|
|
arg0 = nullptr;
|
|
}
|
|
} while(0)
|
|
;
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EventListenerAcceleration_init : Error processing arguments");
|
|
bool ret = cobj->init(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_EventListenerAcceleration_init : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_EventListenerAcceleration_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
std::function<void (cocos2d::Acceleration *, cocos2d::Event *)> arg0;
|
|
do {
|
|
if(JS_TypeOfValue(cx, args.get(0)) == JSTYPE_FUNCTION)
|
|
{
|
|
JS::RootedObject jstarget(cx, args.thisv().toObjectOrNull());
|
|
std::shared_ptr<JSFunctionWrapper> func(new JSFunctionWrapper(cx, jstarget, args.get(0), args.thisv()));
|
|
auto lambda = [=](cocos2d::Acceleration* larg0, cocos2d::Event* larg1) -> void {
|
|
JSB_AUTOCOMPARTMENT_WITH_GLOBAL_OBJCET
|
|
jsval largv[2];
|
|
largv[0] = ccacceleration_to_jsval(cx, *larg0);
|
|
if (larg1) {
|
|
largv[1] = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Event>(cx, (cocos2d::Event*)larg1));
|
|
} else {
|
|
largv[1] = JSVAL_NULL;
|
|
};
|
|
JS::RootedValue rval(cx);
|
|
bool succeed = func->invoke(2, &largv[0], &rval);
|
|
if (!succeed && JS_IsExceptionPending(cx)) {
|
|
JS_ReportPendingException(cx);
|
|
}
|
|
};
|
|
arg0 = lambda;
|
|
}
|
|
else
|
|
{
|
|
arg0 = nullptr;
|
|
}
|
|
} while(0)
|
|
;
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EventListenerAcceleration_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::EventListenerAcceleration::create(arg0);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EventListenerAcceleration>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::EventListenerAcceleration"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_EventListenerAcceleration_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_EventListenerAcceleration_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::EventListenerAcceleration* cobj = new (std::nothrow) cocos2d::EventListenerAcceleration();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EventListenerAcceleration>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::EventListenerAcceleration"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_EventListener_prototype;
|
|
|
|
void js_register_cocos2dx_EventListenerAcceleration(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_EventListenerAcceleration_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_EventListenerAcceleration_class->name = "EventListenerAcceleration";
|
|
jsb_cocos2d_EventListenerAcceleration_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EventListenerAcceleration_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_EventListenerAcceleration_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EventListenerAcceleration_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_EventListenerAcceleration_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_EventListenerAcceleration_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_EventListenerAcceleration_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_EventListenerAcceleration_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("init", js_cocos2dx_EventListenerAcceleration_init, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_EventListenerAcceleration_create, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_EventListener_prototype);
|
|
jsb_cocos2d_EventListenerAcceleration_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_EventListenerAcceleration_class,
|
|
js_cocos2dx_EventListenerAcceleration_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_EventListenerAcceleration_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "EventListenerAcceleration"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::EventListenerAcceleration>(cx, jsb_cocos2d_EventListenerAcceleration_class, proto, parent_proto);
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_EventListenerCustom_class;
|
|
JSObject *jsb_cocos2d_EventListenerCustom_prototype;
|
|
|
|
bool js_cocos2dx_EventListenerCustom_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 2) {
|
|
std::string arg0;
|
|
std::function<void (cocos2d::EventCustom *)> arg1;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
do {
|
|
if(JS_TypeOfValue(cx, args.get(1)) == JSTYPE_FUNCTION)
|
|
{
|
|
JS::RootedObject jstarget(cx, args.thisv().toObjectOrNull());
|
|
std::shared_ptr<JSFunctionWrapper> func(new JSFunctionWrapper(cx, jstarget, args.get(1), args.thisv()));
|
|
auto lambda = [=](cocos2d::EventCustom* larg0) -> void {
|
|
JSB_AUTOCOMPARTMENT_WITH_GLOBAL_OBJCET
|
|
jsval largv[1];
|
|
if (larg0) {
|
|
largv[0] = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::EventCustom>(cx, (cocos2d::EventCustom*)larg0));
|
|
} else {
|
|
largv[0] = JSVAL_NULL;
|
|
};
|
|
JS::RootedValue rval(cx);
|
|
bool succeed = func->invoke(1, &largv[0], &rval);
|
|
if (!succeed && JS_IsExceptionPending(cx)) {
|
|
JS_ReportPendingException(cx);
|
|
}
|
|
};
|
|
arg1 = lambda;
|
|
}
|
|
else
|
|
{
|
|
arg1 = nullptr;
|
|
}
|
|
} while(0)
|
|
;
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EventListenerCustom_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::EventListenerCustom::create(arg0, arg1);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EventListenerCustom>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::EventListenerCustom"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_EventListenerCustom_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_EventListenerCustom_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::EventListenerCustom* cobj = new (std::nothrow) cocos2d::EventListenerCustom();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EventListenerCustom>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::EventListenerCustom"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_EventListener_prototype;
|
|
|
|
void js_register_cocos2dx_EventListenerCustom(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_EventListenerCustom_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_EventListenerCustom_class->name = "EventListenerCustom";
|
|
jsb_cocos2d_EventListenerCustom_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EventListenerCustom_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_EventListenerCustom_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EventListenerCustom_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_EventListenerCustom_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_EventListenerCustom_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_EventListenerCustom_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_EventListenerCustom_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_EventListenerCustom_create, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_EventListener_prototype);
|
|
jsb_cocos2d_EventListenerCustom_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_EventListenerCustom_class,
|
|
js_cocos2dx_EventListenerCustom_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_EventListenerCustom_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "EventListenerCustom"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::EventListenerCustom>(cx, jsb_cocos2d_EventListenerCustom_class, proto, parent_proto);
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_EventListenerFocus_class;
|
|
JSObject *jsb_cocos2d_EventListenerFocus_prototype;
|
|
|
|
bool js_cocos2dx_EventListenerFocus_init(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::EventListenerFocus* cobj = (cocos2d::EventListenerFocus *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventListenerFocus_init : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->init();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_EventListenerFocus_init : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_EventListenerFocus_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::EventListenerFocus* cobj = new (std::nothrow) cocos2d::EventListenerFocus();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EventListenerFocus>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::EventListenerFocus"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_EventListener_prototype;
|
|
|
|
void js_register_cocos2dx_EventListenerFocus(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_EventListenerFocus_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_EventListenerFocus_class->name = "EventListenerFocus";
|
|
jsb_cocos2d_EventListenerFocus_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EventListenerFocus_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_EventListenerFocus_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EventListenerFocus_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_EventListenerFocus_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_EventListenerFocus_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_EventListenerFocus_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_EventListenerFocus_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("init", js_cocos2dx_EventListenerFocus_init, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JSFunctionSpec *st_funcs = NULL;
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_EventListener_prototype);
|
|
jsb_cocos2d_EventListenerFocus_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_EventListenerFocus_class,
|
|
js_cocos2dx_EventListenerFocus_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_EventListenerFocus_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "EventListenerFocus"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::EventListenerFocus>(cx, jsb_cocos2d_EventListenerFocus_class, proto, parent_proto);
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_EventListenerKeyboard_class;
|
|
JSObject *jsb_cocos2d_EventListenerKeyboard_prototype;
|
|
|
|
bool js_cocos2dx_EventListenerKeyboard_init(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::EventListenerKeyboard* cobj = (cocos2d::EventListenerKeyboard *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventListenerKeyboard_init : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->init();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_EventListenerKeyboard_init : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_EventListenerKeyboard_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::EventListenerKeyboard* cobj = new (std::nothrow) cocos2d::EventListenerKeyboard();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EventListenerKeyboard>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::EventListenerKeyboard"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_EventListener_prototype;
|
|
|
|
void js_register_cocos2dx_EventListenerKeyboard(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_EventListenerKeyboard_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_EventListenerKeyboard_class->name = "EventListenerKeyboard";
|
|
jsb_cocos2d_EventListenerKeyboard_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EventListenerKeyboard_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_EventListenerKeyboard_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EventListenerKeyboard_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_EventListenerKeyboard_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_EventListenerKeyboard_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_EventListenerKeyboard_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_EventListenerKeyboard_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("init", js_cocos2dx_EventListenerKeyboard_init, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JSFunctionSpec *st_funcs = NULL;
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_EventListener_prototype);
|
|
jsb_cocos2d_EventListenerKeyboard_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_EventListenerKeyboard_class,
|
|
js_cocos2dx_EventListenerKeyboard_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_EventListenerKeyboard_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "EventListenerKeyboard"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::EventListenerKeyboard>(cx, jsb_cocos2d_EventListenerKeyboard_class, proto, parent_proto);
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_EventMouse_class;
|
|
JSObject *jsb_cocos2d_EventMouse_prototype;
|
|
|
|
bool js_cocos2dx_EventMouse_getMouseButton(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::EventMouse* cobj = (cocos2d::EventMouse *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventMouse_getMouseButton : Invalid Native Object");
|
|
if (argc == 0) {
|
|
int ret = cobj->getMouseButton();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = int32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_EventMouse_getMouseButton : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_EventMouse_getLocation(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::EventMouse* cobj = (cocos2d::EventMouse *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventMouse_getLocation : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::Vec2 ret = cobj->getLocation();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = vector2_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_EventMouse_getLocation : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_EventMouse_setMouseButton(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::EventMouse* cobj = (cocos2d::EventMouse *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventMouse_setMouseButton : Invalid Native Object");
|
|
if (argc == 1) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EventMouse_setMouseButton : Error processing arguments");
|
|
cobj->setMouseButton(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_EventMouse_setMouseButton : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_EventMouse_setScrollData(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::EventMouse* cobj = (cocos2d::EventMouse *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventMouse_setScrollData : Invalid Native Object");
|
|
if (argc == 2) {
|
|
double arg0 = 0;
|
|
double arg1 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EventMouse_setScrollData : Error processing arguments");
|
|
cobj->setScrollData(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_EventMouse_setScrollData : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_EventMouse_getPreviousLocationInView(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::EventMouse* cobj = (cocos2d::EventMouse *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventMouse_getPreviousLocationInView : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::Vec2 ret = cobj->getPreviousLocationInView();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = vector2_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_EventMouse_getPreviousLocationInView : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_EventMouse_getDelta(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::EventMouse* cobj = (cocos2d::EventMouse *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventMouse_getDelta : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::Vec2 ret = cobj->getDelta();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = vector2_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_EventMouse_getDelta : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_EventMouse_getStartLocation(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::EventMouse* cobj = (cocos2d::EventMouse *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventMouse_getStartLocation : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::Vec2 ret = cobj->getStartLocation();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = vector2_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_EventMouse_getStartLocation : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_EventMouse_getCursorY(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::EventMouse* cobj = (cocos2d::EventMouse *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventMouse_getCursorY : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getCursorY();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_EventMouse_getCursorY : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_EventMouse_getCursorX(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::EventMouse* cobj = (cocos2d::EventMouse *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventMouse_getCursorX : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getCursorX();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_EventMouse_getCursorX : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_EventMouse_getLocationInView(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::EventMouse* cobj = (cocos2d::EventMouse *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventMouse_getLocationInView : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::Vec2 ret = cobj->getLocationInView();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = vector2_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_EventMouse_getLocationInView : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_EventMouse_getScrollY(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::EventMouse* cobj = (cocos2d::EventMouse *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventMouse_getScrollY : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getScrollY();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_EventMouse_getScrollY : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_EventMouse_setCursorPosition(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::EventMouse* cobj = (cocos2d::EventMouse *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventMouse_setCursorPosition : Invalid Native Object");
|
|
if (argc == 2) {
|
|
double arg0 = 0;
|
|
double arg1 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EventMouse_setCursorPosition : Error processing arguments");
|
|
cobj->setCursorPosition(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_EventMouse_setCursorPosition : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_EventMouse_getScrollX(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::EventMouse* cobj = (cocos2d::EventMouse *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventMouse_getScrollX : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getScrollX();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_EventMouse_getScrollX : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_EventMouse_getPreviousLocation(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::EventMouse* cobj = (cocos2d::EventMouse *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventMouse_getPreviousLocation : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::Vec2 ret = cobj->getPreviousLocation();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = vector2_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_EventMouse_getPreviousLocation : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_EventMouse_getStartLocationInView(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::EventMouse* cobj = (cocos2d::EventMouse *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventMouse_getStartLocationInView : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::Vec2 ret = cobj->getStartLocationInView();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = vector2_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_EventMouse_getStartLocationInView : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_EventMouse_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::EventMouse::MouseEventType arg0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EventMouse_constructor : Error processing arguments");
|
|
cocos2d::EventMouse* cobj = new (std::nothrow) cocos2d::EventMouse(arg0);
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EventMouse>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::EventMouse"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_Event_prototype;
|
|
|
|
void js_register_cocos2dx_EventMouse(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_EventMouse_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_EventMouse_class->name = "EventMouse";
|
|
jsb_cocos2d_EventMouse_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EventMouse_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_EventMouse_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EventMouse_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_EventMouse_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_EventMouse_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_EventMouse_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_EventMouse_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("getButton", js_cocos2dx_EventMouse_getMouseButton, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getLocation", js_cocos2dx_EventMouse_getLocation, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setButton", js_cocos2dx_EventMouse_setMouseButton, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setScrollData", js_cocos2dx_EventMouse_setScrollData, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getPreviousLocationInView", js_cocos2dx_EventMouse_getPreviousLocationInView, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getDelta", js_cocos2dx_EventMouse_getDelta, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getStartLocation", js_cocos2dx_EventMouse_getStartLocation, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getLocationY", js_cocos2dx_EventMouse_getCursorY, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getLocationX", js_cocos2dx_EventMouse_getCursorX, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getLocationInView", js_cocos2dx_EventMouse_getLocationInView, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getScrollY", js_cocos2dx_EventMouse_getScrollY, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setLocation", js_cocos2dx_EventMouse_setCursorPosition, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getScrollX", js_cocos2dx_EventMouse_getScrollX, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getPreviousLocation", js_cocos2dx_EventMouse_getPreviousLocation, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getStartLocationInView", js_cocos2dx_EventMouse_getStartLocationInView, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JSFunctionSpec *st_funcs = NULL;
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_Event_prototype);
|
|
jsb_cocos2d_EventMouse_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_EventMouse_class,
|
|
js_cocos2dx_EventMouse_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_EventMouse_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "EventMouse"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::EventMouse>(cx, jsb_cocos2d_EventMouse_class, proto, parent_proto);
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_EventListenerMouse_class;
|
|
JSObject *jsb_cocos2d_EventListenerMouse_prototype;
|
|
|
|
bool js_cocos2dx_EventListenerMouse_init(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::EventListenerMouse* cobj = (cocos2d::EventListenerMouse *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventListenerMouse_init : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->init();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_EventListenerMouse_init : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_EventListenerMouse_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::EventListenerMouse* cobj = new (std::nothrow) cocos2d::EventListenerMouse();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EventListenerMouse>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::EventListenerMouse"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_EventListener_prototype;
|
|
|
|
void js_register_cocos2dx_EventListenerMouse(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_EventListenerMouse_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_EventListenerMouse_class->name = "EventListenerMouse";
|
|
jsb_cocos2d_EventListenerMouse_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EventListenerMouse_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_EventListenerMouse_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EventListenerMouse_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_EventListenerMouse_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_EventListenerMouse_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_EventListenerMouse_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_EventListenerMouse_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("init", js_cocos2dx_EventListenerMouse_init, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JSFunctionSpec *st_funcs = NULL;
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_EventListener_prototype);
|
|
jsb_cocos2d_EventListenerMouse_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_EventListenerMouse_class,
|
|
js_cocos2dx_EventListenerMouse_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_EventListenerMouse_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "EventListenerMouse"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::EventListenerMouse>(cx, jsb_cocos2d_EventListenerMouse_class, proto, parent_proto);
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_EventListenerTouchOneByOne_class;
|
|
JSObject *jsb_cocos2d_EventListenerTouchOneByOne_prototype;
|
|
|
|
bool js_cocos2dx_EventListenerTouchOneByOne_isSwallowTouches(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::EventListenerTouchOneByOne* cobj = (cocos2d::EventListenerTouchOneByOne *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventListenerTouchOneByOne_isSwallowTouches : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->isSwallowTouches();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_EventListenerTouchOneByOne_isSwallowTouches : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_EventListenerTouchOneByOne_setSwallowTouches(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::EventListenerTouchOneByOne* cobj = (cocos2d::EventListenerTouchOneByOne *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventListenerTouchOneByOne_setSwallowTouches : Invalid Native Object");
|
|
if (argc == 1) {
|
|
bool arg0;
|
|
arg0 = JS::ToBoolean(args.get(0));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EventListenerTouchOneByOne_setSwallowTouches : Error processing arguments");
|
|
cobj->setSwallowTouches(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_EventListenerTouchOneByOne_setSwallowTouches : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_EventListenerTouchOneByOne_init(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::EventListenerTouchOneByOne* cobj = (cocos2d::EventListenerTouchOneByOne *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventListenerTouchOneByOne_init : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->init();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_EventListenerTouchOneByOne_init : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_EventListenerTouchOneByOne_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::EventListenerTouchOneByOne* cobj = new (std::nothrow) cocos2d::EventListenerTouchOneByOne();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EventListenerTouchOneByOne>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::EventListenerTouchOneByOne"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_EventListener_prototype;
|
|
|
|
void js_register_cocos2dx_EventListenerTouchOneByOne(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_EventListenerTouchOneByOne_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_EventListenerTouchOneByOne_class->name = "EventListenerTouchOneByOne";
|
|
jsb_cocos2d_EventListenerTouchOneByOne_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EventListenerTouchOneByOne_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_EventListenerTouchOneByOne_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EventListenerTouchOneByOne_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_EventListenerTouchOneByOne_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_EventListenerTouchOneByOne_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_EventListenerTouchOneByOne_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_EventListenerTouchOneByOne_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("isSwallowTouches", js_cocos2dx_EventListenerTouchOneByOne_isSwallowTouches, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setSwallowTouches", js_cocos2dx_EventListenerTouchOneByOne_setSwallowTouches, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("init", js_cocos2dx_EventListenerTouchOneByOne_init, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JSFunctionSpec *st_funcs = NULL;
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_EventListener_prototype);
|
|
jsb_cocos2d_EventListenerTouchOneByOne_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_EventListenerTouchOneByOne_class,
|
|
js_cocos2dx_EventListenerTouchOneByOne_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_EventListenerTouchOneByOne_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "EventListenerTouchOneByOne"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::EventListenerTouchOneByOne>(cx, jsb_cocos2d_EventListenerTouchOneByOne_class, proto, parent_proto);
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_EventListenerTouchAllAtOnce_class;
|
|
JSObject *jsb_cocos2d_EventListenerTouchAllAtOnce_prototype;
|
|
|
|
bool js_cocos2dx_EventListenerTouchAllAtOnce_init(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::EventListenerTouchAllAtOnce* cobj = (cocos2d::EventListenerTouchAllAtOnce *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EventListenerTouchAllAtOnce_init : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->init();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_EventListenerTouchAllAtOnce_init : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_EventListenerTouchAllAtOnce_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::EventListenerTouchAllAtOnce* cobj = new (std::nothrow) cocos2d::EventListenerTouchAllAtOnce();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EventListenerTouchAllAtOnce>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::EventListenerTouchAllAtOnce"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_EventListener_prototype;
|
|
|
|
void js_register_cocos2dx_EventListenerTouchAllAtOnce(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_EventListenerTouchAllAtOnce_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_EventListenerTouchAllAtOnce_class->name = "EventListenerTouchAllAtOnce";
|
|
jsb_cocos2d_EventListenerTouchAllAtOnce_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EventListenerTouchAllAtOnce_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_EventListenerTouchAllAtOnce_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EventListenerTouchAllAtOnce_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_EventListenerTouchAllAtOnce_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_EventListenerTouchAllAtOnce_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_EventListenerTouchAllAtOnce_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_EventListenerTouchAllAtOnce_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("init", js_cocos2dx_EventListenerTouchAllAtOnce_init, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JSFunctionSpec *st_funcs = NULL;
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_EventListener_prototype);
|
|
jsb_cocos2d_EventListenerTouchAllAtOnce_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_EventListenerTouchAllAtOnce_class,
|
|
js_cocos2dx_EventListenerTouchAllAtOnce_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_EventListenerTouchAllAtOnce_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "EventListenerTouchAllAtOnce"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::EventListenerTouchAllAtOnce>(cx, jsb_cocos2d_EventListenerTouchAllAtOnce_class, proto, parent_proto);
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_ActionCamera_class;
|
|
JSObject *jsb_cocos2d_ActionCamera_prototype;
|
|
|
|
bool js_cocos2dx_ActionCamera_setEye(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::ActionCamera* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::ActionCamera *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ActionCamera_setEye : Invalid Native Object");
|
|
do {
|
|
if (argc == 3) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
if (!ok) { ok = true; break; }
|
|
double arg1 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
if (!ok) { ok = true; break; }
|
|
double arg2 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
if (!ok) { ok = true; break; }
|
|
cobj->setEye(arg0, arg1, arg2);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 1) {
|
|
cocos2d::Vec3 arg0;
|
|
ok &= jsval_to_vector3(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cobj->setEye(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ActionCamera_setEye : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ActionCamera_getEye(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ActionCamera* cobj = (cocos2d::ActionCamera *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ActionCamera_getEye : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const cocos2d::Vec3& ret = cobj->getEye();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = vector3_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ActionCamera_getEye : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ActionCamera_setUp(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ActionCamera* cobj = (cocos2d::ActionCamera *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ActionCamera_setUp : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Vec3 arg0;
|
|
ok &= jsval_to_vector3(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ActionCamera_setUp : Error processing arguments");
|
|
cobj->setUp(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ActionCamera_setUp : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ActionCamera_getCenter(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ActionCamera* cobj = (cocos2d::ActionCamera *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ActionCamera_getCenter : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const cocos2d::Vec3& ret = cobj->getCenter();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = vector3_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ActionCamera_getCenter : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ActionCamera_setCenter(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ActionCamera* cobj = (cocos2d::ActionCamera *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ActionCamera_setCenter : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Vec3 arg0;
|
|
ok &= jsval_to_vector3(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ActionCamera_setCenter : Error processing arguments");
|
|
cobj->setCenter(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ActionCamera_setCenter : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ActionCamera_getUp(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ActionCamera* cobj = (cocos2d::ActionCamera *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ActionCamera_getUp : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const cocos2d::Vec3& ret = cobj->getUp();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = vector3_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ActionCamera_getUp : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ActionCamera_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::ActionCamera* cobj = new (std::nothrow) cocos2d::ActionCamera();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::ActionCamera>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::ActionCamera"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_ActionCamera_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::ActionCamera *nobj = new (std::nothrow) cocos2d::ActionCamera();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::ActionCamera");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_ActionInterval_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_ActionCamera(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_ActionCamera_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_ActionCamera_class->name = "ActionCamera";
|
|
jsb_cocos2d_ActionCamera_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_ActionCamera_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_ActionCamera_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_ActionCamera_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_ActionCamera_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_ActionCamera_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_ActionCamera_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_ActionCamera_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("setEye", js_cocos2dx_ActionCamera_setEye, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getEye", js_cocos2dx_ActionCamera_getEye, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setUp", js_cocos2dx_ActionCamera_setUp, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getCenter", js_cocos2dx_ActionCamera_getCenter, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setCenter", js_cocos2dx_ActionCamera_setCenter, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getUp", js_cocos2dx_ActionCamera_getUp, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_ActionCamera_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JSFunctionSpec *st_funcs = NULL;
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_ActionInterval_prototype);
|
|
jsb_cocos2d_ActionCamera_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_ActionCamera_class,
|
|
js_cocos2dx_ActionCamera_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_ActionCamera_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "ActionCamera"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::ActionCamera>(cx, jsb_cocos2d_ActionCamera_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.ActionCamera.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_OrbitCamera_class;
|
|
JSObject *jsb_cocos2d_OrbitCamera_prototype;
|
|
|
|
bool js_cocos2dx_OrbitCamera_sphericalRadius(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::OrbitCamera* cobj = (cocos2d::OrbitCamera *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_OrbitCamera_sphericalRadius : Invalid Native Object");
|
|
if (argc == 3) {
|
|
float* arg0 = 0;
|
|
float* arg1 = 0;
|
|
float* arg2 = 0;
|
|
#pragma warning NO CONVERSION TO NATIVE FOR float*
|
|
ok = false;
|
|
#pragma warning NO CONVERSION TO NATIVE FOR float*
|
|
ok = false;
|
|
#pragma warning NO CONVERSION TO NATIVE FOR float*
|
|
ok = false;
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_OrbitCamera_sphericalRadius : Error processing arguments");
|
|
cobj->sphericalRadius(arg0, arg1, arg2);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_OrbitCamera_sphericalRadius : wrong number of arguments: %d, was expecting %d", argc, 3);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_OrbitCamera_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::OrbitCamera* cobj = (cocos2d::OrbitCamera *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_OrbitCamera_initWithDuration : Invalid Native Object");
|
|
if (argc == 7) {
|
|
double arg0 = 0;
|
|
double arg1 = 0;
|
|
double arg2 = 0;
|
|
double arg3 = 0;
|
|
double arg4 = 0;
|
|
double arg5 = 0;
|
|
double arg6 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
ok &= JS::ToNumber( cx, args.get(3), &arg3) && !std::isnan(arg3);
|
|
ok &= JS::ToNumber( cx, args.get(4), &arg4) && !std::isnan(arg4);
|
|
ok &= JS::ToNumber( cx, args.get(5), &arg5) && !std::isnan(arg5);
|
|
ok &= JS::ToNumber( cx, args.get(6), &arg6) && !std::isnan(arg6);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_OrbitCamera_initWithDuration : Error processing arguments");
|
|
bool ret = cobj->initWithDuration(arg0, arg1, arg2, arg3, arg4, arg5, arg6);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_OrbitCamera_initWithDuration : wrong number of arguments: %d, was expecting %d", argc, 7);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_OrbitCamera_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 7) {
|
|
double arg0 = 0;
|
|
double arg1 = 0;
|
|
double arg2 = 0;
|
|
double arg3 = 0;
|
|
double arg4 = 0;
|
|
double arg5 = 0;
|
|
double arg6 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
ok &= JS::ToNumber( cx, args.get(3), &arg3) && !std::isnan(arg3);
|
|
ok &= JS::ToNumber( cx, args.get(4), &arg4) && !std::isnan(arg4);
|
|
ok &= JS::ToNumber( cx, args.get(5), &arg5) && !std::isnan(arg5);
|
|
ok &= JS::ToNumber( cx, args.get(6), &arg6) && !std::isnan(arg6);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_OrbitCamera_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::OrbitCamera::create(arg0, arg1, arg2, arg3, arg4, arg5, arg6);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::OrbitCamera>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::OrbitCamera"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_OrbitCamera_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_OrbitCamera_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::OrbitCamera* cobj = new (std::nothrow) cocos2d::OrbitCamera();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::OrbitCamera>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::OrbitCamera"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_OrbitCamera_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::OrbitCamera *nobj = new (std::nothrow) cocos2d::OrbitCamera();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::OrbitCamera");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_ActionCamera_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_OrbitCamera(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_OrbitCamera_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_OrbitCamera_class->name = "OrbitCamera";
|
|
jsb_cocos2d_OrbitCamera_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_OrbitCamera_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_OrbitCamera_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_OrbitCamera_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_OrbitCamera_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_OrbitCamera_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_OrbitCamera_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_OrbitCamera_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("sphericalRadius", js_cocos2dx_OrbitCamera_sphericalRadius, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initWithDuration", js_cocos2dx_OrbitCamera_initWithDuration, 7, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_OrbitCamera_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_OrbitCamera_create, 7, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_ActionCamera_prototype);
|
|
jsb_cocos2d_OrbitCamera_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_OrbitCamera_class,
|
|
js_cocos2dx_OrbitCamera_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_OrbitCamera_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "OrbitCamera"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::OrbitCamera>(cx, jsb_cocos2d_OrbitCamera_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.OrbitCamera.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_CardinalSplineTo_class;
|
|
JSObject *jsb_cocos2d_CardinalSplineTo_prototype;
|
|
|
|
bool js_cocos2dx_CardinalSplineTo_getPoints(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::CardinalSplineTo* cobj = (cocos2d::CardinalSplineTo *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_CardinalSplineTo_getPoints : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::PointArray* ret = cobj->getPoints();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::PointArray>(cx, (cocos2d::PointArray*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_CardinalSplineTo_getPoints : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_CardinalSplineTo_updatePosition(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::CardinalSplineTo* cobj = (cocos2d::CardinalSplineTo *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_CardinalSplineTo_updatePosition : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Vec2 arg0;
|
|
ok &= jsval_to_vector2(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_CardinalSplineTo_updatePosition : Error processing arguments");
|
|
cobj->updatePosition(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_CardinalSplineTo_updatePosition : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_CardinalSplineTo_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::CardinalSplineTo* cobj = new (std::nothrow) cocos2d::CardinalSplineTo();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::CardinalSplineTo>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::CardinalSplineTo"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_ActionInterval_prototype;
|
|
|
|
void js_register_cocos2dx_CardinalSplineTo(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_CardinalSplineTo_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_CardinalSplineTo_class->name = "CardinalSplineTo";
|
|
jsb_cocos2d_CardinalSplineTo_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_CardinalSplineTo_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_CardinalSplineTo_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_CardinalSplineTo_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_CardinalSplineTo_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_CardinalSplineTo_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_CardinalSplineTo_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_CardinalSplineTo_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("getPoints", js_cocos2dx_CardinalSplineTo_getPoints, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("updatePosition", js_cocos2dx_CardinalSplineTo_updatePosition, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JSFunctionSpec *st_funcs = NULL;
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_ActionInterval_prototype);
|
|
jsb_cocos2d_CardinalSplineTo_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_CardinalSplineTo_class,
|
|
js_cocos2dx_CardinalSplineTo_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_CardinalSplineTo_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "CardinalSplineTo"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::CardinalSplineTo>(cx, jsb_cocos2d_CardinalSplineTo_class, proto, parent_proto);
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_CardinalSplineBy_class;
|
|
JSObject *jsb_cocos2d_CardinalSplineBy_prototype;
|
|
|
|
bool js_cocos2dx_CardinalSplineBy_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::CardinalSplineBy* cobj = new (std::nothrow) cocos2d::CardinalSplineBy();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::CardinalSplineBy>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::CardinalSplineBy"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_CardinalSplineTo_prototype;
|
|
|
|
void js_register_cocos2dx_CardinalSplineBy(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_CardinalSplineBy_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_CardinalSplineBy_class->name = "CardinalSplineBy";
|
|
jsb_cocos2d_CardinalSplineBy_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_CardinalSplineBy_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_CardinalSplineBy_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_CardinalSplineBy_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_CardinalSplineBy_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_CardinalSplineBy_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_CardinalSplineBy_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_CardinalSplineBy_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FS_END
|
|
};
|
|
|
|
JSFunctionSpec *st_funcs = NULL;
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_CardinalSplineTo_prototype);
|
|
jsb_cocos2d_CardinalSplineBy_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_CardinalSplineBy_class,
|
|
js_cocos2dx_CardinalSplineBy_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_CardinalSplineBy_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "CardinalSplineBy"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::CardinalSplineBy>(cx, jsb_cocos2d_CardinalSplineBy_class, proto, parent_proto);
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_CatmullRomTo_class;
|
|
JSObject *jsb_cocos2d_CatmullRomTo_prototype;
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_CardinalSplineTo_prototype;
|
|
|
|
void js_register_cocos2dx_CatmullRomTo(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_CatmullRomTo_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_CatmullRomTo_class->name = "CatmullRomTo";
|
|
jsb_cocos2d_CatmullRomTo_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_CatmullRomTo_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_CatmullRomTo_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_CatmullRomTo_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_CatmullRomTo_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_CatmullRomTo_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_CatmullRomTo_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_CatmullRomTo_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FS_END
|
|
};
|
|
|
|
JSFunctionSpec *st_funcs = NULL;
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_CardinalSplineTo_prototype);
|
|
jsb_cocos2d_CatmullRomTo_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_CatmullRomTo_class,
|
|
dummy_constructor<cocos2d::CatmullRomTo>, 0, // no constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_CatmullRomTo_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "CatmullRomTo"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::CatmullRomTo>(cx, jsb_cocos2d_CatmullRomTo_class, proto, parent_proto);
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_CatmullRomBy_class;
|
|
JSObject *jsb_cocos2d_CatmullRomBy_prototype;
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_CardinalSplineBy_prototype;
|
|
|
|
void js_register_cocos2dx_CatmullRomBy(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_CatmullRomBy_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_CatmullRomBy_class->name = "CatmullRomBy";
|
|
jsb_cocos2d_CatmullRomBy_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_CatmullRomBy_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_CatmullRomBy_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_CatmullRomBy_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_CatmullRomBy_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_CatmullRomBy_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_CatmullRomBy_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_CatmullRomBy_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FS_END
|
|
};
|
|
|
|
JSFunctionSpec *st_funcs = NULL;
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_CardinalSplineBy_prototype);
|
|
jsb_cocos2d_CatmullRomBy_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_CatmullRomBy_class,
|
|
dummy_constructor<cocos2d::CatmullRomBy>, 0, // no constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_CatmullRomBy_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "CatmullRomBy"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::CatmullRomBy>(cx, jsb_cocos2d_CatmullRomBy_class, proto, parent_proto);
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_ActionEase_class;
|
|
JSObject *jsb_cocos2d_ActionEase_prototype;
|
|
|
|
bool js_cocos2dx_ActionEase_initWithAction(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ActionEase* cobj = (cocos2d::ActionEase *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ActionEase_initWithAction : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::ActionInterval* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ActionEase_initWithAction : Error processing arguments");
|
|
bool ret = cobj->initWithAction(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ActionEase_initWithAction : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ActionEase_getInnerAction(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ActionEase* cobj = (cocos2d::ActionEase *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ActionEase_getInnerAction : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::ActionInterval* ret = cobj->getInnerAction();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::ActionInterval>(cx, (cocos2d::ActionInterval*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ActionEase_getInnerAction : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
|
|
extern JSObject *jsb_cocos2d_ActionInterval_prototype;
|
|
|
|
void js_register_cocos2dx_ActionEase(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_ActionEase_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_ActionEase_class->name = "ActionEase";
|
|
jsb_cocos2d_ActionEase_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_ActionEase_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_ActionEase_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_ActionEase_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_ActionEase_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_ActionEase_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_ActionEase_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_ActionEase_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("initWithAction", js_cocos2dx_ActionEase_initWithAction, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getInnerAction", js_cocos2dx_ActionEase_getInnerAction, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JSFunctionSpec *st_funcs = NULL;
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_ActionInterval_prototype);
|
|
jsb_cocos2d_ActionEase_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_ActionEase_class,
|
|
empty_constructor, 0,
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_ActionEase_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "ActionEase"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::ActionEase>(cx, jsb_cocos2d_ActionEase_class, proto, parent_proto);
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_EaseRateAction_class;
|
|
JSObject *jsb_cocos2d_EaseRateAction_prototype;
|
|
|
|
bool js_cocos2dx_EaseRateAction_setRate(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::EaseRateAction* cobj = (cocos2d::EaseRateAction *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EaseRateAction_setRate : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EaseRateAction_setRate : Error processing arguments");
|
|
cobj->setRate(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_EaseRateAction_setRate : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_EaseRateAction_initWithAction(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::EaseRateAction* cobj = (cocos2d::EaseRateAction *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EaseRateAction_initWithAction : Invalid Native Object");
|
|
if (argc == 2) {
|
|
cocos2d::ActionInterval* arg0 = nullptr;
|
|
double arg1 = 0;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EaseRateAction_initWithAction : Error processing arguments");
|
|
bool ret = cobj->initWithAction(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_EaseRateAction_initWithAction : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_EaseRateAction_getRate(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::EaseRateAction* cobj = (cocos2d::EaseRateAction *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EaseRateAction_getRate : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getRate();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_EaseRateAction_getRate : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_EaseRateAction_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 2) {
|
|
cocos2d::ActionInterval* arg0 = nullptr;
|
|
double arg1 = 0;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EaseRateAction_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::EaseRateAction::create(arg0, arg1);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EaseRateAction>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::EaseRateAction"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_EaseRateAction_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_ActionEase_prototype;
|
|
|
|
void js_register_cocos2dx_EaseRateAction(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_EaseRateAction_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_EaseRateAction_class->name = "EaseRateAction";
|
|
jsb_cocos2d_EaseRateAction_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EaseRateAction_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_EaseRateAction_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EaseRateAction_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_EaseRateAction_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_EaseRateAction_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_EaseRateAction_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_EaseRateAction_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("setRate", js_cocos2dx_EaseRateAction_setRate, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initWithAction", js_cocos2dx_EaseRateAction_initWithAction, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getRate", js_cocos2dx_EaseRateAction_getRate, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_EaseRateAction_create, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_ActionEase_prototype);
|
|
jsb_cocos2d_EaseRateAction_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_EaseRateAction_class,
|
|
empty_constructor, 0,
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_EaseRateAction_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "EaseRateAction"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::EaseRateAction>(cx, jsb_cocos2d_EaseRateAction_class, proto, parent_proto);
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_EaseExponentialIn_class;
|
|
JSObject *jsb_cocos2d_EaseExponentialIn_prototype;
|
|
|
|
bool js_cocos2dx_EaseExponentialIn_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
cocos2d::ActionInterval* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EaseExponentialIn_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::EaseExponentialIn::create(arg0);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EaseExponentialIn>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::EaseExponentialIn"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_EaseExponentialIn_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_EaseExponentialIn_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::EaseExponentialIn* cobj = new (std::nothrow) cocos2d::EaseExponentialIn();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EaseExponentialIn>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::EaseExponentialIn"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_EaseExponentialIn_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::EaseExponentialIn *nobj = new (std::nothrow) cocos2d::EaseExponentialIn();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::EaseExponentialIn");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_ActionEase_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_EaseExponentialIn(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_EaseExponentialIn_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_EaseExponentialIn_class->name = "EaseExponentialIn";
|
|
jsb_cocos2d_EaseExponentialIn_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EaseExponentialIn_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_EaseExponentialIn_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EaseExponentialIn_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_EaseExponentialIn_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_EaseExponentialIn_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_EaseExponentialIn_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_EaseExponentialIn_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("ctor", js_cocos2dx_EaseExponentialIn_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_EaseExponentialIn_create, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_ActionEase_prototype);
|
|
jsb_cocos2d_EaseExponentialIn_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_EaseExponentialIn_class,
|
|
js_cocos2dx_EaseExponentialIn_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_EaseExponentialIn_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "EaseExponentialIn"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::EaseExponentialIn>(cx, jsb_cocos2d_EaseExponentialIn_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.EaseExponentialIn.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_EaseExponentialOut_class;
|
|
JSObject *jsb_cocos2d_EaseExponentialOut_prototype;
|
|
|
|
bool js_cocos2dx_EaseExponentialOut_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
cocos2d::ActionInterval* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EaseExponentialOut_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::EaseExponentialOut::create(arg0);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EaseExponentialOut>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::EaseExponentialOut"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_EaseExponentialOut_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_EaseExponentialOut_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::EaseExponentialOut* cobj = new (std::nothrow) cocos2d::EaseExponentialOut();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EaseExponentialOut>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::EaseExponentialOut"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_EaseExponentialOut_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::EaseExponentialOut *nobj = new (std::nothrow) cocos2d::EaseExponentialOut();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::EaseExponentialOut");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_ActionEase_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_EaseExponentialOut(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_EaseExponentialOut_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_EaseExponentialOut_class->name = "EaseExponentialOut";
|
|
jsb_cocos2d_EaseExponentialOut_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EaseExponentialOut_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_EaseExponentialOut_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EaseExponentialOut_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_EaseExponentialOut_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_EaseExponentialOut_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_EaseExponentialOut_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_EaseExponentialOut_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("ctor", js_cocos2dx_EaseExponentialOut_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_EaseExponentialOut_create, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_ActionEase_prototype);
|
|
jsb_cocos2d_EaseExponentialOut_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_EaseExponentialOut_class,
|
|
js_cocos2dx_EaseExponentialOut_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_EaseExponentialOut_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "EaseExponentialOut"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::EaseExponentialOut>(cx, jsb_cocos2d_EaseExponentialOut_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.EaseExponentialOut.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_EaseExponentialInOut_class;
|
|
JSObject *jsb_cocos2d_EaseExponentialInOut_prototype;
|
|
|
|
bool js_cocos2dx_EaseExponentialInOut_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
cocos2d::ActionInterval* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EaseExponentialInOut_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::EaseExponentialInOut::create(arg0);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EaseExponentialInOut>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::EaseExponentialInOut"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_EaseExponentialInOut_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_EaseExponentialInOut_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::EaseExponentialInOut* cobj = new (std::nothrow) cocos2d::EaseExponentialInOut();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EaseExponentialInOut>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::EaseExponentialInOut"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_EaseExponentialInOut_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::EaseExponentialInOut *nobj = new (std::nothrow) cocos2d::EaseExponentialInOut();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::EaseExponentialInOut");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_ActionEase_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_EaseExponentialInOut(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_EaseExponentialInOut_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_EaseExponentialInOut_class->name = "EaseExponentialInOut";
|
|
jsb_cocos2d_EaseExponentialInOut_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EaseExponentialInOut_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_EaseExponentialInOut_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EaseExponentialInOut_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_EaseExponentialInOut_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_EaseExponentialInOut_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_EaseExponentialInOut_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_EaseExponentialInOut_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("ctor", js_cocos2dx_EaseExponentialInOut_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_EaseExponentialInOut_create, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_ActionEase_prototype);
|
|
jsb_cocos2d_EaseExponentialInOut_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_EaseExponentialInOut_class,
|
|
js_cocos2dx_EaseExponentialInOut_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_EaseExponentialInOut_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "EaseExponentialInOut"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::EaseExponentialInOut>(cx, jsb_cocos2d_EaseExponentialInOut_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.EaseExponentialInOut.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_EaseSineIn_class;
|
|
JSObject *jsb_cocos2d_EaseSineIn_prototype;
|
|
|
|
bool js_cocos2dx_EaseSineIn_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
cocos2d::ActionInterval* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EaseSineIn_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::EaseSineIn::create(arg0);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EaseSineIn>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::EaseSineIn"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_EaseSineIn_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_EaseSineIn_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::EaseSineIn* cobj = new (std::nothrow) cocos2d::EaseSineIn();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EaseSineIn>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::EaseSineIn"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_EaseSineIn_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::EaseSineIn *nobj = new (std::nothrow) cocos2d::EaseSineIn();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::EaseSineIn");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_ActionEase_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_EaseSineIn(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_EaseSineIn_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_EaseSineIn_class->name = "EaseSineIn";
|
|
jsb_cocos2d_EaseSineIn_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EaseSineIn_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_EaseSineIn_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EaseSineIn_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_EaseSineIn_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_EaseSineIn_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_EaseSineIn_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_EaseSineIn_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("ctor", js_cocos2dx_EaseSineIn_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_EaseSineIn_create, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_ActionEase_prototype);
|
|
jsb_cocos2d_EaseSineIn_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_EaseSineIn_class,
|
|
js_cocos2dx_EaseSineIn_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_EaseSineIn_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "EaseSineIn"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::EaseSineIn>(cx, jsb_cocos2d_EaseSineIn_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.EaseSineIn.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_EaseSineOut_class;
|
|
JSObject *jsb_cocos2d_EaseSineOut_prototype;
|
|
|
|
bool js_cocos2dx_EaseSineOut_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
cocos2d::ActionInterval* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EaseSineOut_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::EaseSineOut::create(arg0);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EaseSineOut>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::EaseSineOut"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_EaseSineOut_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_EaseSineOut_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::EaseSineOut* cobj = new (std::nothrow) cocos2d::EaseSineOut();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EaseSineOut>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::EaseSineOut"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_EaseSineOut_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::EaseSineOut *nobj = new (std::nothrow) cocos2d::EaseSineOut();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::EaseSineOut");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_ActionEase_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_EaseSineOut(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_EaseSineOut_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_EaseSineOut_class->name = "EaseSineOut";
|
|
jsb_cocos2d_EaseSineOut_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EaseSineOut_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_EaseSineOut_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EaseSineOut_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_EaseSineOut_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_EaseSineOut_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_EaseSineOut_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_EaseSineOut_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("ctor", js_cocos2dx_EaseSineOut_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_EaseSineOut_create, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_ActionEase_prototype);
|
|
jsb_cocos2d_EaseSineOut_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_EaseSineOut_class,
|
|
js_cocos2dx_EaseSineOut_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_EaseSineOut_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "EaseSineOut"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::EaseSineOut>(cx, jsb_cocos2d_EaseSineOut_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.EaseSineOut.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_EaseSineInOut_class;
|
|
JSObject *jsb_cocos2d_EaseSineInOut_prototype;
|
|
|
|
bool js_cocos2dx_EaseSineInOut_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
cocos2d::ActionInterval* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EaseSineInOut_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::EaseSineInOut::create(arg0);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EaseSineInOut>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::EaseSineInOut"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_EaseSineInOut_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_EaseSineInOut_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::EaseSineInOut* cobj = new (std::nothrow) cocos2d::EaseSineInOut();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EaseSineInOut>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::EaseSineInOut"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_EaseSineInOut_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::EaseSineInOut *nobj = new (std::nothrow) cocos2d::EaseSineInOut();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::EaseSineInOut");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_ActionEase_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_EaseSineInOut(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_EaseSineInOut_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_EaseSineInOut_class->name = "EaseSineInOut";
|
|
jsb_cocos2d_EaseSineInOut_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EaseSineInOut_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_EaseSineInOut_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EaseSineInOut_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_EaseSineInOut_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_EaseSineInOut_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_EaseSineInOut_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_EaseSineInOut_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("ctor", js_cocos2dx_EaseSineInOut_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_EaseSineInOut_create, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_ActionEase_prototype);
|
|
jsb_cocos2d_EaseSineInOut_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_EaseSineInOut_class,
|
|
js_cocos2dx_EaseSineInOut_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_EaseSineInOut_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "EaseSineInOut"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::EaseSineInOut>(cx, jsb_cocos2d_EaseSineInOut_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.EaseSineInOut.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_EaseBounce_class;
|
|
JSObject *jsb_cocos2d_EaseBounce_prototype;
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_ActionEase_prototype;
|
|
|
|
void js_register_cocos2dx_EaseBounce(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_EaseBounce_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_EaseBounce_class->name = "EaseBounce";
|
|
jsb_cocos2d_EaseBounce_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EaseBounce_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_EaseBounce_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EaseBounce_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_EaseBounce_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_EaseBounce_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_EaseBounce_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_EaseBounce_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FS_END
|
|
};
|
|
|
|
JSFunctionSpec *st_funcs = NULL;
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_ActionEase_prototype);
|
|
jsb_cocos2d_EaseBounce_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_EaseBounce_class,
|
|
empty_constructor, 0,
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_EaseBounce_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "EaseBounce"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::EaseBounce>(cx, jsb_cocos2d_EaseBounce_class, proto, parent_proto);
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_EaseBounceIn_class;
|
|
JSObject *jsb_cocos2d_EaseBounceIn_prototype;
|
|
|
|
bool js_cocos2dx_EaseBounceIn_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
cocos2d::ActionInterval* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EaseBounceIn_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::EaseBounceIn::create(arg0);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EaseBounceIn>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::EaseBounceIn"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_EaseBounceIn_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_EaseBounceIn_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::EaseBounceIn* cobj = new (std::nothrow) cocos2d::EaseBounceIn();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EaseBounceIn>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::EaseBounceIn"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_EaseBounceIn_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::EaseBounceIn *nobj = new (std::nothrow) cocos2d::EaseBounceIn();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::EaseBounceIn");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_ActionEase_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_EaseBounceIn(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_EaseBounceIn_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_EaseBounceIn_class->name = "EaseBounceIn";
|
|
jsb_cocos2d_EaseBounceIn_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EaseBounceIn_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_EaseBounceIn_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EaseBounceIn_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_EaseBounceIn_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_EaseBounceIn_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_EaseBounceIn_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_EaseBounceIn_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("ctor", js_cocos2dx_EaseBounceIn_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_EaseBounceIn_create, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_ActionEase_prototype);
|
|
jsb_cocos2d_EaseBounceIn_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_EaseBounceIn_class,
|
|
js_cocos2dx_EaseBounceIn_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_EaseBounceIn_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "EaseBounceIn"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::EaseBounceIn>(cx, jsb_cocos2d_EaseBounceIn_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.EaseBounceIn.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_EaseBounceOut_class;
|
|
JSObject *jsb_cocos2d_EaseBounceOut_prototype;
|
|
|
|
bool js_cocos2dx_EaseBounceOut_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
cocos2d::ActionInterval* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EaseBounceOut_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::EaseBounceOut::create(arg0);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EaseBounceOut>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::EaseBounceOut"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_EaseBounceOut_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_EaseBounceOut_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::EaseBounceOut* cobj = new (std::nothrow) cocos2d::EaseBounceOut();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EaseBounceOut>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::EaseBounceOut"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_EaseBounceOut_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::EaseBounceOut *nobj = new (std::nothrow) cocos2d::EaseBounceOut();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::EaseBounceOut");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_ActionEase_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_EaseBounceOut(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_EaseBounceOut_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_EaseBounceOut_class->name = "EaseBounceOut";
|
|
jsb_cocos2d_EaseBounceOut_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EaseBounceOut_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_EaseBounceOut_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EaseBounceOut_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_EaseBounceOut_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_EaseBounceOut_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_EaseBounceOut_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_EaseBounceOut_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("ctor", js_cocos2dx_EaseBounceOut_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_EaseBounceOut_create, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_ActionEase_prototype);
|
|
jsb_cocos2d_EaseBounceOut_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_EaseBounceOut_class,
|
|
js_cocos2dx_EaseBounceOut_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_EaseBounceOut_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "EaseBounceOut"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::EaseBounceOut>(cx, jsb_cocos2d_EaseBounceOut_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.EaseBounceOut.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_EaseBounceInOut_class;
|
|
JSObject *jsb_cocos2d_EaseBounceInOut_prototype;
|
|
|
|
bool js_cocos2dx_EaseBounceInOut_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
cocos2d::ActionInterval* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EaseBounceInOut_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::EaseBounceInOut::create(arg0);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EaseBounceInOut>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::EaseBounceInOut"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_EaseBounceInOut_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_EaseBounceInOut_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::EaseBounceInOut* cobj = new (std::nothrow) cocos2d::EaseBounceInOut();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EaseBounceInOut>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::EaseBounceInOut"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_EaseBounceInOut_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::EaseBounceInOut *nobj = new (std::nothrow) cocos2d::EaseBounceInOut();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::EaseBounceInOut");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_ActionEase_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_EaseBounceInOut(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_EaseBounceInOut_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_EaseBounceInOut_class->name = "EaseBounceInOut";
|
|
jsb_cocos2d_EaseBounceInOut_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EaseBounceInOut_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_EaseBounceInOut_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EaseBounceInOut_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_EaseBounceInOut_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_EaseBounceInOut_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_EaseBounceInOut_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_EaseBounceInOut_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("ctor", js_cocos2dx_EaseBounceInOut_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_EaseBounceInOut_create, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_ActionEase_prototype);
|
|
jsb_cocos2d_EaseBounceInOut_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_EaseBounceInOut_class,
|
|
js_cocos2dx_EaseBounceInOut_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_EaseBounceInOut_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "EaseBounceInOut"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::EaseBounceInOut>(cx, jsb_cocos2d_EaseBounceInOut_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.EaseBounceInOut.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_EaseBackIn_class;
|
|
JSObject *jsb_cocos2d_EaseBackIn_prototype;
|
|
|
|
bool js_cocos2dx_EaseBackIn_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
cocos2d::ActionInterval* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EaseBackIn_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::EaseBackIn::create(arg0);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EaseBackIn>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::EaseBackIn"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_EaseBackIn_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_EaseBackIn_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::EaseBackIn* cobj = new (std::nothrow) cocos2d::EaseBackIn();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EaseBackIn>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::EaseBackIn"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_EaseBackIn_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::EaseBackIn *nobj = new (std::nothrow) cocos2d::EaseBackIn();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::EaseBackIn");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_ActionEase_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_EaseBackIn(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_EaseBackIn_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_EaseBackIn_class->name = "EaseBackIn";
|
|
jsb_cocos2d_EaseBackIn_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EaseBackIn_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_EaseBackIn_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EaseBackIn_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_EaseBackIn_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_EaseBackIn_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_EaseBackIn_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_EaseBackIn_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("ctor", js_cocos2dx_EaseBackIn_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_EaseBackIn_create, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_ActionEase_prototype);
|
|
jsb_cocos2d_EaseBackIn_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_EaseBackIn_class,
|
|
js_cocos2dx_EaseBackIn_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_EaseBackIn_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "EaseBackIn"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::EaseBackIn>(cx, jsb_cocos2d_EaseBackIn_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.EaseBackIn.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_EaseBackOut_class;
|
|
JSObject *jsb_cocos2d_EaseBackOut_prototype;
|
|
|
|
bool js_cocos2dx_EaseBackOut_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
cocos2d::ActionInterval* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EaseBackOut_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::EaseBackOut::create(arg0);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EaseBackOut>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::EaseBackOut"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_EaseBackOut_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_EaseBackOut_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::EaseBackOut* cobj = new (std::nothrow) cocos2d::EaseBackOut();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EaseBackOut>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::EaseBackOut"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_EaseBackOut_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::EaseBackOut *nobj = new (std::nothrow) cocos2d::EaseBackOut();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::EaseBackOut");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_ActionEase_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_EaseBackOut(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_EaseBackOut_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_EaseBackOut_class->name = "EaseBackOut";
|
|
jsb_cocos2d_EaseBackOut_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EaseBackOut_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_EaseBackOut_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EaseBackOut_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_EaseBackOut_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_EaseBackOut_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_EaseBackOut_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_EaseBackOut_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("ctor", js_cocos2dx_EaseBackOut_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_EaseBackOut_create, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_ActionEase_prototype);
|
|
jsb_cocos2d_EaseBackOut_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_EaseBackOut_class,
|
|
js_cocos2dx_EaseBackOut_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_EaseBackOut_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "EaseBackOut"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::EaseBackOut>(cx, jsb_cocos2d_EaseBackOut_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.EaseBackOut.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_EaseBackInOut_class;
|
|
JSObject *jsb_cocos2d_EaseBackInOut_prototype;
|
|
|
|
bool js_cocos2dx_EaseBackInOut_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
cocos2d::ActionInterval* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EaseBackInOut_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::EaseBackInOut::create(arg0);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EaseBackInOut>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::EaseBackInOut"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_EaseBackInOut_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_EaseBackInOut_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::EaseBackInOut* cobj = new (std::nothrow) cocos2d::EaseBackInOut();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EaseBackInOut>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::EaseBackInOut"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_EaseBackInOut_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::EaseBackInOut *nobj = new (std::nothrow) cocos2d::EaseBackInOut();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::EaseBackInOut");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_ActionEase_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_EaseBackInOut(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_EaseBackInOut_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_EaseBackInOut_class->name = "EaseBackInOut";
|
|
jsb_cocos2d_EaseBackInOut_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EaseBackInOut_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_EaseBackInOut_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EaseBackInOut_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_EaseBackInOut_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_EaseBackInOut_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_EaseBackInOut_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_EaseBackInOut_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("ctor", js_cocos2dx_EaseBackInOut_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_EaseBackInOut_create, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_ActionEase_prototype);
|
|
jsb_cocos2d_EaseBackInOut_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_EaseBackInOut_class,
|
|
js_cocos2dx_EaseBackInOut_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_EaseBackInOut_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "EaseBackInOut"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::EaseBackInOut>(cx, jsb_cocos2d_EaseBackInOut_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.EaseBackInOut.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_EaseQuadraticActionIn_class;
|
|
JSObject *jsb_cocos2d_EaseQuadraticActionIn_prototype;
|
|
|
|
bool js_cocos2dx_EaseQuadraticActionIn_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
cocos2d::ActionInterval* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EaseQuadraticActionIn_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::EaseQuadraticActionIn::create(arg0);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EaseQuadraticActionIn>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::EaseQuadraticActionIn"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_EaseQuadraticActionIn_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_EaseQuadraticActionIn_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::EaseQuadraticActionIn* cobj = new (std::nothrow) cocos2d::EaseQuadraticActionIn();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EaseQuadraticActionIn>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::EaseQuadraticActionIn"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_EaseQuadraticActionIn_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::EaseQuadraticActionIn *nobj = new (std::nothrow) cocos2d::EaseQuadraticActionIn();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::EaseQuadraticActionIn");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_ActionEase_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_EaseQuadraticActionIn(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_EaseQuadraticActionIn_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_EaseQuadraticActionIn_class->name = "EaseQuadraticActionIn";
|
|
jsb_cocos2d_EaseQuadraticActionIn_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EaseQuadraticActionIn_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_EaseQuadraticActionIn_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EaseQuadraticActionIn_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_EaseQuadraticActionIn_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_EaseQuadraticActionIn_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_EaseQuadraticActionIn_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_EaseQuadraticActionIn_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("ctor", js_cocos2dx_EaseQuadraticActionIn_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_EaseQuadraticActionIn_create, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_ActionEase_prototype);
|
|
jsb_cocos2d_EaseQuadraticActionIn_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_EaseQuadraticActionIn_class,
|
|
js_cocos2dx_EaseQuadraticActionIn_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_EaseQuadraticActionIn_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "EaseQuadraticActionIn"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::EaseQuadraticActionIn>(cx, jsb_cocos2d_EaseQuadraticActionIn_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.EaseQuadraticActionIn.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_EaseQuadraticActionOut_class;
|
|
JSObject *jsb_cocos2d_EaseQuadraticActionOut_prototype;
|
|
|
|
bool js_cocos2dx_EaseQuadraticActionOut_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
cocos2d::ActionInterval* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EaseQuadraticActionOut_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::EaseQuadraticActionOut::create(arg0);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EaseQuadraticActionOut>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::EaseQuadraticActionOut"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_EaseQuadraticActionOut_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_EaseQuadraticActionOut_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::EaseQuadraticActionOut* cobj = new (std::nothrow) cocos2d::EaseQuadraticActionOut();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EaseQuadraticActionOut>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::EaseQuadraticActionOut"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_EaseQuadraticActionOut_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::EaseQuadraticActionOut *nobj = new (std::nothrow) cocos2d::EaseQuadraticActionOut();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::EaseQuadraticActionOut");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_ActionEase_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_EaseQuadraticActionOut(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_EaseQuadraticActionOut_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_EaseQuadraticActionOut_class->name = "EaseQuadraticActionOut";
|
|
jsb_cocos2d_EaseQuadraticActionOut_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EaseQuadraticActionOut_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_EaseQuadraticActionOut_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EaseQuadraticActionOut_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_EaseQuadraticActionOut_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_EaseQuadraticActionOut_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_EaseQuadraticActionOut_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_EaseQuadraticActionOut_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("ctor", js_cocos2dx_EaseQuadraticActionOut_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_EaseQuadraticActionOut_create, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_ActionEase_prototype);
|
|
jsb_cocos2d_EaseQuadraticActionOut_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_EaseQuadraticActionOut_class,
|
|
js_cocos2dx_EaseQuadraticActionOut_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_EaseQuadraticActionOut_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "EaseQuadraticActionOut"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::EaseQuadraticActionOut>(cx, jsb_cocos2d_EaseQuadraticActionOut_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.EaseQuadraticActionOut.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_EaseQuadraticActionInOut_class;
|
|
JSObject *jsb_cocos2d_EaseQuadraticActionInOut_prototype;
|
|
|
|
bool js_cocos2dx_EaseQuadraticActionInOut_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
cocos2d::ActionInterval* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EaseQuadraticActionInOut_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::EaseQuadraticActionInOut::create(arg0);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EaseQuadraticActionInOut>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::EaseQuadraticActionInOut"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_EaseQuadraticActionInOut_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_EaseQuadraticActionInOut_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::EaseQuadraticActionInOut* cobj = new (std::nothrow) cocos2d::EaseQuadraticActionInOut();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EaseQuadraticActionInOut>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::EaseQuadraticActionInOut"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_EaseQuadraticActionInOut_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::EaseQuadraticActionInOut *nobj = new (std::nothrow) cocos2d::EaseQuadraticActionInOut();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::EaseQuadraticActionInOut");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_ActionEase_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_EaseQuadraticActionInOut(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_EaseQuadraticActionInOut_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_EaseQuadraticActionInOut_class->name = "EaseQuadraticActionInOut";
|
|
jsb_cocos2d_EaseQuadraticActionInOut_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EaseQuadraticActionInOut_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_EaseQuadraticActionInOut_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EaseQuadraticActionInOut_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_EaseQuadraticActionInOut_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_EaseQuadraticActionInOut_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_EaseQuadraticActionInOut_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_EaseQuadraticActionInOut_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("ctor", js_cocos2dx_EaseQuadraticActionInOut_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_EaseQuadraticActionInOut_create, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_ActionEase_prototype);
|
|
jsb_cocos2d_EaseQuadraticActionInOut_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_EaseQuadraticActionInOut_class,
|
|
js_cocos2dx_EaseQuadraticActionInOut_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_EaseQuadraticActionInOut_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "EaseQuadraticActionInOut"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::EaseQuadraticActionInOut>(cx, jsb_cocos2d_EaseQuadraticActionInOut_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.EaseQuadraticActionInOut.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_EaseQuarticActionIn_class;
|
|
JSObject *jsb_cocos2d_EaseQuarticActionIn_prototype;
|
|
|
|
bool js_cocos2dx_EaseQuarticActionIn_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
cocos2d::ActionInterval* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EaseQuarticActionIn_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::EaseQuarticActionIn::create(arg0);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EaseQuarticActionIn>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::EaseQuarticActionIn"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_EaseQuarticActionIn_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_EaseQuarticActionIn_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::EaseQuarticActionIn* cobj = new (std::nothrow) cocos2d::EaseQuarticActionIn();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EaseQuarticActionIn>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::EaseQuarticActionIn"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_EaseQuarticActionIn_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::EaseQuarticActionIn *nobj = new (std::nothrow) cocos2d::EaseQuarticActionIn();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::EaseQuarticActionIn");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_ActionEase_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_EaseQuarticActionIn(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_EaseQuarticActionIn_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_EaseQuarticActionIn_class->name = "EaseQuarticActionIn";
|
|
jsb_cocos2d_EaseQuarticActionIn_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EaseQuarticActionIn_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_EaseQuarticActionIn_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EaseQuarticActionIn_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_EaseQuarticActionIn_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_EaseQuarticActionIn_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_EaseQuarticActionIn_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_EaseQuarticActionIn_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("ctor", js_cocos2dx_EaseQuarticActionIn_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_EaseQuarticActionIn_create, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_ActionEase_prototype);
|
|
jsb_cocos2d_EaseQuarticActionIn_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_EaseQuarticActionIn_class,
|
|
js_cocos2dx_EaseQuarticActionIn_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_EaseQuarticActionIn_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "EaseQuarticActionIn"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::EaseQuarticActionIn>(cx, jsb_cocos2d_EaseQuarticActionIn_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.EaseQuarticActionIn.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_EaseQuarticActionOut_class;
|
|
JSObject *jsb_cocos2d_EaseQuarticActionOut_prototype;
|
|
|
|
bool js_cocos2dx_EaseQuarticActionOut_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
cocos2d::ActionInterval* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EaseQuarticActionOut_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::EaseQuarticActionOut::create(arg0);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EaseQuarticActionOut>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::EaseQuarticActionOut"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_EaseQuarticActionOut_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_EaseQuarticActionOut_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::EaseQuarticActionOut* cobj = new (std::nothrow) cocos2d::EaseQuarticActionOut();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EaseQuarticActionOut>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::EaseQuarticActionOut"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_EaseQuarticActionOut_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::EaseQuarticActionOut *nobj = new (std::nothrow) cocos2d::EaseQuarticActionOut();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::EaseQuarticActionOut");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_ActionEase_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_EaseQuarticActionOut(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_EaseQuarticActionOut_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_EaseQuarticActionOut_class->name = "EaseQuarticActionOut";
|
|
jsb_cocos2d_EaseQuarticActionOut_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EaseQuarticActionOut_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_EaseQuarticActionOut_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EaseQuarticActionOut_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_EaseQuarticActionOut_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_EaseQuarticActionOut_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_EaseQuarticActionOut_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_EaseQuarticActionOut_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("ctor", js_cocos2dx_EaseQuarticActionOut_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_EaseQuarticActionOut_create, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_ActionEase_prototype);
|
|
jsb_cocos2d_EaseQuarticActionOut_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_EaseQuarticActionOut_class,
|
|
js_cocos2dx_EaseQuarticActionOut_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_EaseQuarticActionOut_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "EaseQuarticActionOut"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::EaseQuarticActionOut>(cx, jsb_cocos2d_EaseQuarticActionOut_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.EaseQuarticActionOut.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_EaseQuarticActionInOut_class;
|
|
JSObject *jsb_cocos2d_EaseQuarticActionInOut_prototype;
|
|
|
|
bool js_cocos2dx_EaseQuarticActionInOut_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
cocos2d::ActionInterval* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EaseQuarticActionInOut_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::EaseQuarticActionInOut::create(arg0);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EaseQuarticActionInOut>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::EaseQuarticActionInOut"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_EaseQuarticActionInOut_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_EaseQuarticActionInOut_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::EaseQuarticActionInOut* cobj = new (std::nothrow) cocos2d::EaseQuarticActionInOut();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EaseQuarticActionInOut>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::EaseQuarticActionInOut"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_EaseQuarticActionInOut_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::EaseQuarticActionInOut *nobj = new (std::nothrow) cocos2d::EaseQuarticActionInOut();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::EaseQuarticActionInOut");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_ActionEase_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_EaseQuarticActionInOut(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_EaseQuarticActionInOut_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_EaseQuarticActionInOut_class->name = "EaseQuarticActionInOut";
|
|
jsb_cocos2d_EaseQuarticActionInOut_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EaseQuarticActionInOut_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_EaseQuarticActionInOut_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EaseQuarticActionInOut_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_EaseQuarticActionInOut_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_EaseQuarticActionInOut_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_EaseQuarticActionInOut_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_EaseQuarticActionInOut_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("ctor", js_cocos2dx_EaseQuarticActionInOut_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_EaseQuarticActionInOut_create, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_ActionEase_prototype);
|
|
jsb_cocos2d_EaseQuarticActionInOut_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_EaseQuarticActionInOut_class,
|
|
js_cocos2dx_EaseQuarticActionInOut_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_EaseQuarticActionInOut_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "EaseQuarticActionInOut"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::EaseQuarticActionInOut>(cx, jsb_cocos2d_EaseQuarticActionInOut_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.EaseQuarticActionInOut.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_EaseQuinticActionIn_class;
|
|
JSObject *jsb_cocos2d_EaseQuinticActionIn_prototype;
|
|
|
|
bool js_cocos2dx_EaseQuinticActionIn_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
cocos2d::ActionInterval* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EaseQuinticActionIn_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::EaseQuinticActionIn::create(arg0);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EaseQuinticActionIn>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::EaseQuinticActionIn"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_EaseQuinticActionIn_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_EaseQuinticActionIn_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::EaseQuinticActionIn* cobj = new (std::nothrow) cocos2d::EaseQuinticActionIn();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EaseQuinticActionIn>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::EaseQuinticActionIn"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_EaseQuinticActionIn_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::EaseQuinticActionIn *nobj = new (std::nothrow) cocos2d::EaseQuinticActionIn();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::EaseQuinticActionIn");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_ActionEase_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_EaseQuinticActionIn(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_EaseQuinticActionIn_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_EaseQuinticActionIn_class->name = "EaseQuinticActionIn";
|
|
jsb_cocos2d_EaseQuinticActionIn_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EaseQuinticActionIn_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_EaseQuinticActionIn_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EaseQuinticActionIn_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_EaseQuinticActionIn_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_EaseQuinticActionIn_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_EaseQuinticActionIn_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_EaseQuinticActionIn_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("ctor", js_cocos2dx_EaseQuinticActionIn_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_EaseQuinticActionIn_create, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_ActionEase_prototype);
|
|
jsb_cocos2d_EaseQuinticActionIn_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_EaseQuinticActionIn_class,
|
|
js_cocos2dx_EaseQuinticActionIn_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_EaseQuinticActionIn_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "EaseQuinticActionIn"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::EaseQuinticActionIn>(cx, jsb_cocos2d_EaseQuinticActionIn_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.EaseQuinticActionIn.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_EaseQuinticActionOut_class;
|
|
JSObject *jsb_cocos2d_EaseQuinticActionOut_prototype;
|
|
|
|
bool js_cocos2dx_EaseQuinticActionOut_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
cocos2d::ActionInterval* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EaseQuinticActionOut_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::EaseQuinticActionOut::create(arg0);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EaseQuinticActionOut>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::EaseQuinticActionOut"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_EaseQuinticActionOut_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_EaseQuinticActionOut_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::EaseQuinticActionOut* cobj = new (std::nothrow) cocos2d::EaseQuinticActionOut();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EaseQuinticActionOut>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::EaseQuinticActionOut"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_EaseQuinticActionOut_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::EaseQuinticActionOut *nobj = new (std::nothrow) cocos2d::EaseQuinticActionOut();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::EaseQuinticActionOut");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_ActionEase_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_EaseQuinticActionOut(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_EaseQuinticActionOut_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_EaseQuinticActionOut_class->name = "EaseQuinticActionOut";
|
|
jsb_cocos2d_EaseQuinticActionOut_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EaseQuinticActionOut_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_EaseQuinticActionOut_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EaseQuinticActionOut_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_EaseQuinticActionOut_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_EaseQuinticActionOut_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_EaseQuinticActionOut_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_EaseQuinticActionOut_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("ctor", js_cocos2dx_EaseQuinticActionOut_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_EaseQuinticActionOut_create, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_ActionEase_prototype);
|
|
jsb_cocos2d_EaseQuinticActionOut_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_EaseQuinticActionOut_class,
|
|
js_cocos2dx_EaseQuinticActionOut_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_EaseQuinticActionOut_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "EaseQuinticActionOut"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::EaseQuinticActionOut>(cx, jsb_cocos2d_EaseQuinticActionOut_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.EaseQuinticActionOut.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_EaseQuinticActionInOut_class;
|
|
JSObject *jsb_cocos2d_EaseQuinticActionInOut_prototype;
|
|
|
|
bool js_cocos2dx_EaseQuinticActionInOut_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
cocos2d::ActionInterval* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EaseQuinticActionInOut_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::EaseQuinticActionInOut::create(arg0);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EaseQuinticActionInOut>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::EaseQuinticActionInOut"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_EaseQuinticActionInOut_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_EaseQuinticActionInOut_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::EaseQuinticActionInOut* cobj = new (std::nothrow) cocos2d::EaseQuinticActionInOut();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EaseQuinticActionInOut>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::EaseQuinticActionInOut"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_EaseQuinticActionInOut_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::EaseQuinticActionInOut *nobj = new (std::nothrow) cocos2d::EaseQuinticActionInOut();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::EaseQuinticActionInOut");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_ActionEase_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_EaseQuinticActionInOut(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_EaseQuinticActionInOut_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_EaseQuinticActionInOut_class->name = "EaseQuinticActionInOut";
|
|
jsb_cocos2d_EaseQuinticActionInOut_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EaseQuinticActionInOut_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_EaseQuinticActionInOut_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EaseQuinticActionInOut_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_EaseQuinticActionInOut_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_EaseQuinticActionInOut_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_EaseQuinticActionInOut_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_EaseQuinticActionInOut_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("ctor", js_cocos2dx_EaseQuinticActionInOut_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_EaseQuinticActionInOut_create, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_ActionEase_prototype);
|
|
jsb_cocos2d_EaseQuinticActionInOut_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_EaseQuinticActionInOut_class,
|
|
js_cocos2dx_EaseQuinticActionInOut_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_EaseQuinticActionInOut_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "EaseQuinticActionInOut"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::EaseQuinticActionInOut>(cx, jsb_cocos2d_EaseQuinticActionInOut_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.EaseQuinticActionInOut.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_EaseCircleActionIn_class;
|
|
JSObject *jsb_cocos2d_EaseCircleActionIn_prototype;
|
|
|
|
bool js_cocos2dx_EaseCircleActionIn_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
cocos2d::ActionInterval* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EaseCircleActionIn_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::EaseCircleActionIn::create(arg0);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EaseCircleActionIn>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::EaseCircleActionIn"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_EaseCircleActionIn_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_EaseCircleActionIn_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::EaseCircleActionIn* cobj = new (std::nothrow) cocos2d::EaseCircleActionIn();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EaseCircleActionIn>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::EaseCircleActionIn"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_EaseCircleActionIn_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::EaseCircleActionIn *nobj = new (std::nothrow) cocos2d::EaseCircleActionIn();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::EaseCircleActionIn");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_ActionEase_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_EaseCircleActionIn(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_EaseCircleActionIn_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_EaseCircleActionIn_class->name = "EaseCircleActionIn";
|
|
jsb_cocos2d_EaseCircleActionIn_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EaseCircleActionIn_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_EaseCircleActionIn_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EaseCircleActionIn_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_EaseCircleActionIn_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_EaseCircleActionIn_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_EaseCircleActionIn_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_EaseCircleActionIn_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("ctor", js_cocos2dx_EaseCircleActionIn_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_EaseCircleActionIn_create, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_ActionEase_prototype);
|
|
jsb_cocos2d_EaseCircleActionIn_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_EaseCircleActionIn_class,
|
|
js_cocos2dx_EaseCircleActionIn_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_EaseCircleActionIn_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "EaseCircleActionIn"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::EaseCircleActionIn>(cx, jsb_cocos2d_EaseCircleActionIn_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.EaseCircleActionIn.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_EaseCircleActionOut_class;
|
|
JSObject *jsb_cocos2d_EaseCircleActionOut_prototype;
|
|
|
|
bool js_cocos2dx_EaseCircleActionOut_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
cocos2d::ActionInterval* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EaseCircleActionOut_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::EaseCircleActionOut::create(arg0);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EaseCircleActionOut>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::EaseCircleActionOut"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_EaseCircleActionOut_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_EaseCircleActionOut_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::EaseCircleActionOut* cobj = new (std::nothrow) cocos2d::EaseCircleActionOut();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EaseCircleActionOut>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::EaseCircleActionOut"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_EaseCircleActionOut_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::EaseCircleActionOut *nobj = new (std::nothrow) cocos2d::EaseCircleActionOut();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::EaseCircleActionOut");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_ActionEase_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_EaseCircleActionOut(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_EaseCircleActionOut_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_EaseCircleActionOut_class->name = "EaseCircleActionOut";
|
|
jsb_cocos2d_EaseCircleActionOut_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EaseCircleActionOut_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_EaseCircleActionOut_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EaseCircleActionOut_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_EaseCircleActionOut_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_EaseCircleActionOut_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_EaseCircleActionOut_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_EaseCircleActionOut_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("ctor", js_cocos2dx_EaseCircleActionOut_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_EaseCircleActionOut_create, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_ActionEase_prototype);
|
|
jsb_cocos2d_EaseCircleActionOut_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_EaseCircleActionOut_class,
|
|
js_cocos2dx_EaseCircleActionOut_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_EaseCircleActionOut_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "EaseCircleActionOut"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::EaseCircleActionOut>(cx, jsb_cocos2d_EaseCircleActionOut_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.EaseCircleActionOut.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_EaseCircleActionInOut_class;
|
|
JSObject *jsb_cocos2d_EaseCircleActionInOut_prototype;
|
|
|
|
bool js_cocos2dx_EaseCircleActionInOut_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
cocos2d::ActionInterval* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EaseCircleActionInOut_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::EaseCircleActionInOut::create(arg0);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EaseCircleActionInOut>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::EaseCircleActionInOut"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_EaseCircleActionInOut_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_EaseCircleActionInOut_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::EaseCircleActionInOut* cobj = new (std::nothrow) cocos2d::EaseCircleActionInOut();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EaseCircleActionInOut>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::EaseCircleActionInOut"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_EaseCircleActionInOut_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::EaseCircleActionInOut *nobj = new (std::nothrow) cocos2d::EaseCircleActionInOut();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::EaseCircleActionInOut");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_ActionEase_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_EaseCircleActionInOut(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_EaseCircleActionInOut_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_EaseCircleActionInOut_class->name = "EaseCircleActionInOut";
|
|
jsb_cocos2d_EaseCircleActionInOut_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EaseCircleActionInOut_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_EaseCircleActionInOut_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EaseCircleActionInOut_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_EaseCircleActionInOut_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_EaseCircleActionInOut_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_EaseCircleActionInOut_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_EaseCircleActionInOut_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("ctor", js_cocos2dx_EaseCircleActionInOut_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_EaseCircleActionInOut_create, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_ActionEase_prototype);
|
|
jsb_cocos2d_EaseCircleActionInOut_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_EaseCircleActionInOut_class,
|
|
js_cocos2dx_EaseCircleActionInOut_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_EaseCircleActionInOut_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "EaseCircleActionInOut"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::EaseCircleActionInOut>(cx, jsb_cocos2d_EaseCircleActionInOut_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.EaseCircleActionInOut.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_EaseCubicActionIn_class;
|
|
JSObject *jsb_cocos2d_EaseCubicActionIn_prototype;
|
|
|
|
bool js_cocos2dx_EaseCubicActionIn_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
cocos2d::ActionInterval* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EaseCubicActionIn_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::EaseCubicActionIn::create(arg0);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EaseCubicActionIn>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::EaseCubicActionIn"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_EaseCubicActionIn_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_EaseCubicActionIn_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::EaseCubicActionIn* cobj = new (std::nothrow) cocos2d::EaseCubicActionIn();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EaseCubicActionIn>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::EaseCubicActionIn"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_EaseCubicActionIn_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::EaseCubicActionIn *nobj = new (std::nothrow) cocos2d::EaseCubicActionIn();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::EaseCubicActionIn");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_ActionEase_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_EaseCubicActionIn(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_EaseCubicActionIn_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_EaseCubicActionIn_class->name = "EaseCubicActionIn";
|
|
jsb_cocos2d_EaseCubicActionIn_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EaseCubicActionIn_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_EaseCubicActionIn_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EaseCubicActionIn_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_EaseCubicActionIn_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_EaseCubicActionIn_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_EaseCubicActionIn_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_EaseCubicActionIn_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("ctor", js_cocos2dx_EaseCubicActionIn_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_EaseCubicActionIn_create, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_ActionEase_prototype);
|
|
jsb_cocos2d_EaseCubicActionIn_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_EaseCubicActionIn_class,
|
|
js_cocos2dx_EaseCubicActionIn_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_EaseCubicActionIn_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "EaseCubicActionIn"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::EaseCubicActionIn>(cx, jsb_cocos2d_EaseCubicActionIn_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.EaseCubicActionIn.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_EaseCubicActionOut_class;
|
|
JSObject *jsb_cocos2d_EaseCubicActionOut_prototype;
|
|
|
|
bool js_cocos2dx_EaseCubicActionOut_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
cocos2d::ActionInterval* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EaseCubicActionOut_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::EaseCubicActionOut::create(arg0);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EaseCubicActionOut>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::EaseCubicActionOut"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_EaseCubicActionOut_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_EaseCubicActionOut_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::EaseCubicActionOut* cobj = new (std::nothrow) cocos2d::EaseCubicActionOut();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EaseCubicActionOut>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::EaseCubicActionOut"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_EaseCubicActionOut_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::EaseCubicActionOut *nobj = new (std::nothrow) cocos2d::EaseCubicActionOut();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::EaseCubicActionOut");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_ActionEase_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_EaseCubicActionOut(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_EaseCubicActionOut_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_EaseCubicActionOut_class->name = "EaseCubicActionOut";
|
|
jsb_cocos2d_EaseCubicActionOut_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EaseCubicActionOut_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_EaseCubicActionOut_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EaseCubicActionOut_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_EaseCubicActionOut_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_EaseCubicActionOut_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_EaseCubicActionOut_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_EaseCubicActionOut_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("ctor", js_cocos2dx_EaseCubicActionOut_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_EaseCubicActionOut_create, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_ActionEase_prototype);
|
|
jsb_cocos2d_EaseCubicActionOut_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_EaseCubicActionOut_class,
|
|
js_cocos2dx_EaseCubicActionOut_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_EaseCubicActionOut_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "EaseCubicActionOut"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::EaseCubicActionOut>(cx, jsb_cocos2d_EaseCubicActionOut_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.EaseCubicActionOut.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_EaseCubicActionInOut_class;
|
|
JSObject *jsb_cocos2d_EaseCubicActionInOut_prototype;
|
|
|
|
bool js_cocos2dx_EaseCubicActionInOut_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
cocos2d::ActionInterval* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EaseCubicActionInOut_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::EaseCubicActionInOut::create(arg0);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EaseCubicActionInOut>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::EaseCubicActionInOut"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_EaseCubicActionInOut_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_EaseCubicActionInOut_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::EaseCubicActionInOut* cobj = new (std::nothrow) cocos2d::EaseCubicActionInOut();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EaseCubicActionInOut>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::EaseCubicActionInOut"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_EaseCubicActionInOut_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::EaseCubicActionInOut *nobj = new (std::nothrow) cocos2d::EaseCubicActionInOut();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::EaseCubicActionInOut");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_ActionEase_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_EaseCubicActionInOut(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_EaseCubicActionInOut_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_EaseCubicActionInOut_class->name = "EaseCubicActionInOut";
|
|
jsb_cocos2d_EaseCubicActionInOut_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EaseCubicActionInOut_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_EaseCubicActionInOut_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EaseCubicActionInOut_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_EaseCubicActionInOut_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_EaseCubicActionInOut_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_EaseCubicActionInOut_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_EaseCubicActionInOut_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("ctor", js_cocos2dx_EaseCubicActionInOut_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_EaseCubicActionInOut_create, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_ActionEase_prototype);
|
|
jsb_cocos2d_EaseCubicActionInOut_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_EaseCubicActionInOut_class,
|
|
js_cocos2dx_EaseCubicActionInOut_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_EaseCubicActionInOut_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "EaseCubicActionInOut"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::EaseCubicActionInOut>(cx, jsb_cocos2d_EaseCubicActionInOut_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.EaseCubicActionInOut.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_EaseIn_class;
|
|
JSObject *jsb_cocos2d_EaseIn_prototype;
|
|
|
|
bool js_cocos2dx_EaseIn_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 2) {
|
|
cocos2d::ActionInterval* arg0 = nullptr;
|
|
double arg1 = 0;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EaseIn_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::EaseIn::create(arg0, arg1);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EaseIn>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::EaseIn"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_EaseIn_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_EaseIn_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::EaseIn* cobj = new (std::nothrow) cocos2d::EaseIn();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EaseIn>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::EaseIn"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_EaseIn_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::EaseIn *nobj = new (std::nothrow) cocos2d::EaseIn();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::EaseIn");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_EaseRateAction_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_EaseIn(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_EaseIn_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_EaseIn_class->name = "EaseIn";
|
|
jsb_cocos2d_EaseIn_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EaseIn_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_EaseIn_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EaseIn_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_EaseIn_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_EaseIn_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_EaseIn_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_EaseIn_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("ctor", js_cocos2dx_EaseIn_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_EaseIn_create, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_EaseRateAction_prototype);
|
|
jsb_cocos2d_EaseIn_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_EaseIn_class,
|
|
js_cocos2dx_EaseIn_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_EaseIn_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "EaseIn"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::EaseIn>(cx, jsb_cocos2d_EaseIn_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.EaseIn.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_EaseOut_class;
|
|
JSObject *jsb_cocos2d_EaseOut_prototype;
|
|
|
|
bool js_cocos2dx_EaseOut_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 2) {
|
|
cocos2d::ActionInterval* arg0 = nullptr;
|
|
double arg1 = 0;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EaseOut_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::EaseOut::create(arg0, arg1);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EaseOut>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::EaseOut"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_EaseOut_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_EaseOut_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::EaseOut* cobj = new (std::nothrow) cocos2d::EaseOut();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EaseOut>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::EaseOut"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_EaseOut_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::EaseOut *nobj = new (std::nothrow) cocos2d::EaseOut();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::EaseOut");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_EaseRateAction_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_EaseOut(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_EaseOut_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_EaseOut_class->name = "EaseOut";
|
|
jsb_cocos2d_EaseOut_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EaseOut_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_EaseOut_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EaseOut_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_EaseOut_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_EaseOut_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_EaseOut_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_EaseOut_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("ctor", js_cocos2dx_EaseOut_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_EaseOut_create, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_EaseRateAction_prototype);
|
|
jsb_cocos2d_EaseOut_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_EaseOut_class,
|
|
js_cocos2dx_EaseOut_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_EaseOut_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "EaseOut"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::EaseOut>(cx, jsb_cocos2d_EaseOut_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.EaseOut.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_EaseInOut_class;
|
|
JSObject *jsb_cocos2d_EaseInOut_prototype;
|
|
|
|
bool js_cocos2dx_EaseInOut_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 2) {
|
|
cocos2d::ActionInterval* arg0 = nullptr;
|
|
double arg1 = 0;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EaseInOut_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::EaseInOut::create(arg0, arg1);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EaseInOut>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::EaseInOut"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_EaseInOut_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_EaseInOut_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::EaseInOut* cobj = new (std::nothrow) cocos2d::EaseInOut();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EaseInOut>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::EaseInOut"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_EaseInOut_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::EaseInOut *nobj = new (std::nothrow) cocos2d::EaseInOut();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::EaseInOut");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_EaseRateAction_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_EaseInOut(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_EaseInOut_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_EaseInOut_class->name = "EaseInOut";
|
|
jsb_cocos2d_EaseInOut_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EaseInOut_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_EaseInOut_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EaseInOut_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_EaseInOut_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_EaseInOut_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_EaseInOut_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_EaseInOut_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("ctor", js_cocos2dx_EaseInOut_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_EaseInOut_create, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_EaseRateAction_prototype);
|
|
jsb_cocos2d_EaseInOut_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_EaseInOut_class,
|
|
js_cocos2dx_EaseInOut_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_EaseInOut_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "EaseInOut"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::EaseInOut>(cx, jsb_cocos2d_EaseInOut_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.EaseInOut.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_EaseElastic_class;
|
|
JSObject *jsb_cocos2d_EaseElastic_prototype;
|
|
|
|
bool js_cocos2dx_EaseElastic_setPeriod(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::EaseElastic* cobj = (cocos2d::EaseElastic *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EaseElastic_setPeriod : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EaseElastic_setPeriod : Error processing arguments");
|
|
cobj->setPeriod(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_EaseElastic_setPeriod : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_EaseElastic_initWithAction(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::EaseElastic* cobj = (cocos2d::EaseElastic *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EaseElastic_initWithAction : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::ActionInterval* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EaseElastic_initWithAction : Error processing arguments");
|
|
bool ret = cobj->initWithAction(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
if (argc == 2) {
|
|
cocos2d::ActionInterval* arg0 = nullptr;
|
|
double arg1 = 0;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EaseElastic_initWithAction : Error processing arguments");
|
|
bool ret = cobj->initWithAction(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_EaseElastic_initWithAction : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_EaseElastic_getPeriod(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::EaseElastic* cobj = (cocos2d::EaseElastic *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EaseElastic_getPeriod : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getPeriod();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_EaseElastic_getPeriod : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
|
|
extern JSObject *jsb_cocos2d_ActionEase_prototype;
|
|
|
|
void js_register_cocos2dx_EaseElastic(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_EaseElastic_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_EaseElastic_class->name = "EaseElastic";
|
|
jsb_cocos2d_EaseElastic_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EaseElastic_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_EaseElastic_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EaseElastic_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_EaseElastic_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_EaseElastic_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_EaseElastic_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_EaseElastic_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("setPeriod", js_cocos2dx_EaseElastic_setPeriod, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initWithAction", js_cocos2dx_EaseElastic_initWithAction, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getPeriod", js_cocos2dx_EaseElastic_getPeriod, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JSFunctionSpec *st_funcs = NULL;
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_ActionEase_prototype);
|
|
jsb_cocos2d_EaseElastic_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_EaseElastic_class,
|
|
empty_constructor, 0,
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_EaseElastic_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "EaseElastic"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::EaseElastic>(cx, jsb_cocos2d_EaseElastic_class, proto, parent_proto);
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_EaseElasticIn_class;
|
|
JSObject *jsb_cocos2d_EaseElasticIn_prototype;
|
|
|
|
bool js_cocos2dx_EaseElasticIn_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
cocos2d::ActionInterval* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EaseElasticIn_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::EaseElasticIn::create(arg0);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EaseElasticIn>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::EaseElasticIn"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
if (argc == 2) {
|
|
cocos2d::ActionInterval* arg0 = nullptr;
|
|
double arg1 = 0;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EaseElasticIn_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::EaseElasticIn::create(arg0, arg1);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EaseElasticIn>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::EaseElasticIn"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_EaseElasticIn_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_EaseElasticIn_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::EaseElasticIn* cobj = new (std::nothrow) cocos2d::EaseElasticIn();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EaseElasticIn>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::EaseElasticIn"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_EaseElasticIn_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::EaseElasticIn *nobj = new (std::nothrow) cocos2d::EaseElasticIn();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::EaseElasticIn");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_EaseElastic_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_EaseElasticIn(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_EaseElasticIn_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_EaseElasticIn_class->name = "EaseElasticIn";
|
|
jsb_cocos2d_EaseElasticIn_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EaseElasticIn_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_EaseElasticIn_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EaseElasticIn_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_EaseElasticIn_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_EaseElasticIn_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_EaseElasticIn_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_EaseElasticIn_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("ctor", js_cocos2dx_EaseElasticIn_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_EaseElasticIn_create, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_EaseElastic_prototype);
|
|
jsb_cocos2d_EaseElasticIn_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_EaseElasticIn_class,
|
|
js_cocos2dx_EaseElasticIn_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_EaseElasticIn_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "EaseElasticIn"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::EaseElasticIn>(cx, jsb_cocos2d_EaseElasticIn_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.EaseElasticIn.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_EaseElasticOut_class;
|
|
JSObject *jsb_cocos2d_EaseElasticOut_prototype;
|
|
|
|
bool js_cocos2dx_EaseElasticOut_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
cocos2d::ActionInterval* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EaseElasticOut_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::EaseElasticOut::create(arg0);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EaseElasticOut>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::EaseElasticOut"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
if (argc == 2) {
|
|
cocos2d::ActionInterval* arg0 = nullptr;
|
|
double arg1 = 0;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EaseElasticOut_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::EaseElasticOut::create(arg0, arg1);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EaseElasticOut>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::EaseElasticOut"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_EaseElasticOut_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_EaseElasticOut_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::EaseElasticOut* cobj = new (std::nothrow) cocos2d::EaseElasticOut();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EaseElasticOut>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::EaseElasticOut"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_EaseElasticOut_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::EaseElasticOut *nobj = new (std::nothrow) cocos2d::EaseElasticOut();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::EaseElasticOut");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_EaseElastic_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_EaseElasticOut(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_EaseElasticOut_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_EaseElasticOut_class->name = "EaseElasticOut";
|
|
jsb_cocos2d_EaseElasticOut_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EaseElasticOut_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_EaseElasticOut_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EaseElasticOut_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_EaseElasticOut_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_EaseElasticOut_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_EaseElasticOut_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_EaseElasticOut_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("ctor", js_cocos2dx_EaseElasticOut_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_EaseElasticOut_create, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_EaseElastic_prototype);
|
|
jsb_cocos2d_EaseElasticOut_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_EaseElasticOut_class,
|
|
js_cocos2dx_EaseElasticOut_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_EaseElasticOut_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "EaseElasticOut"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::EaseElasticOut>(cx, jsb_cocos2d_EaseElasticOut_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.EaseElasticOut.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_EaseElasticInOut_class;
|
|
JSObject *jsb_cocos2d_EaseElasticInOut_prototype;
|
|
|
|
bool js_cocos2dx_EaseElasticInOut_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
cocos2d::ActionInterval* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EaseElasticInOut_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::EaseElasticInOut::create(arg0);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EaseElasticInOut>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::EaseElasticInOut"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
if (argc == 2) {
|
|
cocos2d::ActionInterval* arg0 = nullptr;
|
|
double arg1 = 0;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EaseElasticInOut_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::EaseElasticInOut::create(arg0, arg1);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EaseElasticInOut>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::EaseElasticInOut"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_EaseElasticInOut_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_EaseElasticInOut_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::EaseElasticInOut* cobj = new (std::nothrow) cocos2d::EaseElasticInOut();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EaseElasticInOut>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::EaseElasticInOut"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_EaseElasticInOut_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::EaseElasticInOut *nobj = new (std::nothrow) cocos2d::EaseElasticInOut();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::EaseElasticInOut");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_EaseElastic_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_EaseElasticInOut(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_EaseElasticInOut_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_EaseElasticInOut_class->name = "EaseElasticInOut";
|
|
jsb_cocos2d_EaseElasticInOut_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EaseElasticInOut_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_EaseElasticInOut_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EaseElasticInOut_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_EaseElasticInOut_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_EaseElasticInOut_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_EaseElasticInOut_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_EaseElasticInOut_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("ctor", js_cocos2dx_EaseElasticInOut_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_EaseElasticInOut_create, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_EaseElastic_prototype);
|
|
jsb_cocos2d_EaseElasticInOut_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_EaseElasticInOut_class,
|
|
js_cocos2dx_EaseElasticInOut_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_EaseElasticInOut_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "EaseElasticInOut"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::EaseElasticInOut>(cx, jsb_cocos2d_EaseElasticInOut_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.EaseElasticInOut.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_EaseBezierAction_class;
|
|
JSObject *jsb_cocos2d_EaseBezierAction_prototype;
|
|
|
|
bool js_cocos2dx_EaseBezierAction_setBezierParamer(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::EaseBezierAction* cobj = (cocos2d::EaseBezierAction *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_EaseBezierAction_setBezierParamer : Invalid Native Object");
|
|
if (argc == 4) {
|
|
double arg0 = 0;
|
|
double arg1 = 0;
|
|
double arg2 = 0;
|
|
double arg3 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
ok &= JS::ToNumber( cx, args.get(3), &arg3) && !std::isnan(arg3);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EaseBezierAction_setBezierParamer : Error processing arguments");
|
|
cobj->setBezierParamer(arg0, arg1, arg2, arg3);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_EaseBezierAction_setBezierParamer : wrong number of arguments: %d, was expecting %d", argc, 4);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_EaseBezierAction_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
cocos2d::ActionInterval* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_EaseBezierAction_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::EaseBezierAction::create(arg0);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EaseBezierAction>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::EaseBezierAction"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_EaseBezierAction_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_EaseBezierAction_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::EaseBezierAction* cobj = new (std::nothrow) cocos2d::EaseBezierAction();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::EaseBezierAction>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::EaseBezierAction"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_EaseBezierAction_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::EaseBezierAction *nobj = new (std::nothrow) cocos2d::EaseBezierAction();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::EaseBezierAction");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_ActionEase_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_EaseBezierAction(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_EaseBezierAction_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_EaseBezierAction_class->name = "EaseBezierAction";
|
|
jsb_cocos2d_EaseBezierAction_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EaseBezierAction_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_EaseBezierAction_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_EaseBezierAction_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_EaseBezierAction_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_EaseBezierAction_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_EaseBezierAction_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_EaseBezierAction_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("setBezierParamer", js_cocos2dx_EaseBezierAction_setBezierParamer, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_EaseBezierAction_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_EaseBezierAction_create, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_ActionEase_prototype);
|
|
jsb_cocos2d_EaseBezierAction_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_EaseBezierAction_class,
|
|
js_cocos2dx_EaseBezierAction_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_EaseBezierAction_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "EaseBezierAction"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::EaseBezierAction>(cx, jsb_cocos2d_EaseBezierAction_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.EaseBezierAction.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_ActionInstant_class;
|
|
JSObject *jsb_cocos2d_ActionInstant_prototype;
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_FiniteTimeAction_prototype;
|
|
|
|
void js_register_cocos2dx_ActionInstant(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_ActionInstant_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_ActionInstant_class->name = "ActionInstant";
|
|
jsb_cocos2d_ActionInstant_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_ActionInstant_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_ActionInstant_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_ActionInstant_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_ActionInstant_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_ActionInstant_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_ActionInstant_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_ActionInstant_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FS_END
|
|
};
|
|
|
|
JSFunctionSpec *st_funcs = NULL;
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_FiniteTimeAction_prototype);
|
|
jsb_cocos2d_ActionInstant_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_ActionInstant_class,
|
|
empty_constructor, 0,
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_ActionInstant_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "ActionInstant"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::ActionInstant>(cx, jsb_cocos2d_ActionInstant_class, proto, parent_proto);
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_Show_class;
|
|
JSObject *jsb_cocos2d_Show_prototype;
|
|
|
|
bool js_cocos2dx_Show_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
if (argc == 0) {
|
|
|
|
auto ret = cocos2d::Show::create();
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::Show>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::Show"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_Show_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_Show_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::Show* cobj = new (std::nothrow) cocos2d::Show();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::Show>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::Show"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_Show_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::Show *nobj = new (std::nothrow) cocos2d::Show();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::Show");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_ActionInstant_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_Show(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_Show_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_Show_class->name = "Show";
|
|
jsb_cocos2d_Show_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Show_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_Show_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Show_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_Show_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_Show_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_Show_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_Show_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("ctor", js_cocos2dx_Show_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_Show_create, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_ActionInstant_prototype);
|
|
jsb_cocos2d_Show_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_Show_class,
|
|
js_cocos2dx_Show_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_Show_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "Show"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::Show>(cx, jsb_cocos2d_Show_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.Show.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_Hide_class;
|
|
JSObject *jsb_cocos2d_Hide_prototype;
|
|
|
|
bool js_cocos2dx_Hide_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
if (argc == 0) {
|
|
|
|
auto ret = cocos2d::Hide::create();
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::Hide>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::Hide"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_Hide_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_Hide_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::Hide* cobj = new (std::nothrow) cocos2d::Hide();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::Hide>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::Hide"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_Hide_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::Hide *nobj = new (std::nothrow) cocos2d::Hide();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::Hide");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_ActionInstant_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_Hide(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_Hide_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_Hide_class->name = "Hide";
|
|
jsb_cocos2d_Hide_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Hide_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_Hide_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Hide_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_Hide_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_Hide_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_Hide_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_Hide_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("ctor", js_cocos2dx_Hide_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_Hide_create, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_ActionInstant_prototype);
|
|
jsb_cocos2d_Hide_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_Hide_class,
|
|
js_cocos2dx_Hide_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_Hide_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "Hide"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::Hide>(cx, jsb_cocos2d_Hide_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.Hide.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_ToggleVisibility_class;
|
|
JSObject *jsb_cocos2d_ToggleVisibility_prototype;
|
|
|
|
bool js_cocos2dx_ToggleVisibility_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
if (argc == 0) {
|
|
|
|
auto ret = cocos2d::ToggleVisibility::create();
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::ToggleVisibility>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::ToggleVisibility"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_ToggleVisibility_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_ToggleVisibility_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::ToggleVisibility* cobj = new (std::nothrow) cocos2d::ToggleVisibility();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::ToggleVisibility>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::ToggleVisibility"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_ActionInstant_prototype;
|
|
|
|
void js_register_cocos2dx_ToggleVisibility(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_ToggleVisibility_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_ToggleVisibility_class->name = "ToggleVisibility";
|
|
jsb_cocos2d_ToggleVisibility_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_ToggleVisibility_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_ToggleVisibility_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_ToggleVisibility_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_ToggleVisibility_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_ToggleVisibility_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_ToggleVisibility_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_ToggleVisibility_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_ToggleVisibility_create, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_ActionInstant_prototype);
|
|
jsb_cocos2d_ToggleVisibility_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_ToggleVisibility_class,
|
|
js_cocos2dx_ToggleVisibility_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_ToggleVisibility_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "ToggleVisibility"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::ToggleVisibility>(cx, jsb_cocos2d_ToggleVisibility_class, proto, parent_proto);
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_RemoveSelf_class;
|
|
JSObject *jsb_cocos2d_RemoveSelf_prototype;
|
|
|
|
bool js_cocos2dx_RemoveSelf_init(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::RemoveSelf* cobj = (cocos2d::RemoveSelf *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_RemoveSelf_init : Invalid Native Object");
|
|
if (argc == 1) {
|
|
bool arg0;
|
|
arg0 = JS::ToBoolean(args.get(0));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_RemoveSelf_init : Error processing arguments");
|
|
bool ret = cobj->init(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_RemoveSelf_init : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_RemoveSelf_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 0) {
|
|
|
|
auto ret = cocos2d::RemoveSelf::create();
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::RemoveSelf>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::RemoveSelf"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
if (argc == 1) {
|
|
bool arg0;
|
|
arg0 = JS::ToBoolean(args.get(0));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_RemoveSelf_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::RemoveSelf::create(arg0);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::RemoveSelf>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::RemoveSelf"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_RemoveSelf_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_RemoveSelf_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::RemoveSelf* cobj = new (std::nothrow) cocos2d::RemoveSelf();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::RemoveSelf>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::RemoveSelf"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_ActionInstant_prototype;
|
|
|
|
void js_register_cocos2dx_RemoveSelf(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_RemoveSelf_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_RemoveSelf_class->name = "RemoveSelf";
|
|
jsb_cocos2d_RemoveSelf_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_RemoveSelf_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_RemoveSelf_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_RemoveSelf_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_RemoveSelf_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_RemoveSelf_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_RemoveSelf_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_RemoveSelf_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("init", js_cocos2dx_RemoveSelf_init, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_RemoveSelf_create, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_ActionInstant_prototype);
|
|
jsb_cocos2d_RemoveSelf_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_RemoveSelf_class,
|
|
js_cocos2dx_RemoveSelf_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_RemoveSelf_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "RemoveSelf"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::RemoveSelf>(cx, jsb_cocos2d_RemoveSelf_class, proto, parent_proto);
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_FlipX_class;
|
|
JSObject *jsb_cocos2d_FlipX_prototype;
|
|
|
|
bool js_cocos2dx_FlipX_initWithFlipX(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::FlipX* cobj = (cocos2d::FlipX *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FlipX_initWithFlipX : Invalid Native Object");
|
|
if (argc == 1) {
|
|
bool arg0;
|
|
arg0 = JS::ToBoolean(args.get(0));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FlipX_initWithFlipX : Error processing arguments");
|
|
bool ret = cobj->initWithFlipX(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_FlipX_initWithFlipX : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_FlipX_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
bool arg0;
|
|
arg0 = JS::ToBoolean(args.get(0));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FlipX_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::FlipX::create(arg0);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::FlipX>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::FlipX"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_FlipX_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_FlipX_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::FlipX* cobj = new (std::nothrow) cocos2d::FlipX();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::FlipX>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::FlipX"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_FlipX_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::FlipX *nobj = new (std::nothrow) cocos2d::FlipX();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::FlipX");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_ActionInstant_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_FlipX(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_FlipX_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_FlipX_class->name = "FlipX";
|
|
jsb_cocos2d_FlipX_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_FlipX_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_FlipX_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_FlipX_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_FlipX_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_FlipX_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_FlipX_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_FlipX_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("initWithFlipX", js_cocos2dx_FlipX_initWithFlipX, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_FlipX_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_FlipX_create, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_ActionInstant_prototype);
|
|
jsb_cocos2d_FlipX_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_FlipX_class,
|
|
js_cocos2dx_FlipX_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_FlipX_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "FlipX"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::FlipX>(cx, jsb_cocos2d_FlipX_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.FlipX.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_FlipY_class;
|
|
JSObject *jsb_cocos2d_FlipY_prototype;
|
|
|
|
bool js_cocos2dx_FlipY_initWithFlipY(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::FlipY* cobj = (cocos2d::FlipY *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FlipY_initWithFlipY : Invalid Native Object");
|
|
if (argc == 1) {
|
|
bool arg0;
|
|
arg0 = JS::ToBoolean(args.get(0));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FlipY_initWithFlipY : Error processing arguments");
|
|
bool ret = cobj->initWithFlipY(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_FlipY_initWithFlipY : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_FlipY_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
bool arg0;
|
|
arg0 = JS::ToBoolean(args.get(0));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FlipY_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::FlipY::create(arg0);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::FlipY>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::FlipY"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_FlipY_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_FlipY_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::FlipY* cobj = new (std::nothrow) cocos2d::FlipY();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::FlipY>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::FlipY"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_FlipY_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::FlipY *nobj = new (std::nothrow) cocos2d::FlipY();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::FlipY");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_ActionInstant_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_FlipY(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_FlipY_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_FlipY_class->name = "FlipY";
|
|
jsb_cocos2d_FlipY_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_FlipY_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_FlipY_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_FlipY_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_FlipY_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_FlipY_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_FlipY_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_FlipY_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("initWithFlipY", js_cocos2dx_FlipY_initWithFlipY, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_FlipY_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_FlipY_create, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_ActionInstant_prototype);
|
|
jsb_cocos2d_FlipY_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_FlipY_class,
|
|
js_cocos2dx_FlipY_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_FlipY_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "FlipY"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::FlipY>(cx, jsb_cocos2d_FlipY_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.FlipY.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_Place_class;
|
|
JSObject *jsb_cocos2d_Place_prototype;
|
|
|
|
bool js_cocos2dx_Place_initWithPosition(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Place* cobj = (cocos2d::Place *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Place_initWithPosition : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Vec2 arg0;
|
|
ok &= jsval_to_vector2(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Place_initWithPosition : Error processing arguments");
|
|
bool ret = cobj->initWithPosition(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Place_initWithPosition : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Place_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
cocos2d::Vec2 arg0;
|
|
ok &= jsval_to_vector2(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Place_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::Place::create(arg0);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::Place>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::Place"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_Place_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_Place_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::Place* cobj = new (std::nothrow) cocos2d::Place();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::Place>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::Place"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_Place_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::Place *nobj = new (std::nothrow) cocos2d::Place();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::Place");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_ActionInstant_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_Place(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_Place_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_Place_class->name = "Place";
|
|
jsb_cocos2d_Place_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Place_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_Place_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Place_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_Place_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_Place_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_Place_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_Place_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("initWithPosition", js_cocos2dx_Place_initWithPosition, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_Place_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_Place_create, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_ActionInstant_prototype);
|
|
jsb_cocos2d_Place_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_Place_class,
|
|
js_cocos2dx_Place_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_Place_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "Place"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::Place>(cx, jsb_cocos2d_Place_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.Place.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_CallFunc_class;
|
|
JSObject *jsb_cocos2d_CallFunc_prototype;
|
|
|
|
bool js_cocos2dx_CallFunc_execute(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::CallFunc* cobj = (cocos2d::CallFunc *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_CallFunc_execute : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->execute();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_CallFunc_execute : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_CallFunc_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::CallFunc* cobj = new (std::nothrow) cocos2d::CallFunc();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::CallFunc>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::CallFunc"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_CallFunc_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::CallFunc *nobj = new (std::nothrow) cocos2d::CallFunc();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::CallFunc");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_ActionInstant_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_CallFunc(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_CallFunc_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_CallFunc_class->name = "_CallFunc";
|
|
jsb_cocos2d_CallFunc_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_CallFunc_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_CallFunc_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_CallFunc_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_CallFunc_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_CallFunc_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_CallFunc_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_CallFunc_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("execute", js_cocos2dx_CallFunc_execute, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_CallFunc_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JSFunctionSpec *st_funcs = NULL;
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_ActionInstant_prototype);
|
|
jsb_cocos2d_CallFunc_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_CallFunc_class,
|
|
js_cocos2dx_CallFunc_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_CallFunc_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "CallFunc"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::CallFunc>(cx, jsb_cocos2d_CallFunc_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc._CallFunc.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_CallFuncN_class;
|
|
JSObject *jsb_cocos2d_CallFuncN_prototype;
|
|
|
|
bool js_cocos2dx_CallFuncN_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::CallFuncN* cobj = new (std::nothrow) cocos2d::CallFuncN();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::CallFuncN>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::CallFuncN"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_CallFuncN_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::CallFuncN *nobj = new (std::nothrow) cocos2d::CallFuncN();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::CallFuncN");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_CallFunc_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_CallFuncN(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_CallFuncN_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_CallFuncN_class->name = "CallFunc";
|
|
jsb_cocos2d_CallFuncN_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_CallFuncN_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_CallFuncN_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_CallFuncN_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_CallFuncN_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_CallFuncN_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_CallFuncN_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_CallFuncN_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("ctor", js_cocos2dx_CallFuncN_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JSFunctionSpec *st_funcs = NULL;
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_CallFunc_prototype);
|
|
jsb_cocos2d_CallFuncN_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_CallFuncN_class,
|
|
js_cocos2dx_CallFuncN_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_CallFuncN_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "CallFuncN"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::CallFuncN>(cx, jsb_cocos2d_CallFuncN_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.CallFunc.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_GridAction_class;
|
|
JSObject *jsb_cocos2d_GridAction_prototype;
|
|
|
|
bool js_cocos2dx_GridAction_getGrid(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GridAction* cobj = (cocos2d::GridAction *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GridAction_getGrid : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::GridBase* ret = cobj->getGrid();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::GridBase>(cx, (cocos2d::GridBase*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GridAction_getGrid : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GridAction_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GridAction* cobj = (cocos2d::GridAction *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GridAction_initWithDuration : Invalid Native Object");
|
|
if (argc == 2) {
|
|
double arg0 = 0;
|
|
cocos2d::Size arg1;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
ok &= jsval_to_ccsize(cx, args.get(1), &arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_GridAction_initWithDuration : Error processing arguments");
|
|
bool ret = cobj->initWithDuration(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GridAction_initWithDuration : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
|
|
extern JSObject *jsb_cocos2d_ActionInterval_prototype;
|
|
|
|
void js_register_cocos2dx_GridAction(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_GridAction_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_GridAction_class->name = "GridAction";
|
|
jsb_cocos2d_GridAction_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_GridAction_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_GridAction_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_GridAction_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_GridAction_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_GridAction_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_GridAction_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_GridAction_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("getGrid", js_cocos2dx_GridAction_getGrid, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initWithDuration", js_cocos2dx_GridAction_initWithDuration, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JSFunctionSpec *st_funcs = NULL;
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_ActionInterval_prototype);
|
|
jsb_cocos2d_GridAction_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_GridAction_class,
|
|
empty_constructor, 0,
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_GridAction_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "GridAction"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::GridAction>(cx, jsb_cocos2d_GridAction_class, proto, parent_proto);
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_Grid3DAction_class;
|
|
JSObject *jsb_cocos2d_Grid3DAction_prototype;
|
|
|
|
bool js_cocos2dx_Grid3DAction_getGridRect(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Grid3DAction* cobj = (cocos2d::Grid3DAction *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Grid3DAction_getGridRect : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::Rect ret = cobj->getGridRect();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ccrect_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Grid3DAction_getGridRect : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
|
|
extern JSObject *jsb_cocos2d_GridAction_prototype;
|
|
|
|
void js_register_cocos2dx_Grid3DAction(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_Grid3DAction_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_Grid3DAction_class->name = "Grid3DAction";
|
|
jsb_cocos2d_Grid3DAction_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Grid3DAction_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_Grid3DAction_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Grid3DAction_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_Grid3DAction_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_Grid3DAction_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_Grid3DAction_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_Grid3DAction_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("getGridRect", js_cocos2dx_Grid3DAction_getGridRect, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JSFunctionSpec *st_funcs = NULL;
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_GridAction_prototype);
|
|
jsb_cocos2d_Grid3DAction_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_Grid3DAction_class,
|
|
empty_constructor, 0,
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_Grid3DAction_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "Grid3DAction"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::Grid3DAction>(cx, jsb_cocos2d_Grid3DAction_class, proto, parent_proto);
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_TiledGrid3DAction_class;
|
|
JSObject *jsb_cocos2d_TiledGrid3DAction_prototype;
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_GridAction_prototype;
|
|
|
|
void js_register_cocos2dx_TiledGrid3DAction(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_TiledGrid3DAction_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_TiledGrid3DAction_class->name = "TiledGrid3DAction";
|
|
jsb_cocos2d_TiledGrid3DAction_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TiledGrid3DAction_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_TiledGrid3DAction_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TiledGrid3DAction_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_TiledGrid3DAction_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_TiledGrid3DAction_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_TiledGrid3DAction_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_TiledGrid3DAction_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FS_END
|
|
};
|
|
|
|
JSFunctionSpec *st_funcs = NULL;
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_GridAction_prototype);
|
|
jsb_cocos2d_TiledGrid3DAction_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_TiledGrid3DAction_class,
|
|
empty_constructor, 0,
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_TiledGrid3DAction_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "TiledGrid3DAction"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::TiledGrid3DAction>(cx, jsb_cocos2d_TiledGrid3DAction_class, proto, parent_proto);
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_StopGrid_class;
|
|
JSObject *jsb_cocos2d_StopGrid_prototype;
|
|
|
|
bool js_cocos2dx_StopGrid_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
if (argc == 0) {
|
|
|
|
auto ret = cocos2d::StopGrid::create();
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::StopGrid>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::StopGrid"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_StopGrid_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_StopGrid_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::StopGrid* cobj = new (std::nothrow) cocos2d::StopGrid();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::StopGrid>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::StopGrid"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_ActionInstant_prototype;
|
|
|
|
void js_register_cocos2dx_StopGrid(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_StopGrid_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_StopGrid_class->name = "StopGrid";
|
|
jsb_cocos2d_StopGrid_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_StopGrid_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_StopGrid_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_StopGrid_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_StopGrid_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_StopGrid_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_StopGrid_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_StopGrid_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_StopGrid_create, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_ActionInstant_prototype);
|
|
jsb_cocos2d_StopGrid_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_StopGrid_class,
|
|
js_cocos2dx_StopGrid_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_StopGrid_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "StopGrid"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::StopGrid>(cx, jsb_cocos2d_StopGrid_class, proto, parent_proto);
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_ReuseGrid_class;
|
|
JSObject *jsb_cocos2d_ReuseGrid_prototype;
|
|
|
|
bool js_cocos2dx_ReuseGrid_initWithTimes(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ReuseGrid* cobj = (cocos2d::ReuseGrid *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ReuseGrid_initWithTimes : Invalid Native Object");
|
|
if (argc == 1) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ReuseGrid_initWithTimes : Error processing arguments");
|
|
bool ret = cobj->initWithTimes(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ReuseGrid_initWithTimes : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ReuseGrid_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ReuseGrid_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::ReuseGrid::create(arg0);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::ReuseGrid>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::ReuseGrid"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_ReuseGrid_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_ReuseGrid_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::ReuseGrid* cobj = new (std::nothrow) cocos2d::ReuseGrid();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::ReuseGrid>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::ReuseGrid"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_ActionInstant_prototype;
|
|
|
|
void js_register_cocos2dx_ReuseGrid(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_ReuseGrid_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_ReuseGrid_class->name = "ReuseGrid";
|
|
jsb_cocos2d_ReuseGrid_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_ReuseGrid_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_ReuseGrid_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_ReuseGrid_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_ReuseGrid_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_ReuseGrid_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_ReuseGrid_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_ReuseGrid_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("initWithTimes", js_cocos2dx_ReuseGrid_initWithTimes, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_ReuseGrid_create, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_ActionInstant_prototype);
|
|
jsb_cocos2d_ReuseGrid_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_ReuseGrid_class,
|
|
js_cocos2dx_ReuseGrid_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_ReuseGrid_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "ReuseGrid"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::ReuseGrid>(cx, jsb_cocos2d_ReuseGrid_class, proto, parent_proto);
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_Waves3D_class;
|
|
JSObject *jsb_cocos2d_Waves3D_prototype;
|
|
|
|
bool js_cocos2dx_Waves3D_setAmplitudeRate(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Waves3D* cobj = (cocos2d::Waves3D *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Waves3D_setAmplitudeRate : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Waves3D_setAmplitudeRate : Error processing arguments");
|
|
cobj->setAmplitudeRate(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Waves3D_setAmplitudeRate : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Waves3D_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Waves3D* cobj = (cocos2d::Waves3D *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Waves3D_initWithDuration : Invalid Native Object");
|
|
if (argc == 4) {
|
|
double arg0 = 0;
|
|
cocos2d::Size arg1;
|
|
unsigned int arg2 = 0;
|
|
double arg3 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
ok &= jsval_to_ccsize(cx, args.get(1), &arg1);
|
|
ok &= jsval_to_uint32(cx, args.get(2), &arg2);
|
|
ok &= JS::ToNumber( cx, args.get(3), &arg3) && !std::isnan(arg3);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Waves3D_initWithDuration : Error processing arguments");
|
|
bool ret = cobj->initWithDuration(arg0, arg1, arg2, arg3);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Waves3D_initWithDuration : wrong number of arguments: %d, was expecting %d", argc, 4);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Waves3D_getAmplitude(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Waves3D* cobj = (cocos2d::Waves3D *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Waves3D_getAmplitude : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getAmplitude();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Waves3D_getAmplitude : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Waves3D_getAmplitudeRate(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Waves3D* cobj = (cocos2d::Waves3D *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Waves3D_getAmplitudeRate : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getAmplitudeRate();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Waves3D_getAmplitudeRate : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Waves3D_setAmplitude(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Waves3D* cobj = (cocos2d::Waves3D *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Waves3D_setAmplitude : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Waves3D_setAmplitude : Error processing arguments");
|
|
cobj->setAmplitude(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Waves3D_setAmplitude : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Waves3D_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 4) {
|
|
double arg0 = 0;
|
|
cocos2d::Size arg1;
|
|
unsigned int arg2 = 0;
|
|
double arg3 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
ok &= jsval_to_ccsize(cx, args.get(1), &arg1);
|
|
ok &= jsval_to_uint32(cx, args.get(2), &arg2);
|
|
ok &= JS::ToNumber( cx, args.get(3), &arg3) && !std::isnan(arg3);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Waves3D_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::Waves3D::create(arg0, arg1, arg2, arg3);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::Waves3D>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::Waves3D"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_Waves3D_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_Waves3D_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::Waves3D* cobj = new (std::nothrow) cocos2d::Waves3D();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::Waves3D>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::Waves3D"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_Grid3DAction_prototype;
|
|
|
|
void js_register_cocos2dx_Waves3D(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_Waves3D_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_Waves3D_class->name = "Waves3D";
|
|
jsb_cocos2d_Waves3D_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Waves3D_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_Waves3D_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Waves3D_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_Waves3D_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_Waves3D_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_Waves3D_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_Waves3D_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("setAmplitudeRate", js_cocos2dx_Waves3D_setAmplitudeRate, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initWithDuration", js_cocos2dx_Waves3D_initWithDuration, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getAmplitude", js_cocos2dx_Waves3D_getAmplitude, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getAmplitudeRate", js_cocos2dx_Waves3D_getAmplitudeRate, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setAmplitude", js_cocos2dx_Waves3D_setAmplitude, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_Waves3D_create, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_Grid3DAction_prototype);
|
|
jsb_cocos2d_Waves3D_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_Waves3D_class,
|
|
js_cocos2dx_Waves3D_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_Waves3D_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "Waves3D"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::Waves3D>(cx, jsb_cocos2d_Waves3D_class, proto, parent_proto);
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_FlipX3D_class;
|
|
JSObject *jsb_cocos2d_FlipX3D_prototype;
|
|
|
|
bool js_cocos2dx_FlipX3D_initWithSize(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::FlipX3D* cobj = (cocos2d::FlipX3D *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FlipX3D_initWithSize : Invalid Native Object");
|
|
if (argc == 2) {
|
|
cocos2d::Size arg0;
|
|
double arg1 = 0;
|
|
ok &= jsval_to_ccsize(cx, args.get(0), &arg0);
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FlipX3D_initWithSize : Error processing arguments");
|
|
bool ret = cobj->initWithSize(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_FlipX3D_initWithSize : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_FlipX3D_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::FlipX3D* cobj = (cocos2d::FlipX3D *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FlipX3D_initWithDuration : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FlipX3D_initWithDuration : Error processing arguments");
|
|
bool ret = cobj->initWithDuration(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_FlipX3D_initWithDuration : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_FlipX3D_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FlipX3D_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::FlipX3D::create(arg0);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::FlipX3D>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::FlipX3D"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_FlipX3D_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_FlipX3D_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::FlipX3D* cobj = new (std::nothrow) cocos2d::FlipX3D();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::FlipX3D>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::FlipX3D"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_FlipX3D_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::FlipX3D *nobj = new (std::nothrow) cocos2d::FlipX3D();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::FlipX3D");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_Grid3DAction_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_FlipX3D(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_FlipX3D_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_FlipX3D_class->name = "FlipX3D";
|
|
jsb_cocos2d_FlipX3D_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_FlipX3D_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_FlipX3D_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_FlipX3D_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_FlipX3D_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_FlipX3D_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_FlipX3D_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_FlipX3D_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("initWithSize", js_cocos2dx_FlipX3D_initWithSize, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initWithDuration", js_cocos2dx_FlipX3D_initWithDuration, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_FlipX3D_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_FlipX3D_create, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_Grid3DAction_prototype);
|
|
jsb_cocos2d_FlipX3D_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_FlipX3D_class,
|
|
js_cocos2dx_FlipX3D_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_FlipX3D_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "FlipX3D"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::FlipX3D>(cx, jsb_cocos2d_FlipX3D_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.FlipX3D.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_FlipY3D_class;
|
|
JSObject *jsb_cocos2d_FlipY3D_prototype;
|
|
|
|
bool js_cocos2dx_FlipY3D_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FlipY3D_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::FlipY3D::create(arg0);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::FlipY3D>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::FlipY3D"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_FlipY3D_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_FlipY3D_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::FlipY3D* cobj = new (std::nothrow) cocos2d::FlipY3D();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::FlipY3D>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::FlipY3D"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_FlipY3D_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::FlipY3D *nobj = new (std::nothrow) cocos2d::FlipY3D();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::FlipY3D");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_FlipX3D_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_FlipY3D(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_FlipY3D_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_FlipY3D_class->name = "FlipY3D";
|
|
jsb_cocos2d_FlipY3D_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_FlipY3D_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_FlipY3D_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_FlipY3D_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_FlipY3D_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_FlipY3D_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_FlipY3D_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_FlipY3D_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("ctor", js_cocos2dx_FlipY3D_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_FlipY3D_create, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_FlipX3D_prototype);
|
|
jsb_cocos2d_FlipY3D_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_FlipY3D_class,
|
|
js_cocos2dx_FlipY3D_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_FlipY3D_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "FlipY3D"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::FlipY3D>(cx, jsb_cocos2d_FlipY3D_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.FlipY3D.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_Lens3D_class;
|
|
JSObject *jsb_cocos2d_Lens3D_prototype;
|
|
|
|
bool js_cocos2dx_Lens3D_setConcave(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Lens3D* cobj = (cocos2d::Lens3D *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Lens3D_setConcave : Invalid Native Object");
|
|
if (argc == 1) {
|
|
bool arg0;
|
|
arg0 = JS::ToBoolean(args.get(0));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Lens3D_setConcave : Error processing arguments");
|
|
cobj->setConcave(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Lens3D_setConcave : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Lens3D_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Lens3D* cobj = (cocos2d::Lens3D *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Lens3D_initWithDuration : Invalid Native Object");
|
|
if (argc == 4) {
|
|
double arg0 = 0;
|
|
cocos2d::Size arg1;
|
|
cocos2d::Vec2 arg2;
|
|
double arg3 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
ok &= jsval_to_ccsize(cx, args.get(1), &arg1);
|
|
ok &= jsval_to_vector2(cx, args.get(2), &arg2);
|
|
ok &= JS::ToNumber( cx, args.get(3), &arg3) && !std::isnan(arg3);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Lens3D_initWithDuration : Error processing arguments");
|
|
bool ret = cobj->initWithDuration(arg0, arg1, arg2, arg3);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Lens3D_initWithDuration : wrong number of arguments: %d, was expecting %d", argc, 4);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Lens3D_setLensEffect(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Lens3D* cobj = (cocos2d::Lens3D *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Lens3D_setLensEffect : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Lens3D_setLensEffect : Error processing arguments");
|
|
cobj->setLensEffect(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Lens3D_setLensEffect : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Lens3D_getLensEffect(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Lens3D* cobj = (cocos2d::Lens3D *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Lens3D_getLensEffect : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getLensEffect();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Lens3D_getLensEffect : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Lens3D_setPosition(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Lens3D* cobj = (cocos2d::Lens3D *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Lens3D_setPosition : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Vec2 arg0;
|
|
ok &= jsval_to_vector2(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Lens3D_setPosition : Error processing arguments");
|
|
cobj->setPosition(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Lens3D_setPosition : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Lens3D_getPosition(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Lens3D* cobj = (cocos2d::Lens3D *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Lens3D_getPosition : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const cocos2d::Vec2& ret = cobj->getPosition();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = vector2_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Lens3D_getPosition : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Lens3D_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 4) {
|
|
double arg0 = 0;
|
|
cocos2d::Size arg1;
|
|
cocos2d::Vec2 arg2;
|
|
double arg3 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
ok &= jsval_to_ccsize(cx, args.get(1), &arg1);
|
|
ok &= jsval_to_vector2(cx, args.get(2), &arg2);
|
|
ok &= JS::ToNumber( cx, args.get(3), &arg3) && !std::isnan(arg3);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Lens3D_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::Lens3D::create(arg0, arg1, arg2, arg3);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::Lens3D>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::Lens3D"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_Lens3D_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_Lens3D_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::Lens3D* cobj = new (std::nothrow) cocos2d::Lens3D();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::Lens3D>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::Lens3D"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_Grid3DAction_prototype;
|
|
|
|
void js_register_cocos2dx_Lens3D(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_Lens3D_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_Lens3D_class->name = "Lens3D";
|
|
jsb_cocos2d_Lens3D_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Lens3D_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_Lens3D_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Lens3D_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_Lens3D_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_Lens3D_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_Lens3D_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_Lens3D_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("setConcave", js_cocos2dx_Lens3D_setConcave, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initWithDuration", js_cocos2dx_Lens3D_initWithDuration, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setLensEffect", js_cocos2dx_Lens3D_setLensEffect, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getLensEffect", js_cocos2dx_Lens3D_getLensEffect, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setPosition", js_cocos2dx_Lens3D_setPosition, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getPosition", js_cocos2dx_Lens3D_getPosition, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_Lens3D_create, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_Grid3DAction_prototype);
|
|
jsb_cocos2d_Lens3D_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_Lens3D_class,
|
|
js_cocos2dx_Lens3D_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_Lens3D_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "Lens3D"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::Lens3D>(cx, jsb_cocos2d_Lens3D_class, proto, parent_proto);
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_Ripple3D_class;
|
|
JSObject *jsb_cocos2d_Ripple3D_prototype;
|
|
|
|
bool js_cocos2dx_Ripple3D_setAmplitudeRate(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Ripple3D* cobj = (cocos2d::Ripple3D *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Ripple3D_setAmplitudeRate : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Ripple3D_setAmplitudeRate : Error processing arguments");
|
|
cobj->setAmplitudeRate(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Ripple3D_setAmplitudeRate : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Ripple3D_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Ripple3D* cobj = (cocos2d::Ripple3D *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Ripple3D_initWithDuration : Invalid Native Object");
|
|
if (argc == 6) {
|
|
double arg0 = 0;
|
|
cocos2d::Size arg1;
|
|
cocos2d::Vec2 arg2;
|
|
double arg3 = 0;
|
|
unsigned int arg4 = 0;
|
|
double arg5 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
ok &= jsval_to_ccsize(cx, args.get(1), &arg1);
|
|
ok &= jsval_to_vector2(cx, args.get(2), &arg2);
|
|
ok &= JS::ToNumber( cx, args.get(3), &arg3) && !std::isnan(arg3);
|
|
ok &= jsval_to_uint32(cx, args.get(4), &arg4);
|
|
ok &= JS::ToNumber( cx, args.get(5), &arg5) && !std::isnan(arg5);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Ripple3D_initWithDuration : Error processing arguments");
|
|
bool ret = cobj->initWithDuration(arg0, arg1, arg2, arg3, arg4, arg5);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Ripple3D_initWithDuration : wrong number of arguments: %d, was expecting %d", argc, 6);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Ripple3D_getAmplitudeRate(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Ripple3D* cobj = (cocos2d::Ripple3D *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Ripple3D_getAmplitudeRate : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getAmplitudeRate();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Ripple3D_getAmplitudeRate : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Ripple3D_setAmplitude(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Ripple3D* cobj = (cocos2d::Ripple3D *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Ripple3D_setAmplitude : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Ripple3D_setAmplitude : Error processing arguments");
|
|
cobj->setAmplitude(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Ripple3D_setAmplitude : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Ripple3D_getAmplitude(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Ripple3D* cobj = (cocos2d::Ripple3D *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Ripple3D_getAmplitude : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getAmplitude();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Ripple3D_getAmplitude : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Ripple3D_setPosition(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Ripple3D* cobj = (cocos2d::Ripple3D *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Ripple3D_setPosition : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Vec2 arg0;
|
|
ok &= jsval_to_vector2(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Ripple3D_setPosition : Error processing arguments");
|
|
cobj->setPosition(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Ripple3D_setPosition : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Ripple3D_getPosition(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Ripple3D* cobj = (cocos2d::Ripple3D *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Ripple3D_getPosition : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const cocos2d::Vec2& ret = cobj->getPosition();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = vector2_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Ripple3D_getPosition : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Ripple3D_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 6) {
|
|
double arg0 = 0;
|
|
cocos2d::Size arg1;
|
|
cocos2d::Vec2 arg2;
|
|
double arg3 = 0;
|
|
unsigned int arg4 = 0;
|
|
double arg5 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
ok &= jsval_to_ccsize(cx, args.get(1), &arg1);
|
|
ok &= jsval_to_vector2(cx, args.get(2), &arg2);
|
|
ok &= JS::ToNumber( cx, args.get(3), &arg3) && !std::isnan(arg3);
|
|
ok &= jsval_to_uint32(cx, args.get(4), &arg4);
|
|
ok &= JS::ToNumber( cx, args.get(5), &arg5) && !std::isnan(arg5);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Ripple3D_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::Ripple3D::create(arg0, arg1, arg2, arg3, arg4, arg5);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::Ripple3D>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::Ripple3D"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_Ripple3D_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_Ripple3D_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::Ripple3D* cobj = new (std::nothrow) cocos2d::Ripple3D();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::Ripple3D>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::Ripple3D"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_Grid3DAction_prototype;
|
|
|
|
void js_register_cocos2dx_Ripple3D(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_Ripple3D_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_Ripple3D_class->name = "Ripple3D";
|
|
jsb_cocos2d_Ripple3D_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Ripple3D_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_Ripple3D_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Ripple3D_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_Ripple3D_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_Ripple3D_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_Ripple3D_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_Ripple3D_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("setAmplitudeRate", js_cocos2dx_Ripple3D_setAmplitudeRate, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initWithDuration", js_cocos2dx_Ripple3D_initWithDuration, 6, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getAmplitudeRate", js_cocos2dx_Ripple3D_getAmplitudeRate, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setAmplitude", js_cocos2dx_Ripple3D_setAmplitude, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getAmplitude", js_cocos2dx_Ripple3D_getAmplitude, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setPosition", js_cocos2dx_Ripple3D_setPosition, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getPosition", js_cocos2dx_Ripple3D_getPosition, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_Ripple3D_create, 6, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_Grid3DAction_prototype);
|
|
jsb_cocos2d_Ripple3D_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_Ripple3D_class,
|
|
js_cocos2dx_Ripple3D_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_Ripple3D_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "Ripple3D"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::Ripple3D>(cx, jsb_cocos2d_Ripple3D_class, proto, parent_proto);
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_Shaky3D_class;
|
|
JSObject *jsb_cocos2d_Shaky3D_prototype;
|
|
|
|
bool js_cocos2dx_Shaky3D_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Shaky3D* cobj = (cocos2d::Shaky3D *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Shaky3D_initWithDuration : Invalid Native Object");
|
|
if (argc == 4) {
|
|
double arg0 = 0;
|
|
cocos2d::Size arg1;
|
|
int arg2 = 0;
|
|
bool arg3;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
ok &= jsval_to_ccsize(cx, args.get(1), &arg1);
|
|
ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2);
|
|
arg3 = JS::ToBoolean(args.get(3));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Shaky3D_initWithDuration : Error processing arguments");
|
|
bool ret = cobj->initWithDuration(arg0, arg1, arg2, arg3);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Shaky3D_initWithDuration : wrong number of arguments: %d, was expecting %d", argc, 4);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Shaky3D_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 4) {
|
|
double arg0 = 0;
|
|
cocos2d::Size arg1;
|
|
int arg2 = 0;
|
|
bool arg3;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
ok &= jsval_to_ccsize(cx, args.get(1), &arg1);
|
|
ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2);
|
|
arg3 = JS::ToBoolean(args.get(3));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Shaky3D_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::Shaky3D::create(arg0, arg1, arg2, arg3);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::Shaky3D>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::Shaky3D"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_Shaky3D_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_Shaky3D_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::Shaky3D* cobj = new (std::nothrow) cocos2d::Shaky3D();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::Shaky3D>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::Shaky3D"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_Grid3DAction_prototype;
|
|
|
|
void js_register_cocos2dx_Shaky3D(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_Shaky3D_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_Shaky3D_class->name = "Shaky3D";
|
|
jsb_cocos2d_Shaky3D_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Shaky3D_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_Shaky3D_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Shaky3D_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_Shaky3D_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_Shaky3D_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_Shaky3D_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_Shaky3D_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("initWithDuration", js_cocos2dx_Shaky3D_initWithDuration, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_Shaky3D_create, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_Grid3DAction_prototype);
|
|
jsb_cocos2d_Shaky3D_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_Shaky3D_class,
|
|
js_cocos2dx_Shaky3D_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_Shaky3D_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "Shaky3D"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::Shaky3D>(cx, jsb_cocos2d_Shaky3D_class, proto, parent_proto);
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_Liquid_class;
|
|
JSObject *jsb_cocos2d_Liquid_prototype;
|
|
|
|
bool js_cocos2dx_Liquid_setAmplitudeRate(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Liquid* cobj = (cocos2d::Liquid *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Liquid_setAmplitudeRate : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Liquid_setAmplitudeRate : Error processing arguments");
|
|
cobj->setAmplitudeRate(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Liquid_setAmplitudeRate : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Liquid_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Liquid* cobj = (cocos2d::Liquid *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Liquid_initWithDuration : Invalid Native Object");
|
|
if (argc == 4) {
|
|
double arg0 = 0;
|
|
cocos2d::Size arg1;
|
|
unsigned int arg2 = 0;
|
|
double arg3 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
ok &= jsval_to_ccsize(cx, args.get(1), &arg1);
|
|
ok &= jsval_to_uint32(cx, args.get(2), &arg2);
|
|
ok &= JS::ToNumber( cx, args.get(3), &arg3) && !std::isnan(arg3);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Liquid_initWithDuration : Error processing arguments");
|
|
bool ret = cobj->initWithDuration(arg0, arg1, arg2, arg3);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Liquid_initWithDuration : wrong number of arguments: %d, was expecting %d", argc, 4);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Liquid_getAmplitude(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Liquid* cobj = (cocos2d::Liquid *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Liquid_getAmplitude : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getAmplitude();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Liquid_getAmplitude : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Liquid_getAmplitudeRate(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Liquid* cobj = (cocos2d::Liquid *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Liquid_getAmplitudeRate : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getAmplitudeRate();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Liquid_getAmplitudeRate : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Liquid_setAmplitude(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Liquid* cobj = (cocos2d::Liquid *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Liquid_setAmplitude : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Liquid_setAmplitude : Error processing arguments");
|
|
cobj->setAmplitude(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Liquid_setAmplitude : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Liquid_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 4) {
|
|
double arg0 = 0;
|
|
cocos2d::Size arg1;
|
|
unsigned int arg2 = 0;
|
|
double arg3 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
ok &= jsval_to_ccsize(cx, args.get(1), &arg1);
|
|
ok &= jsval_to_uint32(cx, args.get(2), &arg2);
|
|
ok &= JS::ToNumber( cx, args.get(3), &arg3) && !std::isnan(arg3);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Liquid_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::Liquid::create(arg0, arg1, arg2, arg3);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::Liquid>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::Liquid"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_Liquid_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_Liquid_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::Liquid* cobj = new (std::nothrow) cocos2d::Liquid();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::Liquid>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::Liquid"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_Grid3DAction_prototype;
|
|
|
|
void js_register_cocos2dx_Liquid(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_Liquid_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_Liquid_class->name = "Liquid";
|
|
jsb_cocos2d_Liquid_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Liquid_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_Liquid_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Liquid_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_Liquid_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_Liquid_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_Liquid_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_Liquid_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("setAmplitudeRate", js_cocos2dx_Liquid_setAmplitudeRate, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initWithDuration", js_cocos2dx_Liquid_initWithDuration, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getAmplitude", js_cocos2dx_Liquid_getAmplitude, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getAmplitudeRate", js_cocos2dx_Liquid_getAmplitudeRate, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setAmplitude", js_cocos2dx_Liquid_setAmplitude, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_Liquid_create, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_Grid3DAction_prototype);
|
|
jsb_cocos2d_Liquid_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_Liquid_class,
|
|
js_cocos2dx_Liquid_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_Liquid_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "Liquid"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::Liquid>(cx, jsb_cocos2d_Liquid_class, proto, parent_proto);
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_Waves_class;
|
|
JSObject *jsb_cocos2d_Waves_prototype;
|
|
|
|
bool js_cocos2dx_Waves_setAmplitudeRate(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Waves* cobj = (cocos2d::Waves *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Waves_setAmplitudeRate : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Waves_setAmplitudeRate : Error processing arguments");
|
|
cobj->setAmplitudeRate(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Waves_setAmplitudeRate : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Waves_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Waves* cobj = (cocos2d::Waves *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Waves_initWithDuration : Invalid Native Object");
|
|
if (argc == 6) {
|
|
double arg0 = 0;
|
|
cocos2d::Size arg1;
|
|
unsigned int arg2 = 0;
|
|
double arg3 = 0;
|
|
bool arg4;
|
|
bool arg5;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
ok &= jsval_to_ccsize(cx, args.get(1), &arg1);
|
|
ok &= jsval_to_uint32(cx, args.get(2), &arg2);
|
|
ok &= JS::ToNumber( cx, args.get(3), &arg3) && !std::isnan(arg3);
|
|
arg4 = JS::ToBoolean(args.get(4));
|
|
arg5 = JS::ToBoolean(args.get(5));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Waves_initWithDuration : Error processing arguments");
|
|
bool ret = cobj->initWithDuration(arg0, arg1, arg2, arg3, arg4, arg5);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Waves_initWithDuration : wrong number of arguments: %d, was expecting %d", argc, 6);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Waves_getAmplitude(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Waves* cobj = (cocos2d::Waves *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Waves_getAmplitude : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getAmplitude();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Waves_getAmplitude : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Waves_getAmplitudeRate(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Waves* cobj = (cocos2d::Waves *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Waves_getAmplitudeRate : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getAmplitudeRate();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Waves_getAmplitudeRate : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Waves_setAmplitude(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Waves* cobj = (cocos2d::Waves *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Waves_setAmplitude : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Waves_setAmplitude : Error processing arguments");
|
|
cobj->setAmplitude(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Waves_setAmplitude : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Waves_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 6) {
|
|
double arg0 = 0;
|
|
cocos2d::Size arg1;
|
|
unsigned int arg2 = 0;
|
|
double arg3 = 0;
|
|
bool arg4;
|
|
bool arg5;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
ok &= jsval_to_ccsize(cx, args.get(1), &arg1);
|
|
ok &= jsval_to_uint32(cx, args.get(2), &arg2);
|
|
ok &= JS::ToNumber( cx, args.get(3), &arg3) && !std::isnan(arg3);
|
|
arg4 = JS::ToBoolean(args.get(4));
|
|
arg5 = JS::ToBoolean(args.get(5));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Waves_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::Waves::create(arg0, arg1, arg2, arg3, arg4, arg5);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::Waves>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::Waves"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_Waves_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_Waves_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::Waves* cobj = new (std::nothrow) cocos2d::Waves();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::Waves>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::Waves"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_Grid3DAction_prototype;
|
|
|
|
void js_register_cocos2dx_Waves(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_Waves_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_Waves_class->name = "Waves";
|
|
jsb_cocos2d_Waves_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Waves_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_Waves_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Waves_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_Waves_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_Waves_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_Waves_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_Waves_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("setAmplitudeRate", js_cocos2dx_Waves_setAmplitudeRate, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initWithDuration", js_cocos2dx_Waves_initWithDuration, 6, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getAmplitude", js_cocos2dx_Waves_getAmplitude, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getAmplitudeRate", js_cocos2dx_Waves_getAmplitudeRate, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setAmplitude", js_cocos2dx_Waves_setAmplitude, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_Waves_create, 6, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_Grid3DAction_prototype);
|
|
jsb_cocos2d_Waves_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_Waves_class,
|
|
js_cocos2dx_Waves_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_Waves_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "Waves"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::Waves>(cx, jsb_cocos2d_Waves_class, proto, parent_proto);
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_Twirl_class;
|
|
JSObject *jsb_cocos2d_Twirl_prototype;
|
|
|
|
bool js_cocos2dx_Twirl_setAmplitudeRate(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Twirl* cobj = (cocos2d::Twirl *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Twirl_setAmplitudeRate : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Twirl_setAmplitudeRate : Error processing arguments");
|
|
cobj->setAmplitudeRate(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Twirl_setAmplitudeRate : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Twirl_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Twirl* cobj = (cocos2d::Twirl *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Twirl_initWithDuration : Invalid Native Object");
|
|
if (argc == 5) {
|
|
double arg0 = 0;
|
|
cocos2d::Size arg1;
|
|
cocos2d::Vec2 arg2;
|
|
unsigned int arg3 = 0;
|
|
double arg4 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
ok &= jsval_to_ccsize(cx, args.get(1), &arg1);
|
|
ok &= jsval_to_vector2(cx, args.get(2), &arg2);
|
|
ok &= jsval_to_uint32(cx, args.get(3), &arg3);
|
|
ok &= JS::ToNumber( cx, args.get(4), &arg4) && !std::isnan(arg4);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Twirl_initWithDuration : Error processing arguments");
|
|
bool ret = cobj->initWithDuration(arg0, arg1, arg2, arg3, arg4);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Twirl_initWithDuration : wrong number of arguments: %d, was expecting %d", argc, 5);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Twirl_getAmplitudeRate(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Twirl* cobj = (cocos2d::Twirl *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Twirl_getAmplitudeRate : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getAmplitudeRate();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Twirl_getAmplitudeRate : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Twirl_setAmplitude(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Twirl* cobj = (cocos2d::Twirl *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Twirl_setAmplitude : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Twirl_setAmplitude : Error processing arguments");
|
|
cobj->setAmplitude(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Twirl_setAmplitude : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Twirl_getAmplitude(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Twirl* cobj = (cocos2d::Twirl *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Twirl_getAmplitude : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getAmplitude();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Twirl_getAmplitude : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Twirl_setPosition(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Twirl* cobj = (cocos2d::Twirl *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Twirl_setPosition : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Vec2 arg0;
|
|
ok &= jsval_to_vector2(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Twirl_setPosition : Error processing arguments");
|
|
cobj->setPosition(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Twirl_setPosition : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Twirl_getPosition(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Twirl* cobj = (cocos2d::Twirl *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Twirl_getPosition : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const cocos2d::Vec2& ret = cobj->getPosition();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = vector2_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Twirl_getPosition : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Twirl_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 5) {
|
|
double arg0 = 0;
|
|
cocos2d::Size arg1;
|
|
cocos2d::Vec2 arg2;
|
|
unsigned int arg3 = 0;
|
|
double arg4 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
ok &= jsval_to_ccsize(cx, args.get(1), &arg1);
|
|
ok &= jsval_to_vector2(cx, args.get(2), &arg2);
|
|
ok &= jsval_to_uint32(cx, args.get(3), &arg3);
|
|
ok &= JS::ToNumber( cx, args.get(4), &arg4) && !std::isnan(arg4);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Twirl_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::Twirl::create(arg0, arg1, arg2, arg3, arg4);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::Twirl>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::Twirl"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_Twirl_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_Twirl_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::Twirl* cobj = new (std::nothrow) cocos2d::Twirl();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::Twirl>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::Twirl"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_Grid3DAction_prototype;
|
|
|
|
void js_register_cocos2dx_Twirl(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_Twirl_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_Twirl_class->name = "Twirl";
|
|
jsb_cocos2d_Twirl_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Twirl_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_Twirl_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Twirl_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_Twirl_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_Twirl_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_Twirl_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_Twirl_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("setAmplitudeRate", js_cocos2dx_Twirl_setAmplitudeRate, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initWithDuration", js_cocos2dx_Twirl_initWithDuration, 5, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getAmplitudeRate", js_cocos2dx_Twirl_getAmplitudeRate, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setAmplitude", js_cocos2dx_Twirl_setAmplitude, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getAmplitude", js_cocos2dx_Twirl_getAmplitude, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setPosition", js_cocos2dx_Twirl_setPosition, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getPosition", js_cocos2dx_Twirl_getPosition, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_Twirl_create, 5, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_Grid3DAction_prototype);
|
|
jsb_cocos2d_Twirl_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_Twirl_class,
|
|
js_cocos2dx_Twirl_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_Twirl_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "Twirl"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::Twirl>(cx, jsb_cocos2d_Twirl_class, proto, parent_proto);
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_ActionManager_class;
|
|
JSObject *jsb_cocos2d_ActionManager_prototype;
|
|
|
|
bool js_cocos2dx_ActionManager_getActionByTag(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ActionManager* cobj = (cocos2d::ActionManager *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ActionManager_getActionByTag : Invalid Native Object");
|
|
if (argc == 2) {
|
|
int arg0 = 0;
|
|
const cocos2d::Node* arg1 = nullptr;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (const cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ActionManager_getActionByTag : Error processing arguments");
|
|
cocos2d::Action* ret = cobj->getActionByTag(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Action>(cx, (cocos2d::Action*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ActionManager_getActionByTag : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ActionManager_removeActionByTag(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ActionManager* cobj = (cocos2d::ActionManager *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ActionManager_removeActionByTag : Invalid Native Object");
|
|
if (argc == 2) {
|
|
int arg0 = 0;
|
|
cocos2d::Node* arg1 = nullptr;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ActionManager_removeActionByTag : Error processing arguments");
|
|
cobj->removeActionByTag(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ActionManager_removeActionByTag : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ActionManager_removeActionsByFlags(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ActionManager* cobj = (cocos2d::ActionManager *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ActionManager_removeActionsByFlags : Invalid Native Object");
|
|
if (argc == 2) {
|
|
unsigned int arg0 = 0;
|
|
cocos2d::Node* arg1 = nullptr;
|
|
ok &= jsval_to_uint32(cx, args.get(0), &arg0);
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ActionManager_removeActionsByFlags : Error processing arguments");
|
|
cobj->removeActionsByFlags(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ActionManager_removeActionsByFlags : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ActionManager_removeAllActions(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ActionManager* cobj = (cocos2d::ActionManager *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ActionManager_removeAllActions : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->removeAllActions();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ActionManager_removeAllActions : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ActionManager_addAction(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ActionManager* cobj = (cocos2d::ActionManager *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ActionManager_addAction : Invalid Native Object");
|
|
if (argc == 3) {
|
|
cocos2d::Action* arg0 = nullptr;
|
|
cocos2d::Node* arg1 = nullptr;
|
|
bool arg2;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Action*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
arg2 = JS::ToBoolean(args.get(2));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ActionManager_addAction : Error processing arguments");
|
|
cobj->addAction(arg0, arg1, arg2);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ActionManager_addAction : wrong number of arguments: %d, was expecting %d", argc, 3);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ActionManager_resumeTarget(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ActionManager* cobj = (cocos2d::ActionManager *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ActionManager_resumeTarget : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Node* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ActionManager_resumeTarget : Error processing arguments");
|
|
cobj->resumeTarget(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ActionManager_resumeTarget : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ActionManager_update(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ActionManager* cobj = (cocos2d::ActionManager *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ActionManager_update : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ActionManager_update : Error processing arguments");
|
|
cobj->update(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ActionManager_update : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ActionManager_pauseTarget(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ActionManager* cobj = (cocos2d::ActionManager *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ActionManager_pauseTarget : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Node* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ActionManager_pauseTarget : Error processing arguments");
|
|
cobj->pauseTarget(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ActionManager_pauseTarget : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ActionManager_getNumberOfRunningActionsInTarget(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ActionManager* cobj = (cocos2d::ActionManager *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ActionManager_getNumberOfRunningActionsInTarget : Invalid Native Object");
|
|
if (argc == 1) {
|
|
const cocos2d::Node* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (const cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ActionManager_getNumberOfRunningActionsInTarget : Error processing arguments");
|
|
ssize_t ret = cobj->getNumberOfRunningActionsInTarget(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ssize_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ActionManager_getNumberOfRunningActionsInTarget : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ActionManager_removeAllActionsFromTarget(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ActionManager* cobj = (cocos2d::ActionManager *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ActionManager_removeAllActionsFromTarget : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Node* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ActionManager_removeAllActionsFromTarget : Error processing arguments");
|
|
cobj->removeAllActionsFromTarget(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ActionManager_removeAllActionsFromTarget : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ActionManager_resumeTargets(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ActionManager* cobj = (cocos2d::ActionManager *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ActionManager_resumeTargets : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Vector<cocos2d::Node *> arg0;
|
|
ok &= jsval_to_ccvector(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ActionManager_resumeTargets : Error processing arguments");
|
|
cobj->resumeTargets(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ActionManager_resumeTargets : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ActionManager_removeAction(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ActionManager* cobj = (cocos2d::ActionManager *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ActionManager_removeAction : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Action* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Action*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ActionManager_removeAction : Error processing arguments");
|
|
cobj->removeAction(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ActionManager_removeAction : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ActionManager_pauseAllRunningActions(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ActionManager* cobj = (cocos2d::ActionManager *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ActionManager_pauseAllRunningActions : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::Vector<cocos2d::Node *> ret = cobj->pauseAllRunningActions();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ccvector_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ActionManager_pauseAllRunningActions : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ActionManager_removeAllActionsByTag(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ActionManager* cobj = (cocos2d::ActionManager *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ActionManager_removeAllActionsByTag : Invalid Native Object");
|
|
if (argc == 2) {
|
|
int arg0 = 0;
|
|
cocos2d::Node* arg1 = nullptr;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ActionManager_removeAllActionsByTag : Error processing arguments");
|
|
cobj->removeAllActionsByTag(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ActionManager_removeAllActionsByTag : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ActionManager_getNumberOfRunningActionsInTargetByTag(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ActionManager* cobj = (cocos2d::ActionManager *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ActionManager_getNumberOfRunningActionsInTargetByTag : Invalid Native Object");
|
|
if (argc == 2) {
|
|
const cocos2d::Node* arg0 = nullptr;
|
|
int arg1 = 0;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (const cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ActionManager_getNumberOfRunningActionsInTargetByTag : Error processing arguments");
|
|
unsigned long ret = cobj->getNumberOfRunningActionsInTargetByTag(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ulong_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ActionManager_getNumberOfRunningActionsInTargetByTag : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ActionManager_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::ActionManager* cobj = new (std::nothrow) cocos2d::ActionManager();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::ActionManager>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::ActionManager"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_ActionManager_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::ActionManager *nobj = new (std::nothrow) cocos2d::ActionManager();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::ActionManager");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
|
|
void js_register_cocos2dx_ActionManager(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_ActionManager_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_ActionManager_class->name = "ActionManager";
|
|
jsb_cocos2d_ActionManager_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_ActionManager_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_ActionManager_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_ActionManager_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_ActionManager_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_ActionManager_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_ActionManager_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_ActionManager_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("getActionByTag", js_cocos2dx_ActionManager_getActionByTag, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("removeActionByTag", js_cocos2dx_ActionManager_removeActionByTag, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("removeActionsByFlags", js_cocos2dx_ActionManager_removeActionsByFlags, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("removeAllActions", js_cocos2dx_ActionManager_removeAllActions, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("addAction", js_cocos2dx_ActionManager_addAction, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("resumeTarget", js_cocos2dx_ActionManager_resumeTarget, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("update", js_cocos2dx_ActionManager_update, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("pauseTarget", js_cocos2dx_ActionManager_pauseTarget, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getNumberOfRunningActionsInTarget", js_cocos2dx_ActionManager_getNumberOfRunningActionsInTarget, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("removeAllActionsFromTarget", js_cocos2dx_ActionManager_removeAllActionsFromTarget, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("resumeTargets", js_cocos2dx_ActionManager_resumeTargets, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("removeAction", js_cocos2dx_ActionManager_removeAction, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("pauseAllRunningActions", js_cocos2dx_ActionManager_pauseAllRunningActions, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("removeAllActionsByTag", js_cocos2dx_ActionManager_removeAllActionsByTag, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getNumberOfRunningActionsInTargetByTag", js_cocos2dx_ActionManager_getNumberOfRunningActionsInTargetByTag, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_ActionManager_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JSFunctionSpec *st_funcs = NULL;
|
|
|
|
jsb_cocos2d_ActionManager_prototype = JS_InitClass(
|
|
cx, global,
|
|
JS::NullPtr(),
|
|
jsb_cocos2d_ActionManager_class,
|
|
js_cocos2dx_ActionManager_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_ActionManager_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "ActionManager"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::ActionManager>(cx, jsb_cocos2d_ActionManager_class, proto, JS::NullPtr());
|
|
anonEvaluate(cx, global, "(function () { cc.ActionManager.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_PageTurn3D_class;
|
|
JSObject *jsb_cocos2d_PageTurn3D_prototype;
|
|
|
|
bool js_cocos2dx_PageTurn3D_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 2) {
|
|
double arg0 = 0;
|
|
cocos2d::Size arg1;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
ok &= jsval_to_ccsize(cx, args.get(1), &arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_PageTurn3D_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::PageTurn3D::create(arg0, arg1);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::PageTurn3D>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::PageTurn3D"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_PageTurn3D_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_Grid3DAction_prototype;
|
|
|
|
void js_register_cocos2dx_PageTurn3D(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_PageTurn3D_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_PageTurn3D_class->name = "PageTurn3D";
|
|
jsb_cocos2d_PageTurn3D_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_PageTurn3D_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_PageTurn3D_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_PageTurn3D_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_PageTurn3D_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_PageTurn3D_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_PageTurn3D_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_PageTurn3D_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_PageTurn3D_create, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_Grid3DAction_prototype);
|
|
jsb_cocos2d_PageTurn3D_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_PageTurn3D_class,
|
|
dummy_constructor<cocos2d::PageTurn3D>, 0, // no constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_PageTurn3D_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "PageTurn3D"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::PageTurn3D>(cx, jsb_cocos2d_PageTurn3D_class, proto, parent_proto);
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_ProgressTo_class;
|
|
JSObject *jsb_cocos2d_ProgressTo_prototype;
|
|
|
|
bool js_cocos2dx_ProgressTo_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ProgressTo* cobj = (cocos2d::ProgressTo *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ProgressTo_initWithDuration : Invalid Native Object");
|
|
if (argc == 2) {
|
|
double arg0 = 0;
|
|
double arg1 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ProgressTo_initWithDuration : Error processing arguments");
|
|
bool ret = cobj->initWithDuration(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ProgressTo_initWithDuration : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ProgressTo_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 2) {
|
|
double arg0 = 0;
|
|
double arg1 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ProgressTo_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::ProgressTo::create(arg0, arg1);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::ProgressTo>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::ProgressTo"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_ProgressTo_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_ProgressTo_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::ProgressTo* cobj = new (std::nothrow) cocos2d::ProgressTo();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::ProgressTo>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::ProgressTo"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_ProgressTo_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::ProgressTo *nobj = new (std::nothrow) cocos2d::ProgressTo();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::ProgressTo");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_ActionInterval_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_ProgressTo(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_ProgressTo_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_ProgressTo_class->name = "ProgressTo";
|
|
jsb_cocos2d_ProgressTo_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_ProgressTo_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_ProgressTo_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_ProgressTo_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_ProgressTo_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_ProgressTo_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_ProgressTo_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_ProgressTo_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("initWithDuration", js_cocos2dx_ProgressTo_initWithDuration, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_ProgressTo_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_ProgressTo_create, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_ActionInterval_prototype);
|
|
jsb_cocos2d_ProgressTo_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_ProgressTo_class,
|
|
js_cocos2dx_ProgressTo_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_ProgressTo_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "ProgressTo"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::ProgressTo>(cx, jsb_cocos2d_ProgressTo_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.ProgressTo.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_ProgressFromTo_class;
|
|
JSObject *jsb_cocos2d_ProgressFromTo_prototype;
|
|
|
|
bool js_cocos2dx_ProgressFromTo_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ProgressFromTo* cobj = (cocos2d::ProgressFromTo *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ProgressFromTo_initWithDuration : Invalid Native Object");
|
|
if (argc == 3) {
|
|
double arg0 = 0;
|
|
double arg1 = 0;
|
|
double arg2 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ProgressFromTo_initWithDuration : Error processing arguments");
|
|
bool ret = cobj->initWithDuration(arg0, arg1, arg2);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ProgressFromTo_initWithDuration : wrong number of arguments: %d, was expecting %d", argc, 3);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ProgressFromTo_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 3) {
|
|
double arg0 = 0;
|
|
double arg1 = 0;
|
|
double arg2 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ProgressFromTo_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::ProgressFromTo::create(arg0, arg1, arg2);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::ProgressFromTo>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::ProgressFromTo"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_ProgressFromTo_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_ProgressFromTo_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::ProgressFromTo* cobj = new (std::nothrow) cocos2d::ProgressFromTo();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::ProgressFromTo>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::ProgressFromTo"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_ProgressFromTo_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::ProgressFromTo *nobj = new (std::nothrow) cocos2d::ProgressFromTo();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::ProgressFromTo");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_ActionInterval_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_ProgressFromTo(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_ProgressFromTo_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_ProgressFromTo_class->name = "ProgressFromTo";
|
|
jsb_cocos2d_ProgressFromTo_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_ProgressFromTo_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_ProgressFromTo_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_ProgressFromTo_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_ProgressFromTo_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_ProgressFromTo_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_ProgressFromTo_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_ProgressFromTo_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("initWithDuration", js_cocos2dx_ProgressFromTo_initWithDuration, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_ProgressFromTo_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_ProgressFromTo_create, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_ActionInterval_prototype);
|
|
jsb_cocos2d_ProgressFromTo_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_ProgressFromTo_class,
|
|
js_cocos2dx_ProgressFromTo_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_ProgressFromTo_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "ProgressFromTo"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::ProgressFromTo>(cx, jsb_cocos2d_ProgressFromTo_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.ProgressFromTo.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_ShakyTiles3D_class;
|
|
JSObject *jsb_cocos2d_ShakyTiles3D_prototype;
|
|
|
|
bool js_cocos2dx_ShakyTiles3D_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ShakyTiles3D* cobj = (cocos2d::ShakyTiles3D *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ShakyTiles3D_initWithDuration : Invalid Native Object");
|
|
if (argc == 4) {
|
|
double arg0 = 0;
|
|
cocos2d::Size arg1;
|
|
int arg2 = 0;
|
|
bool arg3;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
ok &= jsval_to_ccsize(cx, args.get(1), &arg1);
|
|
ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2);
|
|
arg3 = JS::ToBoolean(args.get(3));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ShakyTiles3D_initWithDuration : Error processing arguments");
|
|
bool ret = cobj->initWithDuration(arg0, arg1, arg2, arg3);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ShakyTiles3D_initWithDuration : wrong number of arguments: %d, was expecting %d", argc, 4);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ShakyTiles3D_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 4) {
|
|
double arg0 = 0;
|
|
cocos2d::Size arg1;
|
|
int arg2 = 0;
|
|
bool arg3;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
ok &= jsval_to_ccsize(cx, args.get(1), &arg1);
|
|
ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2);
|
|
arg3 = JS::ToBoolean(args.get(3));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ShakyTiles3D_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::ShakyTiles3D::create(arg0, arg1, arg2, arg3);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::ShakyTiles3D>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::ShakyTiles3D"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_ShakyTiles3D_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_ShakyTiles3D_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::ShakyTiles3D* cobj = new (std::nothrow) cocos2d::ShakyTiles3D();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::ShakyTiles3D>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::ShakyTiles3D"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_TiledGrid3DAction_prototype;
|
|
|
|
void js_register_cocos2dx_ShakyTiles3D(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_ShakyTiles3D_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_ShakyTiles3D_class->name = "ShakyTiles3D";
|
|
jsb_cocos2d_ShakyTiles3D_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_ShakyTiles3D_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_ShakyTiles3D_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_ShakyTiles3D_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_ShakyTiles3D_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_ShakyTiles3D_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_ShakyTiles3D_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_ShakyTiles3D_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("initWithDuration", js_cocos2dx_ShakyTiles3D_initWithDuration, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_ShakyTiles3D_create, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_TiledGrid3DAction_prototype);
|
|
jsb_cocos2d_ShakyTiles3D_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_ShakyTiles3D_class,
|
|
js_cocos2dx_ShakyTiles3D_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_ShakyTiles3D_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "ShakyTiles3D"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::ShakyTiles3D>(cx, jsb_cocos2d_ShakyTiles3D_class, proto, parent_proto);
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_ShatteredTiles3D_class;
|
|
JSObject *jsb_cocos2d_ShatteredTiles3D_prototype;
|
|
|
|
bool js_cocos2dx_ShatteredTiles3D_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ShatteredTiles3D* cobj = (cocos2d::ShatteredTiles3D *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ShatteredTiles3D_initWithDuration : Invalid Native Object");
|
|
if (argc == 4) {
|
|
double arg0 = 0;
|
|
cocos2d::Size arg1;
|
|
int arg2 = 0;
|
|
bool arg3;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
ok &= jsval_to_ccsize(cx, args.get(1), &arg1);
|
|
ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2);
|
|
arg3 = JS::ToBoolean(args.get(3));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ShatteredTiles3D_initWithDuration : Error processing arguments");
|
|
bool ret = cobj->initWithDuration(arg0, arg1, arg2, arg3);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ShatteredTiles3D_initWithDuration : wrong number of arguments: %d, was expecting %d", argc, 4);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ShatteredTiles3D_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 4) {
|
|
double arg0 = 0;
|
|
cocos2d::Size arg1;
|
|
int arg2 = 0;
|
|
bool arg3;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
ok &= jsval_to_ccsize(cx, args.get(1), &arg1);
|
|
ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2);
|
|
arg3 = JS::ToBoolean(args.get(3));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ShatteredTiles3D_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::ShatteredTiles3D::create(arg0, arg1, arg2, arg3);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::ShatteredTiles3D>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::ShatteredTiles3D"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_ShatteredTiles3D_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_ShatteredTiles3D_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::ShatteredTiles3D* cobj = new (std::nothrow) cocos2d::ShatteredTiles3D();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::ShatteredTiles3D>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::ShatteredTiles3D"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_TiledGrid3DAction_prototype;
|
|
|
|
void js_register_cocos2dx_ShatteredTiles3D(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_ShatteredTiles3D_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_ShatteredTiles3D_class->name = "ShatteredTiles3D";
|
|
jsb_cocos2d_ShatteredTiles3D_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_ShatteredTiles3D_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_ShatteredTiles3D_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_ShatteredTiles3D_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_ShatteredTiles3D_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_ShatteredTiles3D_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_ShatteredTiles3D_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_ShatteredTiles3D_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("initWithDuration", js_cocos2dx_ShatteredTiles3D_initWithDuration, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_ShatteredTiles3D_create, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_TiledGrid3DAction_prototype);
|
|
jsb_cocos2d_ShatteredTiles3D_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_ShatteredTiles3D_class,
|
|
js_cocos2dx_ShatteredTiles3D_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_ShatteredTiles3D_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "ShatteredTiles3D"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::ShatteredTiles3D>(cx, jsb_cocos2d_ShatteredTiles3D_class, proto, parent_proto);
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_ShuffleTiles_class;
|
|
JSObject *jsb_cocos2d_ShuffleTiles_prototype;
|
|
|
|
bool js_cocos2dx_ShuffleTiles_placeTile(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ShuffleTiles* cobj = (cocos2d::ShuffleTiles *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ShuffleTiles_placeTile : Invalid Native Object");
|
|
if (argc == 2) {
|
|
cocos2d::Vec2 arg0;
|
|
cocos2d::Tile* arg1 = nullptr;
|
|
ok &= jsval_to_vector2(cx, args.get(0), &arg0);
|
|
#pragma warning NO CONVERSION TO NATIVE FOR Tile*
|
|
ok = false;
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ShuffleTiles_placeTile : Error processing arguments");
|
|
cobj->placeTile(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ShuffleTiles_placeTile : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ShuffleTiles_shuffle(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ShuffleTiles* cobj = (cocos2d::ShuffleTiles *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ShuffleTiles_shuffle : Invalid Native Object");
|
|
if (argc == 2) {
|
|
unsigned int* arg0 = 0;
|
|
unsigned int arg1 = 0;
|
|
#pragma warning NO CONVERSION TO NATIVE FOR unsigned int*
|
|
ok = false;
|
|
ok &= jsval_to_uint32(cx, args.get(1), &arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ShuffleTiles_shuffle : Error processing arguments");
|
|
cobj->shuffle(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ShuffleTiles_shuffle : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ShuffleTiles_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ShuffleTiles* cobj = (cocos2d::ShuffleTiles *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ShuffleTiles_initWithDuration : Invalid Native Object");
|
|
if (argc == 3) {
|
|
double arg0 = 0;
|
|
cocos2d::Size arg1;
|
|
unsigned int arg2 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
ok &= jsval_to_ccsize(cx, args.get(1), &arg1);
|
|
ok &= jsval_to_uint32(cx, args.get(2), &arg2);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ShuffleTiles_initWithDuration : Error processing arguments");
|
|
bool ret = cobj->initWithDuration(arg0, arg1, arg2);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ShuffleTiles_initWithDuration : wrong number of arguments: %d, was expecting %d", argc, 3);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ShuffleTiles_getDelta(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ShuffleTiles* cobj = (cocos2d::ShuffleTiles *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ShuffleTiles_getDelta : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Size arg0;
|
|
ok &= jsval_to_ccsize(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ShuffleTiles_getDelta : Error processing arguments");
|
|
cocos2d::Size ret = cobj->getDelta(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ccsize_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ShuffleTiles_getDelta : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ShuffleTiles_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 3) {
|
|
double arg0 = 0;
|
|
cocos2d::Size arg1;
|
|
unsigned int arg2 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
ok &= jsval_to_ccsize(cx, args.get(1), &arg1);
|
|
ok &= jsval_to_uint32(cx, args.get(2), &arg2);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ShuffleTiles_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::ShuffleTiles::create(arg0, arg1, arg2);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::ShuffleTiles>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::ShuffleTiles"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_ShuffleTiles_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_ShuffleTiles_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::ShuffleTiles* cobj = new (std::nothrow) cocos2d::ShuffleTiles();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::ShuffleTiles>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::ShuffleTiles"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_TiledGrid3DAction_prototype;
|
|
|
|
void js_register_cocos2dx_ShuffleTiles(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_ShuffleTiles_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_ShuffleTiles_class->name = "ShuffleTiles";
|
|
jsb_cocos2d_ShuffleTiles_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_ShuffleTiles_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_ShuffleTiles_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_ShuffleTiles_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_ShuffleTiles_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_ShuffleTiles_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_ShuffleTiles_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_ShuffleTiles_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("placeTile", js_cocos2dx_ShuffleTiles_placeTile, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("shuffle", js_cocos2dx_ShuffleTiles_shuffle, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initWithDuration", js_cocos2dx_ShuffleTiles_initWithDuration, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getDelta", js_cocos2dx_ShuffleTiles_getDelta, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_ShuffleTiles_create, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_TiledGrid3DAction_prototype);
|
|
jsb_cocos2d_ShuffleTiles_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_ShuffleTiles_class,
|
|
js_cocos2dx_ShuffleTiles_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_ShuffleTiles_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "ShuffleTiles"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::ShuffleTiles>(cx, jsb_cocos2d_ShuffleTiles_class, proto, parent_proto);
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_FadeOutTRTiles_class;
|
|
JSObject *jsb_cocos2d_FadeOutTRTiles_prototype;
|
|
|
|
bool js_cocos2dx_FadeOutTRTiles_turnOnTile(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::FadeOutTRTiles* cobj = (cocos2d::FadeOutTRTiles *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FadeOutTRTiles_turnOnTile : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Vec2 arg0;
|
|
ok &= jsval_to_vector2(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FadeOutTRTiles_turnOnTile : Error processing arguments");
|
|
cobj->turnOnTile(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_FadeOutTRTiles_turnOnTile : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_FadeOutTRTiles_turnOffTile(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::FadeOutTRTiles* cobj = (cocos2d::FadeOutTRTiles *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FadeOutTRTiles_turnOffTile : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Vec2 arg0;
|
|
ok &= jsval_to_vector2(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FadeOutTRTiles_turnOffTile : Error processing arguments");
|
|
cobj->turnOffTile(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_FadeOutTRTiles_turnOffTile : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_FadeOutTRTiles_transformTile(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::FadeOutTRTiles* cobj = (cocos2d::FadeOutTRTiles *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FadeOutTRTiles_transformTile : Invalid Native Object");
|
|
if (argc == 2) {
|
|
cocos2d::Vec2 arg0;
|
|
double arg1 = 0;
|
|
ok &= jsval_to_vector2(cx, args.get(0), &arg0);
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FadeOutTRTiles_transformTile : Error processing arguments");
|
|
cobj->transformTile(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_FadeOutTRTiles_transformTile : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_FadeOutTRTiles_testFunc(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::FadeOutTRTiles* cobj = (cocos2d::FadeOutTRTiles *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_FadeOutTRTiles_testFunc : Invalid Native Object");
|
|
if (argc == 2) {
|
|
cocos2d::Size arg0;
|
|
double arg1 = 0;
|
|
ok &= jsval_to_ccsize(cx, args.get(0), &arg0);
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FadeOutTRTiles_testFunc : Error processing arguments");
|
|
double ret = cobj->testFunc(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_FadeOutTRTiles_testFunc : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_FadeOutTRTiles_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 2) {
|
|
double arg0 = 0;
|
|
cocos2d::Size arg1;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
ok &= jsval_to_ccsize(cx, args.get(1), &arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FadeOutTRTiles_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::FadeOutTRTiles::create(arg0, arg1);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::FadeOutTRTiles>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::FadeOutTRTiles"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_FadeOutTRTiles_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_FadeOutTRTiles_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::FadeOutTRTiles* cobj = new (std::nothrow) cocos2d::FadeOutTRTiles();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::FadeOutTRTiles>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::FadeOutTRTiles"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_FadeOutTRTiles_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::FadeOutTRTiles *nobj = new (std::nothrow) cocos2d::FadeOutTRTiles();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::FadeOutTRTiles");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_TiledGrid3DAction_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_FadeOutTRTiles(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_FadeOutTRTiles_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_FadeOutTRTiles_class->name = "FadeOutTRTiles";
|
|
jsb_cocos2d_FadeOutTRTiles_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_FadeOutTRTiles_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_FadeOutTRTiles_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_FadeOutTRTiles_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_FadeOutTRTiles_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_FadeOutTRTiles_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_FadeOutTRTiles_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_FadeOutTRTiles_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("turnOnTile", js_cocos2dx_FadeOutTRTiles_turnOnTile, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("turnOffTile", js_cocos2dx_FadeOutTRTiles_turnOffTile, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("transformTile", js_cocos2dx_FadeOutTRTiles_transformTile, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("testFunc", js_cocos2dx_FadeOutTRTiles_testFunc, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_FadeOutTRTiles_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_FadeOutTRTiles_create, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_TiledGrid3DAction_prototype);
|
|
jsb_cocos2d_FadeOutTRTiles_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_FadeOutTRTiles_class,
|
|
js_cocos2dx_FadeOutTRTiles_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_FadeOutTRTiles_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "FadeOutTRTiles"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::FadeOutTRTiles>(cx, jsb_cocos2d_FadeOutTRTiles_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.FadeOutTRTiles.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_FadeOutBLTiles_class;
|
|
JSObject *jsb_cocos2d_FadeOutBLTiles_prototype;
|
|
|
|
bool js_cocos2dx_FadeOutBLTiles_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 2) {
|
|
double arg0 = 0;
|
|
cocos2d::Size arg1;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
ok &= jsval_to_ccsize(cx, args.get(1), &arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FadeOutBLTiles_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::FadeOutBLTiles::create(arg0, arg1);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::FadeOutBLTiles>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::FadeOutBLTiles"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_FadeOutBLTiles_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_FadeOutBLTiles_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::FadeOutBLTiles* cobj = new (std::nothrow) cocos2d::FadeOutBLTiles();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::FadeOutBLTiles>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::FadeOutBLTiles"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_FadeOutBLTiles_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::FadeOutBLTiles *nobj = new (std::nothrow) cocos2d::FadeOutBLTiles();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::FadeOutBLTiles");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_FadeOutTRTiles_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_FadeOutBLTiles(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_FadeOutBLTiles_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_FadeOutBLTiles_class->name = "FadeOutBLTiles";
|
|
jsb_cocos2d_FadeOutBLTiles_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_FadeOutBLTiles_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_FadeOutBLTiles_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_FadeOutBLTiles_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_FadeOutBLTiles_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_FadeOutBLTiles_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_FadeOutBLTiles_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_FadeOutBLTiles_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("ctor", js_cocos2dx_FadeOutBLTiles_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_FadeOutBLTiles_create, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_FadeOutTRTiles_prototype);
|
|
jsb_cocos2d_FadeOutBLTiles_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_FadeOutBLTiles_class,
|
|
js_cocos2dx_FadeOutBLTiles_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_FadeOutBLTiles_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "FadeOutBLTiles"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::FadeOutBLTiles>(cx, jsb_cocos2d_FadeOutBLTiles_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.FadeOutBLTiles.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_FadeOutUpTiles_class;
|
|
JSObject *jsb_cocos2d_FadeOutUpTiles_prototype;
|
|
|
|
bool js_cocos2dx_FadeOutUpTiles_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 2) {
|
|
double arg0 = 0;
|
|
cocos2d::Size arg1;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
ok &= jsval_to_ccsize(cx, args.get(1), &arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FadeOutUpTiles_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::FadeOutUpTiles::create(arg0, arg1);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::FadeOutUpTiles>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::FadeOutUpTiles"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_FadeOutUpTiles_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_FadeOutUpTiles_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::FadeOutUpTiles* cobj = new (std::nothrow) cocos2d::FadeOutUpTiles();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::FadeOutUpTiles>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::FadeOutUpTiles"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_FadeOutUpTiles_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::FadeOutUpTiles *nobj = new (std::nothrow) cocos2d::FadeOutUpTiles();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::FadeOutUpTiles");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_FadeOutTRTiles_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_FadeOutUpTiles(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_FadeOutUpTiles_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_FadeOutUpTiles_class->name = "FadeOutUpTiles";
|
|
jsb_cocos2d_FadeOutUpTiles_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_FadeOutUpTiles_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_FadeOutUpTiles_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_FadeOutUpTiles_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_FadeOutUpTiles_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_FadeOutUpTiles_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_FadeOutUpTiles_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_FadeOutUpTiles_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("ctor", js_cocos2dx_FadeOutUpTiles_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_FadeOutUpTiles_create, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_FadeOutTRTiles_prototype);
|
|
jsb_cocos2d_FadeOutUpTiles_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_FadeOutUpTiles_class,
|
|
js_cocos2dx_FadeOutUpTiles_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_FadeOutUpTiles_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "FadeOutUpTiles"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::FadeOutUpTiles>(cx, jsb_cocos2d_FadeOutUpTiles_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.FadeOutUpTiles.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_FadeOutDownTiles_class;
|
|
JSObject *jsb_cocos2d_FadeOutDownTiles_prototype;
|
|
|
|
bool js_cocos2dx_FadeOutDownTiles_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 2) {
|
|
double arg0 = 0;
|
|
cocos2d::Size arg1;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
ok &= jsval_to_ccsize(cx, args.get(1), &arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_FadeOutDownTiles_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::FadeOutDownTiles::create(arg0, arg1);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::FadeOutDownTiles>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::FadeOutDownTiles"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_FadeOutDownTiles_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_FadeOutDownTiles_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::FadeOutDownTiles* cobj = new (std::nothrow) cocos2d::FadeOutDownTiles();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::FadeOutDownTiles>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::FadeOutDownTiles"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_FadeOutDownTiles_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::FadeOutDownTiles *nobj = new (std::nothrow) cocos2d::FadeOutDownTiles();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::FadeOutDownTiles");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_FadeOutUpTiles_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_FadeOutDownTiles(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_FadeOutDownTiles_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_FadeOutDownTiles_class->name = "FadeOutDownTiles";
|
|
jsb_cocos2d_FadeOutDownTiles_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_FadeOutDownTiles_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_FadeOutDownTiles_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_FadeOutDownTiles_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_FadeOutDownTiles_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_FadeOutDownTiles_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_FadeOutDownTiles_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_FadeOutDownTiles_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("ctor", js_cocos2dx_FadeOutDownTiles_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_FadeOutDownTiles_create, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_FadeOutUpTiles_prototype);
|
|
jsb_cocos2d_FadeOutDownTiles_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_FadeOutDownTiles_class,
|
|
js_cocos2dx_FadeOutDownTiles_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_FadeOutDownTiles_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "FadeOutDownTiles"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::FadeOutDownTiles>(cx, jsb_cocos2d_FadeOutDownTiles_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.FadeOutDownTiles.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_TurnOffTiles_class;
|
|
JSObject *jsb_cocos2d_TurnOffTiles_prototype;
|
|
|
|
bool js_cocos2dx_TurnOffTiles_turnOnTile(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TurnOffTiles* cobj = (cocos2d::TurnOffTiles *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TurnOffTiles_turnOnTile : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Vec2 arg0;
|
|
ok &= jsval_to_vector2(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TurnOffTiles_turnOnTile : Error processing arguments");
|
|
cobj->turnOnTile(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TurnOffTiles_turnOnTile : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TurnOffTiles_turnOffTile(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TurnOffTiles* cobj = (cocos2d::TurnOffTiles *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TurnOffTiles_turnOffTile : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Vec2 arg0;
|
|
ok &= jsval_to_vector2(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TurnOffTiles_turnOffTile : Error processing arguments");
|
|
cobj->turnOffTile(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TurnOffTiles_turnOffTile : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TurnOffTiles_shuffle(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TurnOffTiles* cobj = (cocos2d::TurnOffTiles *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TurnOffTiles_shuffle : Invalid Native Object");
|
|
if (argc == 2) {
|
|
unsigned int* arg0 = 0;
|
|
unsigned int arg1 = 0;
|
|
#pragma warning NO CONVERSION TO NATIVE FOR unsigned int*
|
|
ok = false;
|
|
ok &= jsval_to_uint32(cx, args.get(1), &arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TurnOffTiles_shuffle : Error processing arguments");
|
|
cobj->shuffle(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TurnOffTiles_shuffle : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TurnOffTiles_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TurnOffTiles* cobj = (cocos2d::TurnOffTiles *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TurnOffTiles_initWithDuration : Invalid Native Object");
|
|
if (argc == 3) {
|
|
double arg0 = 0;
|
|
cocos2d::Size arg1;
|
|
unsigned int arg2 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
ok &= jsval_to_ccsize(cx, args.get(1), &arg1);
|
|
ok &= jsval_to_uint32(cx, args.get(2), &arg2);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TurnOffTiles_initWithDuration : Error processing arguments");
|
|
bool ret = cobj->initWithDuration(arg0, arg1, arg2);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TurnOffTiles_initWithDuration : wrong number of arguments: %d, was expecting %d", argc, 3);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TurnOffTiles_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
|
|
do {
|
|
if (argc == 3) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Size arg1;
|
|
ok &= jsval_to_ccsize(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
unsigned int arg2 = 0;
|
|
ok &= jsval_to_uint32(cx, args.get(2), &arg2);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::TurnOffTiles* ret = cocos2d::TurnOffTiles::create(arg0, arg1, arg2);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::TurnOffTiles>(cx, (cocos2d::TurnOffTiles*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
|
|
do {
|
|
if (argc == 2) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Size arg1;
|
|
ok &= jsval_to_ccsize(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::TurnOffTiles* ret = cocos2d::TurnOffTiles::create(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::TurnOffTiles>(cx, (cocos2d::TurnOffTiles*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
JS_ReportError(cx, "js_cocos2dx_TurnOffTiles_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TurnOffTiles_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::TurnOffTiles* cobj = new (std::nothrow) cocos2d::TurnOffTiles();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TurnOffTiles>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::TurnOffTiles"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_TiledGrid3DAction_prototype;
|
|
|
|
void js_register_cocos2dx_TurnOffTiles(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_TurnOffTiles_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_TurnOffTiles_class->name = "TurnOffTiles";
|
|
jsb_cocos2d_TurnOffTiles_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TurnOffTiles_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_TurnOffTiles_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TurnOffTiles_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_TurnOffTiles_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_TurnOffTiles_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_TurnOffTiles_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_TurnOffTiles_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("turnOnTile", js_cocos2dx_TurnOffTiles_turnOnTile, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("turnOffTile", js_cocos2dx_TurnOffTiles_turnOffTile, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("shuffle", js_cocos2dx_TurnOffTiles_shuffle, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initWithDuration", js_cocos2dx_TurnOffTiles_initWithDuration, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_TurnOffTiles_create, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_TiledGrid3DAction_prototype);
|
|
jsb_cocos2d_TurnOffTiles_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_TurnOffTiles_class,
|
|
js_cocos2dx_TurnOffTiles_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_TurnOffTiles_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "TurnOffTiles"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::TurnOffTiles>(cx, jsb_cocos2d_TurnOffTiles_class, proto, parent_proto);
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_WavesTiles3D_class;
|
|
JSObject *jsb_cocos2d_WavesTiles3D_prototype;
|
|
|
|
bool js_cocos2dx_WavesTiles3D_setAmplitudeRate(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::WavesTiles3D* cobj = (cocos2d::WavesTiles3D *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_WavesTiles3D_setAmplitudeRate : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_WavesTiles3D_setAmplitudeRate : Error processing arguments");
|
|
cobj->setAmplitudeRate(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_WavesTiles3D_setAmplitudeRate : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_WavesTiles3D_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::WavesTiles3D* cobj = (cocos2d::WavesTiles3D *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_WavesTiles3D_initWithDuration : Invalid Native Object");
|
|
if (argc == 4) {
|
|
double arg0 = 0;
|
|
cocos2d::Size arg1;
|
|
unsigned int arg2 = 0;
|
|
double arg3 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
ok &= jsval_to_ccsize(cx, args.get(1), &arg1);
|
|
ok &= jsval_to_uint32(cx, args.get(2), &arg2);
|
|
ok &= JS::ToNumber( cx, args.get(3), &arg3) && !std::isnan(arg3);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_WavesTiles3D_initWithDuration : Error processing arguments");
|
|
bool ret = cobj->initWithDuration(arg0, arg1, arg2, arg3);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_WavesTiles3D_initWithDuration : wrong number of arguments: %d, was expecting %d", argc, 4);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_WavesTiles3D_getAmplitude(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::WavesTiles3D* cobj = (cocos2d::WavesTiles3D *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_WavesTiles3D_getAmplitude : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getAmplitude();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_WavesTiles3D_getAmplitude : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_WavesTiles3D_getAmplitudeRate(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::WavesTiles3D* cobj = (cocos2d::WavesTiles3D *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_WavesTiles3D_getAmplitudeRate : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getAmplitudeRate();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_WavesTiles3D_getAmplitudeRate : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_WavesTiles3D_setAmplitude(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::WavesTiles3D* cobj = (cocos2d::WavesTiles3D *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_WavesTiles3D_setAmplitude : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_WavesTiles3D_setAmplitude : Error processing arguments");
|
|
cobj->setAmplitude(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_WavesTiles3D_setAmplitude : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_WavesTiles3D_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 4) {
|
|
double arg0 = 0;
|
|
cocos2d::Size arg1;
|
|
unsigned int arg2 = 0;
|
|
double arg3 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
ok &= jsval_to_ccsize(cx, args.get(1), &arg1);
|
|
ok &= jsval_to_uint32(cx, args.get(2), &arg2);
|
|
ok &= JS::ToNumber( cx, args.get(3), &arg3) && !std::isnan(arg3);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_WavesTiles3D_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::WavesTiles3D::create(arg0, arg1, arg2, arg3);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::WavesTiles3D>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::WavesTiles3D"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_WavesTiles3D_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_WavesTiles3D_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::WavesTiles3D* cobj = new (std::nothrow) cocos2d::WavesTiles3D();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::WavesTiles3D>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::WavesTiles3D"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_TiledGrid3DAction_prototype;
|
|
|
|
void js_register_cocos2dx_WavesTiles3D(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_WavesTiles3D_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_WavesTiles3D_class->name = "WavesTiles3D";
|
|
jsb_cocos2d_WavesTiles3D_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_WavesTiles3D_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_WavesTiles3D_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_WavesTiles3D_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_WavesTiles3D_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_WavesTiles3D_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_WavesTiles3D_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_WavesTiles3D_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("setAmplitudeRate", js_cocos2dx_WavesTiles3D_setAmplitudeRate, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initWithDuration", js_cocos2dx_WavesTiles3D_initWithDuration, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getAmplitude", js_cocos2dx_WavesTiles3D_getAmplitude, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getAmplitudeRate", js_cocos2dx_WavesTiles3D_getAmplitudeRate, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setAmplitude", js_cocos2dx_WavesTiles3D_setAmplitude, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_WavesTiles3D_create, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_TiledGrid3DAction_prototype);
|
|
jsb_cocos2d_WavesTiles3D_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_WavesTiles3D_class,
|
|
js_cocos2dx_WavesTiles3D_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_WavesTiles3D_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "WavesTiles3D"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::WavesTiles3D>(cx, jsb_cocos2d_WavesTiles3D_class, proto, parent_proto);
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_JumpTiles3D_class;
|
|
JSObject *jsb_cocos2d_JumpTiles3D_prototype;
|
|
|
|
bool js_cocos2dx_JumpTiles3D_setAmplitudeRate(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::JumpTiles3D* cobj = (cocos2d::JumpTiles3D *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_JumpTiles3D_setAmplitudeRate : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_JumpTiles3D_setAmplitudeRate : Error processing arguments");
|
|
cobj->setAmplitudeRate(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_JumpTiles3D_setAmplitudeRate : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_JumpTiles3D_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::JumpTiles3D* cobj = (cocos2d::JumpTiles3D *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_JumpTiles3D_initWithDuration : Invalid Native Object");
|
|
if (argc == 4) {
|
|
double arg0 = 0;
|
|
cocos2d::Size arg1;
|
|
unsigned int arg2 = 0;
|
|
double arg3 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
ok &= jsval_to_ccsize(cx, args.get(1), &arg1);
|
|
ok &= jsval_to_uint32(cx, args.get(2), &arg2);
|
|
ok &= JS::ToNumber( cx, args.get(3), &arg3) && !std::isnan(arg3);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_JumpTiles3D_initWithDuration : Error processing arguments");
|
|
bool ret = cobj->initWithDuration(arg0, arg1, arg2, arg3);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_JumpTiles3D_initWithDuration : wrong number of arguments: %d, was expecting %d", argc, 4);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_JumpTiles3D_getAmplitude(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::JumpTiles3D* cobj = (cocos2d::JumpTiles3D *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_JumpTiles3D_getAmplitude : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getAmplitude();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_JumpTiles3D_getAmplitude : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_JumpTiles3D_getAmplitudeRate(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::JumpTiles3D* cobj = (cocos2d::JumpTiles3D *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_JumpTiles3D_getAmplitudeRate : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getAmplitudeRate();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_JumpTiles3D_getAmplitudeRate : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_JumpTiles3D_setAmplitude(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::JumpTiles3D* cobj = (cocos2d::JumpTiles3D *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_JumpTiles3D_setAmplitude : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_JumpTiles3D_setAmplitude : Error processing arguments");
|
|
cobj->setAmplitude(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_JumpTiles3D_setAmplitude : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_JumpTiles3D_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 4) {
|
|
double arg0 = 0;
|
|
cocos2d::Size arg1;
|
|
unsigned int arg2 = 0;
|
|
double arg3 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
ok &= jsval_to_ccsize(cx, args.get(1), &arg1);
|
|
ok &= jsval_to_uint32(cx, args.get(2), &arg2);
|
|
ok &= JS::ToNumber( cx, args.get(3), &arg3) && !std::isnan(arg3);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_JumpTiles3D_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::JumpTiles3D::create(arg0, arg1, arg2, arg3);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::JumpTiles3D>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::JumpTiles3D"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_JumpTiles3D_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_JumpTiles3D_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::JumpTiles3D* cobj = new (std::nothrow) cocos2d::JumpTiles3D();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::JumpTiles3D>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::JumpTiles3D"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_JumpTiles3D_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::JumpTiles3D *nobj = new (std::nothrow) cocos2d::JumpTiles3D();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::JumpTiles3D");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_TiledGrid3DAction_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_JumpTiles3D(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_JumpTiles3D_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_JumpTiles3D_class->name = "JumpTiles3D";
|
|
jsb_cocos2d_JumpTiles3D_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_JumpTiles3D_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_JumpTiles3D_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_JumpTiles3D_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_JumpTiles3D_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_JumpTiles3D_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_JumpTiles3D_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_JumpTiles3D_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("setAmplitudeRate", js_cocos2dx_JumpTiles3D_setAmplitudeRate, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initWithDuration", js_cocos2dx_JumpTiles3D_initWithDuration, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getAmplitude", js_cocos2dx_JumpTiles3D_getAmplitude, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getAmplitudeRate", js_cocos2dx_JumpTiles3D_getAmplitudeRate, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setAmplitude", js_cocos2dx_JumpTiles3D_setAmplitude, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_JumpTiles3D_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_JumpTiles3D_create, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_TiledGrid3DAction_prototype);
|
|
jsb_cocos2d_JumpTiles3D_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_JumpTiles3D_class,
|
|
js_cocos2dx_JumpTiles3D_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_JumpTiles3D_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "JumpTiles3D"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::JumpTiles3D>(cx, jsb_cocos2d_JumpTiles3D_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.JumpTiles3D.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_SplitRows_class;
|
|
JSObject *jsb_cocos2d_SplitRows_prototype;
|
|
|
|
bool js_cocos2dx_SplitRows_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::SplitRows* cobj = (cocos2d::SplitRows *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SplitRows_initWithDuration : Invalid Native Object");
|
|
if (argc == 2) {
|
|
double arg0 = 0;
|
|
unsigned int arg1 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
ok &= jsval_to_uint32(cx, args.get(1), &arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SplitRows_initWithDuration : Error processing arguments");
|
|
bool ret = cobj->initWithDuration(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SplitRows_initWithDuration : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SplitRows_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 2) {
|
|
double arg0 = 0;
|
|
unsigned int arg1 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
ok &= jsval_to_uint32(cx, args.get(1), &arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SplitRows_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::SplitRows::create(arg0, arg1);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::SplitRows>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::SplitRows"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_SplitRows_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_SplitRows_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::SplitRows* cobj = new (std::nothrow) cocos2d::SplitRows();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::SplitRows>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::SplitRows"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_TiledGrid3DAction_prototype;
|
|
|
|
void js_register_cocos2dx_SplitRows(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_SplitRows_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_SplitRows_class->name = "SplitRows";
|
|
jsb_cocos2d_SplitRows_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_SplitRows_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_SplitRows_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_SplitRows_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_SplitRows_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_SplitRows_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_SplitRows_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_SplitRows_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("initWithDuration", js_cocos2dx_SplitRows_initWithDuration, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_SplitRows_create, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_TiledGrid3DAction_prototype);
|
|
jsb_cocos2d_SplitRows_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_SplitRows_class,
|
|
js_cocos2dx_SplitRows_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_SplitRows_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "SplitRows"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::SplitRows>(cx, jsb_cocos2d_SplitRows_class, proto, parent_proto);
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_SplitCols_class;
|
|
JSObject *jsb_cocos2d_SplitCols_prototype;
|
|
|
|
bool js_cocos2dx_SplitCols_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::SplitCols* cobj = (cocos2d::SplitCols *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SplitCols_initWithDuration : Invalid Native Object");
|
|
if (argc == 2) {
|
|
double arg0 = 0;
|
|
unsigned int arg1 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
ok &= jsval_to_uint32(cx, args.get(1), &arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SplitCols_initWithDuration : Error processing arguments");
|
|
bool ret = cobj->initWithDuration(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SplitCols_initWithDuration : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SplitCols_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 2) {
|
|
double arg0 = 0;
|
|
unsigned int arg1 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
ok &= jsval_to_uint32(cx, args.get(1), &arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SplitCols_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::SplitCols::create(arg0, arg1);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::SplitCols>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::SplitCols"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_SplitCols_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_SplitCols_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::SplitCols* cobj = new (std::nothrow) cocos2d::SplitCols();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::SplitCols>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::SplitCols"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_TiledGrid3DAction_prototype;
|
|
|
|
void js_register_cocos2dx_SplitCols(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_SplitCols_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_SplitCols_class->name = "SplitCols";
|
|
jsb_cocos2d_SplitCols_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_SplitCols_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_SplitCols_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_SplitCols_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_SplitCols_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_SplitCols_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_SplitCols_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_SplitCols_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("initWithDuration", js_cocos2dx_SplitCols_initWithDuration, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_SplitCols_create, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_TiledGrid3DAction_prototype);
|
|
jsb_cocos2d_SplitCols_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_SplitCols_class,
|
|
js_cocos2dx_SplitCols_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_SplitCols_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "SplitCols"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::SplitCols>(cx, jsb_cocos2d_SplitCols_class, proto, parent_proto);
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_ActionTween_class;
|
|
JSObject *jsb_cocos2d_ActionTween_prototype;
|
|
|
|
bool js_cocos2dx_ActionTween_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ActionTween* cobj = (cocos2d::ActionTween *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ActionTween_initWithDuration : Invalid Native Object");
|
|
if (argc == 4) {
|
|
double arg0 = 0;
|
|
std::string arg1;
|
|
double arg2 = 0;
|
|
double arg3 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
ok &= JS::ToNumber( cx, args.get(3), &arg3) && !std::isnan(arg3);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ActionTween_initWithDuration : Error processing arguments");
|
|
bool ret = cobj->initWithDuration(arg0, arg1, arg2, arg3);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ActionTween_initWithDuration : wrong number of arguments: %d, was expecting %d", argc, 4);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ActionTween_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 4) {
|
|
double arg0 = 0;
|
|
std::string arg1;
|
|
double arg2 = 0;
|
|
double arg3 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
ok &= JS::ToNumber( cx, args.get(3), &arg3) && !std::isnan(arg3);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ActionTween_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::ActionTween::create(arg0, arg1, arg2, arg3);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::ActionTween>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::ActionTween"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_ActionTween_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_ActionInterval_prototype;
|
|
|
|
void js_register_cocos2dx_ActionTween(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_ActionTween_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_ActionTween_class->name = "ActionTween";
|
|
jsb_cocos2d_ActionTween_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_ActionTween_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_ActionTween_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_ActionTween_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_ActionTween_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_ActionTween_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_ActionTween_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_ActionTween_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("initWithDuration", js_cocos2dx_ActionTween_initWithDuration, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_ActionTween_create, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_ActionInterval_prototype);
|
|
jsb_cocos2d_ActionTween_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_ActionTween_class,
|
|
dummy_constructor<cocos2d::ActionTween>, 0, // no constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_ActionTween_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "ActionTween"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::ActionTween>(cx, jsb_cocos2d_ActionTween_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.ActionTween.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_AtlasNode_class;
|
|
JSObject *jsb_cocos2d_AtlasNode_prototype;
|
|
|
|
bool js_cocos2dx_AtlasNode_updateAtlasValues(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::AtlasNode* cobj = (cocos2d::AtlasNode *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_AtlasNode_updateAtlasValues : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->updateAtlasValues();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_AtlasNode_updateAtlasValues : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_AtlasNode_initWithTileFile(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::AtlasNode* cobj = (cocos2d::AtlasNode *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_AtlasNode_initWithTileFile : Invalid Native Object");
|
|
if (argc == 4) {
|
|
std::string arg0;
|
|
int arg1 = 0;
|
|
int arg2 = 0;
|
|
int arg3 = 0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1);
|
|
ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2);
|
|
ok &= jsval_to_int32(cx, args.get(3), (int32_t *)&arg3);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_AtlasNode_initWithTileFile : Error processing arguments");
|
|
bool ret = cobj->initWithTileFile(arg0, arg1, arg2, arg3);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_AtlasNode_initWithTileFile : wrong number of arguments: %d, was expecting %d", argc, 4);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_AtlasNode_getTexture(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::AtlasNode* cobj = (cocos2d::AtlasNode *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_AtlasNode_getTexture : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::Texture2D* ret = cobj->getTexture();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Texture2D>(cx, (cocos2d::Texture2D*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_AtlasNode_getTexture : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_AtlasNode_setTextureAtlas(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::AtlasNode* cobj = (cocos2d::AtlasNode *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_AtlasNode_setTextureAtlas : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::TextureAtlas* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::TextureAtlas*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_AtlasNode_setTextureAtlas : Error processing arguments");
|
|
cobj->setTextureAtlas(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_AtlasNode_setTextureAtlas : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_AtlasNode_setBlendFunc(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::AtlasNode* cobj = (cocos2d::AtlasNode *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_AtlasNode_setBlendFunc : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::BlendFunc arg0;
|
|
ok &= jsval_to_blendfunc(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_AtlasNode_setBlendFunc : Error processing arguments");
|
|
cobj->setBlendFunc(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_AtlasNode_setBlendFunc : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_AtlasNode_getTextureAtlas(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::AtlasNode* cobj = (cocos2d::AtlasNode *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_AtlasNode_getTextureAtlas : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::TextureAtlas* ret = cobj->getTextureAtlas();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::TextureAtlas>(cx, (cocos2d::TextureAtlas*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_AtlasNode_getTextureAtlas : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_AtlasNode_getBlendFunc(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::AtlasNode* cobj = (cocos2d::AtlasNode *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_AtlasNode_getBlendFunc : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const cocos2d::BlendFunc& ret = cobj->getBlendFunc();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = blendfunc_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_AtlasNode_getBlendFunc : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_AtlasNode_getQuadsToDraw(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::AtlasNode* cobj = (cocos2d::AtlasNode *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_AtlasNode_getQuadsToDraw : Invalid Native Object");
|
|
if (argc == 0) {
|
|
ssize_t ret = cobj->getQuadsToDraw();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ssize_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_AtlasNode_getQuadsToDraw : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_AtlasNode_setTexture(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::AtlasNode* cobj = (cocos2d::AtlasNode *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_AtlasNode_setTexture : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Texture2D* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Texture2D*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_AtlasNode_setTexture : Error processing arguments");
|
|
cobj->setTexture(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_AtlasNode_setTexture : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_AtlasNode_initWithTexture(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::AtlasNode* cobj = (cocos2d::AtlasNode *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_AtlasNode_initWithTexture : Invalid Native Object");
|
|
if (argc == 4) {
|
|
cocos2d::Texture2D* arg0 = nullptr;
|
|
int arg1 = 0;
|
|
int arg2 = 0;
|
|
int arg3 = 0;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Texture2D*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1);
|
|
ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2);
|
|
ok &= jsval_to_int32(cx, args.get(3), (int32_t *)&arg3);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_AtlasNode_initWithTexture : Error processing arguments");
|
|
bool ret = cobj->initWithTexture(arg0, arg1, arg2, arg3);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_AtlasNode_initWithTexture : wrong number of arguments: %d, was expecting %d", argc, 4);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_AtlasNode_setQuadsToDraw(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::AtlasNode* cobj = (cocos2d::AtlasNode *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_AtlasNode_setQuadsToDraw : Invalid Native Object");
|
|
if (argc == 1) {
|
|
ssize_t arg0 = 0;
|
|
ok &= jsval_to_ssize(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_AtlasNode_setQuadsToDraw : Error processing arguments");
|
|
cobj->setQuadsToDraw(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_AtlasNode_setQuadsToDraw : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_AtlasNode_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 4) {
|
|
std::string arg0;
|
|
int arg1 = 0;
|
|
int arg2 = 0;
|
|
int arg3 = 0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1);
|
|
ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2);
|
|
ok &= jsval_to_int32(cx, args.get(3), (int32_t *)&arg3);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_AtlasNode_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::AtlasNode::create(arg0, arg1, arg2, arg3);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::AtlasNode>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::AtlasNode"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_AtlasNode_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_AtlasNode_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::AtlasNode* cobj = new (std::nothrow) cocos2d::AtlasNode();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::AtlasNode>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::AtlasNode"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_Node_prototype;
|
|
|
|
void js_register_cocos2dx_AtlasNode(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_AtlasNode_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_AtlasNode_class->name = "AtlasNode";
|
|
jsb_cocos2d_AtlasNode_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_AtlasNode_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_AtlasNode_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_AtlasNode_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_AtlasNode_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_AtlasNode_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_AtlasNode_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_AtlasNode_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("updateAtlasValues", js_cocos2dx_AtlasNode_updateAtlasValues, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initWithTileFile", js_cocos2dx_AtlasNode_initWithTileFile, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getTexture", js_cocos2dx_AtlasNode_getTexture, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setTextureAtlas", js_cocos2dx_AtlasNode_setTextureAtlas, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setBlendFunc", js_cocos2dx_AtlasNode_setBlendFunc, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getTextureAtlas", js_cocos2dx_AtlasNode_getTextureAtlas, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getBlendFunc", js_cocos2dx_AtlasNode_getBlendFunc, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getQuadsToDraw", js_cocos2dx_AtlasNode_getQuadsToDraw, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setTexture", js_cocos2dx_AtlasNode_setTexture, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initWithTexture", js_cocos2dx_AtlasNode_initWithTexture, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setQuadsToDraw", js_cocos2dx_AtlasNode_setQuadsToDraw, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_AtlasNode_create, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_Node_prototype);
|
|
jsb_cocos2d_AtlasNode_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_AtlasNode_class,
|
|
js_cocos2dx_AtlasNode_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_AtlasNode_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "AtlasNode"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::AtlasNode>(cx, jsb_cocos2d_AtlasNode_class, proto, parent_proto);
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_ClippingNode_class;
|
|
JSObject *jsb_cocos2d_ClippingNode_prototype;
|
|
|
|
bool js_cocos2dx_ClippingNode_hasContent(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ClippingNode* cobj = (cocos2d::ClippingNode *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ClippingNode_hasContent : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->hasContent();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ClippingNode_hasContent : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ClippingNode_setInverted(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ClippingNode* cobj = (cocos2d::ClippingNode *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ClippingNode_setInverted : Invalid Native Object");
|
|
if (argc == 1) {
|
|
bool arg0;
|
|
arg0 = JS::ToBoolean(args.get(0));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ClippingNode_setInverted : Error processing arguments");
|
|
cobj->setInverted(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ClippingNode_setInverted : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ClippingNode_setStencil(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ClippingNode* cobj = (cocos2d::ClippingNode *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ClippingNode_setStencil : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Node* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ClippingNode_setStencil : Error processing arguments");
|
|
cobj->setStencil(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ClippingNode_setStencil : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ClippingNode_getAlphaThreshold(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ClippingNode* cobj = (cocos2d::ClippingNode *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ClippingNode_getAlphaThreshold : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getAlphaThreshold();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ClippingNode_getAlphaThreshold : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ClippingNode_getStencil(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ClippingNode* cobj = (cocos2d::ClippingNode *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ClippingNode_getStencil : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::Node* ret = cobj->getStencil();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Node>(cx, (cocos2d::Node*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ClippingNode_getStencil : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ClippingNode_setAlphaThreshold(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ClippingNode* cobj = (cocos2d::ClippingNode *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ClippingNode_setAlphaThreshold : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ClippingNode_setAlphaThreshold : Error processing arguments");
|
|
cobj->setAlphaThreshold(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ClippingNode_setAlphaThreshold : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ClippingNode_isInverted(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ClippingNode* cobj = (cocos2d::ClippingNode *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ClippingNode_isInverted : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->isInverted();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ClippingNode_isInverted : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ClippingNode_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
|
|
do {
|
|
if (argc == 1) {
|
|
cocos2d::Node* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::ClippingNode* ret = cocos2d::ClippingNode::create(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::ClippingNode>(cx, (cocos2d::ClippingNode*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
|
|
do {
|
|
if (argc == 0) {
|
|
cocos2d::ClippingNode* ret = cocos2d::ClippingNode::create();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::ClippingNode>(cx, (cocos2d::ClippingNode*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
JS_ReportError(cx, "js_cocos2dx_ClippingNode_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ClippingNode_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::ClippingNode* cobj = new (std::nothrow) cocos2d::ClippingNode();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::ClippingNode>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::ClippingNode"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_Node_prototype;
|
|
|
|
void js_register_cocos2dx_ClippingNode(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_ClippingNode_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_ClippingNode_class->name = "ClippingNode";
|
|
jsb_cocos2d_ClippingNode_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_ClippingNode_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_ClippingNode_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_ClippingNode_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_ClippingNode_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_ClippingNode_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_ClippingNode_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_ClippingNode_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("hasContent", js_cocos2dx_ClippingNode_hasContent, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setInverted", js_cocos2dx_ClippingNode_setInverted, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setStencil", js_cocos2dx_ClippingNode_setStencil, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getAlphaThreshold", js_cocos2dx_ClippingNode_getAlphaThreshold, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getStencil", js_cocos2dx_ClippingNode_getStencil, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setAlphaThreshold", js_cocos2dx_ClippingNode_setAlphaThreshold, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("isInverted", js_cocos2dx_ClippingNode_isInverted, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_ClippingNode_create, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_Node_prototype);
|
|
jsb_cocos2d_ClippingNode_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_ClippingNode_class,
|
|
js_cocos2dx_ClippingNode_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_ClippingNode_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "ClippingNode"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::ClippingNode>(cx, jsb_cocos2d_ClippingNode_class, proto, parent_proto);
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_DrawNode_class;
|
|
JSObject *jsb_cocos2d_DrawNode_prototype;
|
|
|
|
bool js_cocos2dx_DrawNode_drawLine(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::DrawNode* cobj = (cocos2d::DrawNode *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_DrawNode_drawLine : Invalid Native Object");
|
|
if (argc == 3) {
|
|
cocos2d::Vec2 arg0;
|
|
cocos2d::Vec2 arg1;
|
|
cocos2d::Color4F arg2;
|
|
ok &= jsval_to_vector2(cx, args.get(0), &arg0);
|
|
ok &= jsval_to_vector2(cx, args.get(1), &arg1);
|
|
ok &= jsval_to_cccolor4f(cx, args.get(2), &arg2);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_DrawNode_drawLine : Error processing arguments");
|
|
cobj->drawLine(arg0, arg1, arg2);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_DrawNode_drawLine : wrong number of arguments: %d, was expecting %d", argc, 3);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_DrawNode_drawPoints(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::DrawNode* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::DrawNode *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_DrawNode_drawPoints : Invalid Native Object");
|
|
do {
|
|
if (argc == 4) {
|
|
const cocos2d::Vec2* arg0 = nullptr;
|
|
std::vector<cocos2d::Vec2> tempData;ok &= jsval_to_vector_vec2(cx, args.get(0), &tempData);arg0=tempData.data();
|
|
if (!ok) { ok = true; break; }
|
|
unsigned int arg1 = 0;
|
|
ok &= jsval_to_uint32(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
double arg2 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Color4F arg3;
|
|
ok &= jsval_to_cccolor4f(cx, args.get(3), &arg3);
|
|
if (!ok) { ok = true; break; }
|
|
cobj->drawPoints(arg0, arg1, arg2, arg3);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 3) {
|
|
const cocos2d::Vec2* arg0 = nullptr;
|
|
std::vector<cocos2d::Vec2> tempData;ok &= jsval_to_vector_vec2(cx, args.get(0), &tempData);arg0=tempData.data();
|
|
if (!ok) { ok = true; break; }
|
|
unsigned int arg1 = 0;
|
|
ok &= jsval_to_uint32(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Color4F arg2;
|
|
ok &= jsval_to_cccolor4f(cx, args.get(2), &arg2);
|
|
if (!ok) { ok = true; break; }
|
|
cobj->drawPoints(arg0, arg1, arg2);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_DrawNode_drawPoints : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_DrawNode_drawRect(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::DrawNode* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::DrawNode *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_DrawNode_drawRect : Invalid Native Object");
|
|
do {
|
|
if (argc == 5) {
|
|
cocos2d::Vec2 arg0;
|
|
ok &= jsval_to_vector2(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Vec2 arg1;
|
|
ok &= jsval_to_vector2(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Vec2 arg2;
|
|
ok &= jsval_to_vector2(cx, args.get(2), &arg2);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Vec2 arg3;
|
|
ok &= jsval_to_vector2(cx, args.get(3), &arg3);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Color4F arg4;
|
|
ok &= jsval_to_cccolor4f(cx, args.get(4), &arg4);
|
|
if (!ok) { ok = true; break; }
|
|
cobj->drawRect(arg0, arg1, arg2, arg3, arg4);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 3) {
|
|
cocos2d::Vec2 arg0;
|
|
ok &= jsval_to_vector2(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Vec2 arg1;
|
|
ok &= jsval_to_vector2(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Color4F arg2;
|
|
ok &= jsval_to_cccolor4f(cx, args.get(2), &arg2);
|
|
if (!ok) { ok = true; break; }
|
|
cobj->drawRect(arg0, arg1, arg2);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_DrawNode_drawRect : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_DrawNode_drawSolidCircle(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::DrawNode* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::DrawNode *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_DrawNode_drawSolidCircle : Invalid Native Object");
|
|
do {
|
|
if (argc == 5) {
|
|
cocos2d::Vec2 arg0;
|
|
ok &= jsval_to_vector2(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
double arg1 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
if (!ok) { ok = true; break; }
|
|
double arg2 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
if (!ok) { ok = true; break; }
|
|
unsigned int arg3 = 0;
|
|
ok &= jsval_to_uint32(cx, args.get(3), &arg3);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Color4F arg4;
|
|
ok &= jsval_to_cccolor4f(cx, args.get(4), &arg4);
|
|
if (!ok) { ok = true; break; }
|
|
cobj->drawSolidCircle(arg0, arg1, arg2, arg3, arg4);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 7) {
|
|
cocos2d::Vec2 arg0;
|
|
ok &= jsval_to_vector2(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
double arg1 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
if (!ok) { ok = true; break; }
|
|
double arg2 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
if (!ok) { ok = true; break; }
|
|
unsigned int arg3 = 0;
|
|
ok &= jsval_to_uint32(cx, args.get(3), &arg3);
|
|
if (!ok) { ok = true; break; }
|
|
double arg4 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(4), &arg4) && !std::isnan(arg4);
|
|
if (!ok) { ok = true; break; }
|
|
double arg5 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(5), &arg5) && !std::isnan(arg5);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Color4F arg6;
|
|
ok &= jsval_to_cccolor4f(cx, args.get(6), &arg6);
|
|
if (!ok) { ok = true; break; }
|
|
cobj->drawSolidCircle(arg0, arg1, arg2, arg3, arg4, arg5, arg6);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_DrawNode_drawSolidCircle : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_DrawNode_setLineWidth(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::DrawNode* cobj = (cocos2d::DrawNode *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_DrawNode_setLineWidth : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_DrawNode_setLineWidth : Error processing arguments");
|
|
cobj->setLineWidth(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_DrawNode_setLineWidth : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_DrawNode_onDrawGLPoint(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::DrawNode* cobj = (cocos2d::DrawNode *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_DrawNode_onDrawGLPoint : Invalid Native Object");
|
|
if (argc == 2) {
|
|
cocos2d::Mat4 arg0;
|
|
unsigned int arg1 = 0;
|
|
ok &= jsval_to_matrix(cx, args.get(0), &arg0);
|
|
ok &= jsval_to_uint32(cx, args.get(1), &arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_DrawNode_onDrawGLPoint : Error processing arguments");
|
|
cobj->onDrawGLPoint(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_DrawNode_onDrawGLPoint : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_DrawNode_drawPolygon(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::DrawNode* cobj = (cocos2d::DrawNode *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_DrawNode_drawPolygon : Invalid Native Object");
|
|
if (argc == 5) {
|
|
const cocos2d::Vec2* arg0 = nullptr;
|
|
int arg1 = 0;
|
|
cocos2d::Color4F arg2;
|
|
double arg3 = 0;
|
|
cocos2d::Color4F arg4;
|
|
std::vector<cocos2d::Vec2> tempData;ok &= jsval_to_vector_vec2(cx, args.get(0), &tempData);arg0=tempData.data();
|
|
ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1);
|
|
ok &= jsval_to_cccolor4f(cx, args.get(2), &arg2);
|
|
ok &= JS::ToNumber( cx, args.get(3), &arg3) && !std::isnan(arg3);
|
|
ok &= jsval_to_cccolor4f(cx, args.get(4), &arg4);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_DrawNode_drawPolygon : Error processing arguments");
|
|
cobj->drawPolygon(arg0, arg1, arg2, arg3, arg4);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_DrawNode_drawPolygon : wrong number of arguments: %d, was expecting %d", argc, 5);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_DrawNode_drawDot(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::DrawNode* cobj = (cocos2d::DrawNode *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_DrawNode_drawDot : Invalid Native Object");
|
|
if (argc == 3) {
|
|
cocos2d::Vec2 arg0;
|
|
double arg1 = 0;
|
|
cocos2d::Color4F arg2;
|
|
ok &= jsval_to_vector2(cx, args.get(0), &arg0);
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
ok &= jsval_to_cccolor4f(cx, args.get(2), &arg2);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_DrawNode_drawDot : Error processing arguments");
|
|
cobj->drawDot(arg0, arg1, arg2);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_DrawNode_drawDot : wrong number of arguments: %d, was expecting %d", argc, 3);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_DrawNode_drawCatmullRom(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::DrawNode* cobj = (cocos2d::DrawNode *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_DrawNode_drawCatmullRom : Invalid Native Object");
|
|
if (argc == 3) {
|
|
cocos2d::PointArray* arg0 = nullptr;
|
|
unsigned int arg1 = 0;
|
|
cocos2d::Color4F arg2;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::PointArray*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
ok &= jsval_to_uint32(cx, args.get(1), &arg1);
|
|
ok &= jsval_to_cccolor4f(cx, args.get(2), &arg2);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_DrawNode_drawCatmullRom : Error processing arguments");
|
|
cobj->drawCatmullRom(arg0, arg1, arg2);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_DrawNode_drawCatmullRom : wrong number of arguments: %d, was expecting %d", argc, 3);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_DrawNode_drawSegment(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::DrawNode* cobj = (cocos2d::DrawNode *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_DrawNode_drawSegment : Invalid Native Object");
|
|
if (argc == 4) {
|
|
cocos2d::Vec2 arg0;
|
|
cocos2d::Vec2 arg1;
|
|
double arg2 = 0;
|
|
cocos2d::Color4F arg3;
|
|
ok &= jsval_to_vector2(cx, args.get(0), &arg0);
|
|
ok &= jsval_to_vector2(cx, args.get(1), &arg1);
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
ok &= jsval_to_cccolor4f(cx, args.get(3), &arg3);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_DrawNode_drawSegment : Error processing arguments");
|
|
cobj->drawSegment(arg0, arg1, arg2, arg3);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_DrawNode_drawSegment : wrong number of arguments: %d, was expecting %d", argc, 4);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_DrawNode_getBlendFunc(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::DrawNode* cobj = (cocos2d::DrawNode *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_DrawNode_getBlendFunc : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const cocos2d::BlendFunc& ret = cobj->getBlendFunc();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = blendfunc_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_DrawNode_getBlendFunc : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_DrawNode_onDraw(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::DrawNode* cobj = (cocos2d::DrawNode *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_DrawNode_onDraw : Invalid Native Object");
|
|
if (argc == 2) {
|
|
cocos2d::Mat4 arg0;
|
|
unsigned int arg1 = 0;
|
|
ok &= jsval_to_matrix(cx, args.get(0), &arg0);
|
|
ok &= jsval_to_uint32(cx, args.get(1), &arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_DrawNode_onDraw : Error processing arguments");
|
|
cobj->onDraw(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_DrawNode_onDraw : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_DrawNode_drawCircle(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::DrawNode* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::DrawNode *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_DrawNode_drawCircle : Invalid Native Object");
|
|
do {
|
|
if (argc == 6) {
|
|
cocos2d::Vec2 arg0;
|
|
ok &= jsval_to_vector2(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
double arg1 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
if (!ok) { ok = true; break; }
|
|
double arg2 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
if (!ok) { ok = true; break; }
|
|
unsigned int arg3 = 0;
|
|
ok &= jsval_to_uint32(cx, args.get(3), &arg3);
|
|
if (!ok) { ok = true; break; }
|
|
bool arg4;
|
|
arg4 = JS::ToBoolean(args.get(4));
|
|
cocos2d::Color4F arg5;
|
|
ok &= jsval_to_cccolor4f(cx, args.get(5), &arg5);
|
|
if (!ok) { ok = true; break; }
|
|
cobj->drawCircle(arg0, arg1, arg2, arg3, arg4, arg5);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 8) {
|
|
cocos2d::Vec2 arg0;
|
|
ok &= jsval_to_vector2(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
double arg1 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
if (!ok) { ok = true; break; }
|
|
double arg2 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
if (!ok) { ok = true; break; }
|
|
unsigned int arg3 = 0;
|
|
ok &= jsval_to_uint32(cx, args.get(3), &arg3);
|
|
if (!ok) { ok = true; break; }
|
|
bool arg4;
|
|
arg4 = JS::ToBoolean(args.get(4));
|
|
double arg5 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(5), &arg5) && !std::isnan(arg5);
|
|
if (!ok) { ok = true; break; }
|
|
double arg6 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(6), &arg6) && !std::isnan(arg6);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Color4F arg7;
|
|
ok &= jsval_to_cccolor4f(cx, args.get(7), &arg7);
|
|
if (!ok) { ok = true; break; }
|
|
cobj->drawCircle(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_DrawNode_drawCircle : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_DrawNode_drawQuadBezier(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::DrawNode* cobj = (cocos2d::DrawNode *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_DrawNode_drawQuadBezier : Invalid Native Object");
|
|
if (argc == 5) {
|
|
cocos2d::Vec2 arg0;
|
|
cocos2d::Vec2 arg1;
|
|
cocos2d::Vec2 arg2;
|
|
unsigned int arg3 = 0;
|
|
cocos2d::Color4F arg4;
|
|
ok &= jsval_to_vector2(cx, args.get(0), &arg0);
|
|
ok &= jsval_to_vector2(cx, args.get(1), &arg1);
|
|
ok &= jsval_to_vector2(cx, args.get(2), &arg2);
|
|
ok &= jsval_to_uint32(cx, args.get(3), &arg3);
|
|
ok &= jsval_to_cccolor4f(cx, args.get(4), &arg4);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_DrawNode_drawQuadBezier : Error processing arguments");
|
|
cobj->drawQuadBezier(arg0, arg1, arg2, arg3, arg4);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_DrawNode_drawQuadBezier : wrong number of arguments: %d, was expecting %d", argc, 5);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_DrawNode_onDrawGLLine(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::DrawNode* cobj = (cocos2d::DrawNode *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_DrawNode_onDrawGLLine : Invalid Native Object");
|
|
if (argc == 2) {
|
|
cocos2d::Mat4 arg0;
|
|
unsigned int arg1 = 0;
|
|
ok &= jsval_to_matrix(cx, args.get(0), &arg0);
|
|
ok &= jsval_to_uint32(cx, args.get(1), &arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_DrawNode_onDrawGLLine : Error processing arguments");
|
|
cobj->onDrawGLLine(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_DrawNode_onDrawGLLine : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_DrawNode_drawSolidPoly(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::DrawNode* cobj = (cocos2d::DrawNode *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_DrawNode_drawSolidPoly : Invalid Native Object");
|
|
if (argc == 3) {
|
|
const cocos2d::Vec2* arg0 = nullptr;
|
|
unsigned int arg1 = 0;
|
|
cocos2d::Color4F arg2;
|
|
std::vector<cocos2d::Vec2> tempData;ok &= jsval_to_vector_vec2(cx, args.get(0), &tempData);arg0=tempData.data();
|
|
ok &= jsval_to_uint32(cx, args.get(1), &arg1);
|
|
ok &= jsval_to_cccolor4f(cx, args.get(2), &arg2);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_DrawNode_drawSolidPoly : Error processing arguments");
|
|
cobj->drawSolidPoly(arg0, arg1, arg2);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_DrawNode_drawSolidPoly : wrong number of arguments: %d, was expecting %d", argc, 3);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_DrawNode_drawTriangle(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::DrawNode* cobj = (cocos2d::DrawNode *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_DrawNode_drawTriangle : Invalid Native Object");
|
|
if (argc == 4) {
|
|
cocos2d::Vec2 arg0;
|
|
cocos2d::Vec2 arg1;
|
|
cocos2d::Vec2 arg2;
|
|
cocos2d::Color4F arg3;
|
|
ok &= jsval_to_vector2(cx, args.get(0), &arg0);
|
|
ok &= jsval_to_vector2(cx, args.get(1), &arg1);
|
|
ok &= jsval_to_vector2(cx, args.get(2), &arg2);
|
|
ok &= jsval_to_cccolor4f(cx, args.get(3), &arg3);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_DrawNode_drawTriangle : Error processing arguments");
|
|
cobj->drawTriangle(arg0, arg1, arg2, arg3);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_DrawNode_drawTriangle : wrong number of arguments: %d, was expecting %d", argc, 4);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_DrawNode_setBlendFunc(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::DrawNode* cobj = (cocos2d::DrawNode *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_DrawNode_setBlendFunc : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::BlendFunc arg0;
|
|
ok &= jsval_to_blendfunc(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_DrawNode_setBlendFunc : Error processing arguments");
|
|
cobj->setBlendFunc(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_DrawNode_setBlendFunc : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_DrawNode_clear(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::DrawNode* cobj = (cocos2d::DrawNode *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_DrawNode_clear : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->clear();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_DrawNode_clear : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_DrawNode_drawCardinalSpline(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::DrawNode* cobj = (cocos2d::DrawNode *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_DrawNode_drawCardinalSpline : Invalid Native Object");
|
|
if (argc == 4) {
|
|
cocos2d::PointArray* arg0 = nullptr;
|
|
double arg1 = 0;
|
|
unsigned int arg2 = 0;
|
|
cocos2d::Color4F arg3;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::PointArray*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
ok &= jsval_to_uint32(cx, args.get(2), &arg2);
|
|
ok &= jsval_to_cccolor4f(cx, args.get(3), &arg3);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_DrawNode_drawCardinalSpline : Error processing arguments");
|
|
cobj->drawCardinalSpline(arg0, arg1, arg2, arg3);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_DrawNode_drawCardinalSpline : wrong number of arguments: %d, was expecting %d", argc, 4);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_DrawNode_drawSolidRect(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::DrawNode* cobj = (cocos2d::DrawNode *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_DrawNode_drawSolidRect : Invalid Native Object");
|
|
if (argc == 3) {
|
|
cocos2d::Vec2 arg0;
|
|
cocos2d::Vec2 arg1;
|
|
cocos2d::Color4F arg2;
|
|
ok &= jsval_to_vector2(cx, args.get(0), &arg0);
|
|
ok &= jsval_to_vector2(cx, args.get(1), &arg1);
|
|
ok &= jsval_to_cccolor4f(cx, args.get(2), &arg2);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_DrawNode_drawSolidRect : Error processing arguments");
|
|
cobj->drawSolidRect(arg0, arg1, arg2);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_DrawNode_drawSolidRect : wrong number of arguments: %d, was expecting %d", argc, 3);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_DrawNode_getLineWidth(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::DrawNode* cobj = (cocos2d::DrawNode *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_DrawNode_getLineWidth : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getLineWidth();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_DrawNode_getLineWidth : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_DrawNode_drawPoint(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::DrawNode* cobj = (cocos2d::DrawNode *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_DrawNode_drawPoint : Invalid Native Object");
|
|
if (argc == 3) {
|
|
cocos2d::Vec2 arg0;
|
|
double arg1 = 0;
|
|
cocos2d::Color4F arg2;
|
|
ok &= jsval_to_vector2(cx, args.get(0), &arg0);
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
ok &= jsval_to_cccolor4f(cx, args.get(2), &arg2);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_DrawNode_drawPoint : Error processing arguments");
|
|
cobj->drawPoint(arg0, arg1, arg2);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_DrawNode_drawPoint : wrong number of arguments: %d, was expecting %d", argc, 3);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_DrawNode_drawCubicBezier(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::DrawNode* cobj = (cocos2d::DrawNode *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_DrawNode_drawCubicBezier : Invalid Native Object");
|
|
if (argc == 6) {
|
|
cocos2d::Vec2 arg0;
|
|
cocos2d::Vec2 arg1;
|
|
cocos2d::Vec2 arg2;
|
|
cocos2d::Vec2 arg3;
|
|
unsigned int arg4 = 0;
|
|
cocos2d::Color4F arg5;
|
|
ok &= jsval_to_vector2(cx, args.get(0), &arg0);
|
|
ok &= jsval_to_vector2(cx, args.get(1), &arg1);
|
|
ok &= jsval_to_vector2(cx, args.get(2), &arg2);
|
|
ok &= jsval_to_vector2(cx, args.get(3), &arg3);
|
|
ok &= jsval_to_uint32(cx, args.get(4), &arg4);
|
|
ok &= jsval_to_cccolor4f(cx, args.get(5), &arg5);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_DrawNode_drawCubicBezier : Error processing arguments");
|
|
cobj->drawCubicBezier(arg0, arg1, arg2, arg3, arg4, arg5);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_DrawNode_drawCubicBezier : wrong number of arguments: %d, was expecting %d", argc, 6);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_DrawNode_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 0) {
|
|
|
|
auto ret = cocos2d::DrawNode::create();
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::DrawNode>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::DrawNode"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_DrawNode_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::DrawNode::create(arg0);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::DrawNode>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::DrawNode"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_DrawNode_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_DrawNode_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::DrawNode* cobj = new (std::nothrow) cocos2d::DrawNode();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::DrawNode>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::DrawNode"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_DrawNode_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::DrawNode *nobj = new (std::nothrow) cocos2d::DrawNode();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::DrawNode");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_Node_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_DrawNode(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_DrawNode_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_DrawNode_class->name = "DrawNode";
|
|
jsb_cocos2d_DrawNode_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_DrawNode_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_DrawNode_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_DrawNode_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_DrawNode_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_DrawNode_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_DrawNode_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_DrawNode_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("drawLine", js_cocos2dx_DrawNode_drawLine, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("drawPoints", js_cocos2dx_DrawNode_drawPoints, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("drawRect", js_cocos2dx_DrawNode_drawRect, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("drawSolidCircle", js_cocos2dx_DrawNode_drawSolidCircle, 5, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setLineWidth", js_cocos2dx_DrawNode_setLineWidth, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("onDrawGLPoint", js_cocos2dx_DrawNode_onDrawGLPoint, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("drawPolygon", js_cocos2dx_DrawNode_drawPolygon, 5, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("drawDot", js_cocos2dx_DrawNode_drawDot, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("drawCatmullRom", js_cocos2dx_DrawNode_drawCatmullRom, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("drawSegment", js_cocos2dx_DrawNode_drawSegment, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getBlendFunc", js_cocos2dx_DrawNode_getBlendFunc, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("onDraw", js_cocos2dx_DrawNode_onDraw, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("drawCircle", js_cocos2dx_DrawNode_drawCircle, 6, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("drawQuadBezier", js_cocos2dx_DrawNode_drawQuadBezier, 5, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("onDrawGLLine", js_cocos2dx_DrawNode_onDrawGLLine, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("drawSolidPoly", js_cocos2dx_DrawNode_drawSolidPoly, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("drawTriangle", js_cocos2dx_DrawNode_drawTriangle, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setBlendFunc", js_cocos2dx_DrawNode_setBlendFunc, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("clear", js_cocos2dx_DrawNode_clear, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("drawCardinalSpline", js_cocos2dx_DrawNode_drawCardinalSpline, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("drawSolidRect", js_cocos2dx_DrawNode_drawSolidRect, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getLineWidth", js_cocos2dx_DrawNode_getLineWidth, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("drawPoint", js_cocos2dx_DrawNode_drawPoint, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("drawCubicBezier", js_cocos2dx_DrawNode_drawCubicBezier, 6, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_DrawNode_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_DrawNode_create, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_Node_prototype);
|
|
jsb_cocos2d_DrawNode_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_DrawNode_class,
|
|
js_cocos2dx_DrawNode_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_DrawNode_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "DrawNode"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::DrawNode>(cx, jsb_cocos2d_DrawNode_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.DrawNode.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_Label_class;
|
|
JSObject *jsb_cocos2d_Label_prototype;
|
|
|
|
bool js_cocos2dx_Label_isClipMarginEnabled(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_isClipMarginEnabled : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->isClipMarginEnabled();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Label_isClipMarginEnabled : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Label_enableShadow(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_enableShadow : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->enableShadow();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
if (argc == 1) {
|
|
cocos2d::Color4B arg0;
|
|
ok &= jsval_to_cccolor4b(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Label_enableShadow : Error processing arguments");
|
|
cobj->enableShadow(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
if (argc == 2) {
|
|
cocos2d::Color4B arg0;
|
|
cocos2d::Size arg1;
|
|
ok &= jsval_to_cccolor4b(cx, args.get(0), &arg0);
|
|
ok &= jsval_to_ccsize(cx, args.get(1), &arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Label_enableShadow : Error processing arguments");
|
|
cobj->enableShadow(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
if (argc == 3) {
|
|
cocos2d::Color4B arg0;
|
|
cocos2d::Size arg1;
|
|
int arg2 = 0;
|
|
ok &= jsval_to_cccolor4b(cx, args.get(0), &arg0);
|
|
ok &= jsval_to_ccsize(cx, args.get(1), &arg1);
|
|
ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Label_enableShadow : Error processing arguments");
|
|
cobj->enableShadow(arg0, arg1, arg2);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Label_enableShadow : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Label_setDimensions(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_setDimensions : Invalid Native Object");
|
|
if (argc == 2) {
|
|
double arg0 = 0;
|
|
double arg1 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Label_setDimensions : Error processing arguments");
|
|
cobj->setDimensions(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Label_setDimensions : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Label_getWidth(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_getWidth : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getWidth();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Label_getWidth : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Label_getString(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_getString : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const std::string& ret = cobj->getString();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = std_string_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Label_getString : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Label_getHeight(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_getHeight : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getHeight();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Label_getHeight : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Label_disableEffect(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::Label* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::Label *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_disableEffect : Invalid Native Object");
|
|
do {
|
|
if (argc == 1) {
|
|
cocos2d::LabelEffect arg0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cobj->disableEffect(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 0) {
|
|
cobj->disableEffect();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Label_disableEffect : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Label_getTextColor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_getTextColor : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const cocos2d::Color4B& ret = cobj->getTextColor();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = cccolor4b_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Label_getTextColor : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Label_getBlendFunc(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_getBlendFunc : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const cocos2d::BlendFunc& ret = cobj->getBlendFunc();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = blendfunc_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Label_getBlendFunc : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Label_enableWrap(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_enableWrap : Invalid Native Object");
|
|
if (argc == 1) {
|
|
bool arg0;
|
|
arg0 = JS::ToBoolean(args.get(0));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Label_enableWrap : Error processing arguments");
|
|
cobj->enableWrap(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Label_enableWrap : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Label_setWidth(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_setWidth : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Label_setWidth : Error processing arguments");
|
|
cobj->setWidth(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Label_setWidth : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Label_getAdditionalKerning(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_getAdditionalKerning : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getAdditionalKerning();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Label_getAdditionalKerning : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Label_getBMFontSize(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_getBMFontSize : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getBMFontSize();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Label_getBMFontSize : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Label_getMaxLineWidth(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_getMaxLineWidth : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getMaxLineWidth();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Label_getMaxLineWidth : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Label_getHorizontalAlignment(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_getHorizontalAlignment : Invalid Native Object");
|
|
if (argc == 0) {
|
|
int ret = (int)cobj->getHorizontalAlignment();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = int32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Label_getHorizontalAlignment : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Label_getShadowOffset(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_getShadowOffset : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::Size ret = cobj->getShadowOffset();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ccsize_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Label_getShadowOffset : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Label_getLineSpacing(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_getLineSpacing : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getLineSpacing();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Label_getLineSpacing : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Label_setClipMarginEnabled(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_setClipMarginEnabled : Invalid Native Object");
|
|
if (argc == 1) {
|
|
bool arg0;
|
|
arg0 = JS::ToBoolean(args.get(0));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Label_setClipMarginEnabled : Error processing arguments");
|
|
cobj->setClipMarginEnabled(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Label_setClipMarginEnabled : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Label_setString(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_setString : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Label_setString : Error processing arguments");
|
|
cobj->setString(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Label_setString : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Label_setSystemFontName(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_setSystemFontName : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Label_setSystemFontName : Error processing arguments");
|
|
cobj->setSystemFontName(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Label_setSystemFontName : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Label_isWrapEnabled(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_isWrapEnabled : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->isWrapEnabled();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Label_isWrapEnabled : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Label_getOutlineSize(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_getOutlineSize : Invalid Native Object");
|
|
if (argc == 0) {
|
|
int ret = cobj->getOutlineSize();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = int32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Label_getOutlineSize : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Label_setBMFontFilePath(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_setBMFontFilePath : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Label_setBMFontFilePath : Error processing arguments");
|
|
bool ret = cobj->setBMFontFilePath(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
if (argc == 2) {
|
|
std::string arg0;
|
|
cocos2d::Vec2 arg1;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
ok &= jsval_to_vector2(cx, args.get(1), &arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Label_setBMFontFilePath : Error processing arguments");
|
|
bool ret = cobj->setBMFontFilePath(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
if (argc == 3) {
|
|
std::string arg0;
|
|
cocos2d::Vec2 arg1;
|
|
double arg2 = 0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
ok &= jsval_to_vector2(cx, args.get(1), &arg1);
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Label_setBMFontFilePath : Error processing arguments");
|
|
bool ret = cobj->setBMFontFilePath(arg0, arg1, arg2);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Label_setBMFontFilePath : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Label_initWithTTF(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::Label* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::Label *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_initWithTTF : Invalid Native Object");
|
|
do {
|
|
if (argc == 2) {
|
|
cocos2d::_ttfConfig arg0;
|
|
#pragma warning NO CONVERSION TO NATIVE FOR _ttfConfig
|
|
ok = false;
|
|
if (!ok) { ok = true; break; }
|
|
std::string arg1;
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
bool ret = cobj->initWithTTF(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 3) {
|
|
cocos2d::_ttfConfig arg0;
|
|
#pragma warning NO CONVERSION TO NATIVE FOR _ttfConfig
|
|
ok = false;
|
|
if (!ok) { ok = true; break; }
|
|
std::string arg1;
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::TextHAlignment arg2;
|
|
ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2);
|
|
if (!ok) { ok = true; break; }
|
|
bool ret = cobj->initWithTTF(arg0, arg1, arg2);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 4) {
|
|
cocos2d::_ttfConfig arg0;
|
|
#pragma warning NO CONVERSION TO NATIVE FOR _ttfConfig
|
|
ok = false;
|
|
if (!ok) { ok = true; break; }
|
|
std::string arg1;
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::TextHAlignment arg2;
|
|
ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2);
|
|
if (!ok) { ok = true; break; }
|
|
int arg3 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(3), (int32_t *)&arg3);
|
|
if (!ok) { ok = true; break; }
|
|
bool ret = cobj->initWithTTF(arg0, arg1, arg2, arg3);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 3) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
std::string arg1;
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
double arg2 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
if (!ok) { ok = true; break; }
|
|
bool ret = cobj->initWithTTF(arg0, arg1, arg2);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 4) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
std::string arg1;
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
double arg2 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Size arg3;
|
|
ok &= jsval_to_ccsize(cx, args.get(3), &arg3);
|
|
if (!ok) { ok = true; break; }
|
|
bool ret = cobj->initWithTTF(arg0, arg1, arg2, arg3);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 5) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
std::string arg1;
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
double arg2 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Size arg3;
|
|
ok &= jsval_to_ccsize(cx, args.get(3), &arg3);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::TextHAlignment arg4;
|
|
ok &= jsval_to_int32(cx, args.get(4), (int32_t *)&arg4);
|
|
if (!ok) { ok = true; break; }
|
|
bool ret = cobj->initWithTTF(arg0, arg1, arg2, arg3, arg4);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 6) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
std::string arg1;
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
double arg2 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Size arg3;
|
|
ok &= jsval_to_ccsize(cx, args.get(3), &arg3);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::TextHAlignment arg4;
|
|
ok &= jsval_to_int32(cx, args.get(4), (int32_t *)&arg4);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::TextVAlignment arg5;
|
|
ok &= jsval_to_int32(cx, args.get(5), (int32_t *)&arg5);
|
|
if (!ok) { ok = true; break; }
|
|
bool ret = cobj->initWithTTF(arg0, arg1, arg2, arg3, arg4, arg5);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Label_initWithTTF : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Label_setLineHeight(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_setLineHeight : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Label_setLineHeight : Error processing arguments");
|
|
cobj->setLineHeight(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Label_setLineHeight : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Label_setSystemFontSize(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_setSystemFontSize : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Label_setSystemFontSize : Error processing arguments");
|
|
cobj->setSystemFontSize(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Label_setSystemFontSize : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Label_setOverflow(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_setOverflow : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Label::Overflow arg0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Label_setOverflow : Error processing arguments");
|
|
cobj->setOverflow(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Label_setOverflow : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Label_enableStrikethrough(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_enableStrikethrough : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->enableStrikethrough();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Label_enableStrikethrough : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Label_updateContent(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_updateContent : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->updateContent();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Label_updateContent : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Label_getStringLength(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_getStringLength : Invalid Native Object");
|
|
if (argc == 0) {
|
|
int ret = cobj->getStringLength();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = int32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Label_getStringLength : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Label_setLineBreakWithoutSpace(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_setLineBreakWithoutSpace : Invalid Native Object");
|
|
if (argc == 1) {
|
|
bool arg0;
|
|
arg0 = JS::ToBoolean(args.get(0));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Label_setLineBreakWithoutSpace : Error processing arguments");
|
|
cobj->setLineBreakWithoutSpace(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Label_setLineBreakWithoutSpace : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Label_getStringNumLines(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_getStringNumLines : Invalid Native Object");
|
|
if (argc == 0) {
|
|
int ret = cobj->getStringNumLines();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = int32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Label_getStringNumLines : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Label_enableOutline(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_enableOutline : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Color4B arg0;
|
|
ok &= jsval_to_cccolor4b(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Label_enableOutline : Error processing arguments");
|
|
cobj->enableOutline(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
if (argc == 2) {
|
|
cocos2d::Color4B arg0;
|
|
int arg1 = 0;
|
|
ok &= jsval_to_cccolor4b(cx, args.get(0), &arg0);
|
|
ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Label_enableOutline : Error processing arguments");
|
|
cobj->enableOutline(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Label_enableOutline : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Label_getShadowBlurRadius(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_getShadowBlurRadius : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getShadowBlurRadius();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Label_getShadowBlurRadius : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Label_getEffectColor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_getEffectColor : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::Color4F ret = cobj->getEffectColor();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = cccolor4f_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Label_getEffectColor : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Label_removeAllChildrenWithCleanup(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_removeAllChildrenWithCleanup : Invalid Native Object");
|
|
if (argc == 1) {
|
|
bool arg0;
|
|
arg0 = JS::ToBoolean(args.get(0));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Label_removeAllChildrenWithCleanup : Error processing arguments");
|
|
cobj->removeAllChildrenWithCleanup(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Label_removeAllChildrenWithCleanup : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Label_setCharMap(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::Label* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::Label *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_setCharMap : Invalid Native Object");
|
|
do {
|
|
if (argc == 4) {
|
|
cocos2d::Texture2D* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Texture2D*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
if (!ok) { ok = true; break; }
|
|
int arg1 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1);
|
|
if (!ok) { ok = true; break; }
|
|
int arg2 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2);
|
|
if (!ok) { ok = true; break; }
|
|
int arg3 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(3), (int32_t *)&arg3);
|
|
if (!ok) { ok = true; break; }
|
|
bool ret = cobj->setCharMap(arg0, arg1, arg2, arg3);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 4) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
int arg1 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1);
|
|
if (!ok) { ok = true; break; }
|
|
int arg2 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2);
|
|
if (!ok) { ok = true; break; }
|
|
int arg3 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(3), (int32_t *)&arg3);
|
|
if (!ok) { ok = true; break; }
|
|
bool ret = cobj->setCharMap(arg0, arg1, arg2, arg3);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
bool ret = cobj->setCharMap(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Label_setCharMap : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Label_getDimensions(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_getDimensions : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const cocos2d::Size& ret = cobj->getDimensions();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ccsize_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Label_getDimensions : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Label_setMaxLineWidth(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_setMaxLineWidth : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Label_setMaxLineWidth : Error processing arguments");
|
|
cobj->setMaxLineWidth(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Label_setMaxLineWidth : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Label_getSystemFontName(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_getSystemFontName : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const std::string& ret = cobj->getSystemFontName();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = std_string_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Label_getSystemFontName : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Label_setVerticalAlignment(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_setVerticalAlignment : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::TextVAlignment arg0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Label_setVerticalAlignment : Error processing arguments");
|
|
cobj->setVerticalAlignment(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Label_setVerticalAlignment : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Label_setLineSpacing(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_setLineSpacing : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Label_setLineSpacing : Error processing arguments");
|
|
cobj->setLineSpacing(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Label_setLineSpacing : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Label_getLineHeight(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_getLineHeight : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getLineHeight();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Label_getLineHeight : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Label_getShadowColor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_getShadowColor : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::Color4F ret = cobj->getShadowColor();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = cccolor4f_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Label_getShadowColor : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Label_getTTFConfig(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_getTTFConfig : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const cocos2d::_ttfConfig& ret = cobj->getTTFConfig();
|
|
jsval jsret = JSVAL_NULL;
|
|
#pragma warning NO CONVERSION FROM NATIVE FOR _ttfConfig;
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Label_getTTFConfig : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Label_enableItalics(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_enableItalics : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->enableItalics();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Label_enableItalics : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Label_setTextColor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_setTextColor : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Color4B arg0;
|
|
ok &= jsval_to_cccolor4b(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Label_setTextColor : Error processing arguments");
|
|
cobj->setTextColor(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Label_setTextColor : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Label_getLetter(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_getLetter : Invalid Native Object");
|
|
if (argc == 1) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Label_getLetter : Error processing arguments");
|
|
cocos2d::Sprite* ret = cobj->getLetter(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Sprite>(cx, (cocos2d::Sprite*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Label_getLetter : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Label_setHeight(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_setHeight : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Label_setHeight : Error processing arguments");
|
|
cobj->setHeight(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Label_setHeight : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Label_isShadowEnabled(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_isShadowEnabled : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->isShadowEnabled();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Label_isShadowEnabled : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Label_enableGlow(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_enableGlow : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Color4B arg0;
|
|
ok &= jsval_to_cccolor4b(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Label_enableGlow : Error processing arguments");
|
|
cobj->enableGlow(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Label_enableGlow : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Label_getOverflow(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_getOverflow : Invalid Native Object");
|
|
if (argc == 0) {
|
|
int ret = (int)cobj->getOverflow();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = int32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Label_getOverflow : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Label_getVerticalAlignment(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_getVerticalAlignment : Invalid Native Object");
|
|
if (argc == 0) {
|
|
int ret = (int)cobj->getVerticalAlignment();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = int32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Label_getVerticalAlignment : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Label_setAdditionalKerning(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_setAdditionalKerning : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Label_setAdditionalKerning : Error processing arguments");
|
|
cobj->setAdditionalKerning(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Label_setAdditionalKerning : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Label_getSystemFontSize(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_getSystemFontSize : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getSystemFontSize();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Label_getSystemFontSize : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Label_setBlendFunc(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_setBlendFunc : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::BlendFunc arg0;
|
|
ok &= jsval_to_blendfunc(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Label_setBlendFunc : Error processing arguments");
|
|
cobj->setBlendFunc(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Label_setBlendFunc : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Label_getTextAlignment(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_getTextAlignment : Invalid Native Object");
|
|
if (argc == 0) {
|
|
int ret = (int)cobj->getTextAlignment();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = int32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Label_getTextAlignment : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Label_getBMFontFilePath(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_getBMFontFilePath : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const std::string& ret = cobj->getBMFontFilePath();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = std_string_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Label_getBMFontFilePath : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Label_setHorizontalAlignment(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_setHorizontalAlignment : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::TextHAlignment arg0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Label_setHorizontalAlignment : Error processing arguments");
|
|
cobj->setHorizontalAlignment(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Label_setHorizontalAlignment : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Label_enableBold(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_enableBold : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->enableBold();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Label_enableBold : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Label_enableUnderline(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_enableUnderline : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->enableUnderline();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Label_enableUnderline : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Label_getLabelEffectType(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_getLabelEffectType : Invalid Native Object");
|
|
if (argc == 0) {
|
|
int ret = (int)cobj->getLabelEffectType();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = int32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Label_getLabelEffectType : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Label_setAlignment(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::Label* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::Label *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_setAlignment : Invalid Native Object");
|
|
do {
|
|
if (argc == 2) {
|
|
cocos2d::TextHAlignment arg0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::TextVAlignment arg1;
|
|
ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1);
|
|
if (!ok) { ok = true; break; }
|
|
cobj->setAlignment(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 1) {
|
|
cocos2d::TextHAlignment arg0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cobj->setAlignment(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Label_setAlignment : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Label_requestSystemFontRefresh(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_requestSystemFontRefresh : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->requestSystemFontRefresh();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Label_requestSystemFontRefresh : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Label_setBMFontSize(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_setBMFontSize : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Label_setBMFontSize : Error processing arguments");
|
|
cobj->setBMFontSize(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Label_setBMFontSize : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Label_createWithBMFont(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 2) {
|
|
std::string arg0;
|
|
std::string arg1;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Label_createWithBMFont : Error processing arguments");
|
|
|
|
auto ret = cocos2d::Label::createWithBMFont(arg0, arg1);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::Label>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::Label"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
if (argc == 3) {
|
|
std::string arg0;
|
|
std::string arg1;
|
|
cocos2d::TextHAlignment arg2;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
|
ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Label_createWithBMFont : Error processing arguments");
|
|
|
|
auto ret = cocos2d::Label::createWithBMFont(arg0, arg1, arg2);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::Label>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::Label"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
if (argc == 4) {
|
|
std::string arg0;
|
|
std::string arg1;
|
|
cocos2d::TextHAlignment arg2;
|
|
int arg3 = 0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
|
ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2);
|
|
ok &= jsval_to_int32(cx, args.get(3), (int32_t *)&arg3);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Label_createWithBMFont : Error processing arguments");
|
|
|
|
auto ret = cocos2d::Label::createWithBMFont(arg0, arg1, arg2, arg3);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::Label>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::Label"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
if (argc == 5) {
|
|
std::string arg0;
|
|
std::string arg1;
|
|
cocos2d::TextHAlignment arg2;
|
|
int arg3 = 0;
|
|
cocos2d::Vec2 arg4;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
|
ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2);
|
|
ok &= jsval_to_int32(cx, args.get(3), (int32_t *)&arg3);
|
|
ok &= jsval_to_vector2(cx, args.get(4), &arg4);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Label_createWithBMFont : Error processing arguments");
|
|
|
|
auto ret = cocos2d::Label::createWithBMFont(arg0, arg1, arg2, arg3, arg4);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::Label>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::Label"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_Label_createWithBMFont : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_Label_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
if (argc == 0) {
|
|
|
|
auto ret = cocos2d::Label::create();
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::Label>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::Label"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_Label_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_Label_createWithCharMap(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
|
|
do {
|
|
if (argc == 4) {
|
|
cocos2d::Texture2D* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Texture2D*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
if (!ok) { ok = true; break; }
|
|
int arg1 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1);
|
|
if (!ok) { ok = true; break; }
|
|
int arg2 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2);
|
|
if (!ok) { ok = true; break; }
|
|
int arg3 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(3), (int32_t *)&arg3);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Label* ret = cocos2d::Label::createWithCharMap(arg0, arg1, arg2, arg3);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Label>(cx, (cocos2d::Label*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
|
|
do {
|
|
if (argc == 4) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
int arg1 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1);
|
|
if (!ok) { ok = true; break; }
|
|
int arg2 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2);
|
|
if (!ok) { ok = true; break; }
|
|
int arg3 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(3), (int32_t *)&arg3);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Label* ret = cocos2d::Label::createWithCharMap(arg0, arg1, arg2, arg3);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Label>(cx, (cocos2d::Label*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
|
|
do {
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Label* ret = cocos2d::Label::createWithCharMap(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Label>(cx, (cocos2d::Label*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
JS_ReportError(cx, "js_cocos2dx_Label_createWithCharMap : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Label_createWithSystemFont(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 3) {
|
|
std::string arg0;
|
|
std::string arg1;
|
|
double arg2 = 0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Label_createWithSystemFont : Error processing arguments");
|
|
|
|
auto ret = cocos2d::Label::createWithSystemFont(arg0, arg1, arg2);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::Label>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::Label"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
if (argc == 4) {
|
|
std::string arg0;
|
|
std::string arg1;
|
|
double arg2 = 0;
|
|
cocos2d::Size arg3;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
ok &= jsval_to_ccsize(cx, args.get(3), &arg3);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Label_createWithSystemFont : Error processing arguments");
|
|
|
|
auto ret = cocos2d::Label::createWithSystemFont(arg0, arg1, arg2, arg3);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::Label>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::Label"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
if (argc == 5) {
|
|
std::string arg0;
|
|
std::string arg1;
|
|
double arg2 = 0;
|
|
cocos2d::Size arg3;
|
|
cocos2d::TextHAlignment arg4;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
ok &= jsval_to_ccsize(cx, args.get(3), &arg3);
|
|
ok &= jsval_to_int32(cx, args.get(4), (int32_t *)&arg4);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Label_createWithSystemFont : Error processing arguments");
|
|
|
|
auto ret = cocos2d::Label::createWithSystemFont(arg0, arg1, arg2, arg3, arg4);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::Label>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::Label"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
if (argc == 6) {
|
|
std::string arg0;
|
|
std::string arg1;
|
|
double arg2 = 0;
|
|
cocos2d::Size arg3;
|
|
cocos2d::TextHAlignment arg4;
|
|
cocos2d::TextVAlignment arg5;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
ok &= jsval_to_ccsize(cx, args.get(3), &arg3);
|
|
ok &= jsval_to_int32(cx, args.get(4), (int32_t *)&arg4);
|
|
ok &= jsval_to_int32(cx, args.get(5), (int32_t *)&arg5);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Label_createWithSystemFont : Error processing arguments");
|
|
|
|
auto ret = cocos2d::Label::createWithSystemFont(arg0, arg1, arg2, arg3, arg4, arg5);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::Label>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::Label"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_Label_createWithSystemFont : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_Label_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::Label* cobj = new (std::nothrow) cocos2d::Label();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::Label>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::Label"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_Label_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::Label *nobj = new (std::nothrow) cocos2d::Label();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::Label");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_Node_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_Label(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_Label_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_Label_class->name = "Label";
|
|
jsb_cocos2d_Label_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Label_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_Label_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Label_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_Label_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_Label_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_Label_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_Label_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("isClipMarginEnabled", js_cocos2dx_Label_isClipMarginEnabled, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("enableShadow", js_cocos2dx_Label_enableShadow, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setDimensions", js_cocos2dx_Label_setDimensions, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getWidth", js_cocos2dx_Label_getWidth, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getString", js_cocos2dx_Label_getString, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getHeight", js_cocos2dx_Label_getHeight, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("disableEffect", js_cocos2dx_Label_disableEffect, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getTextColor", js_cocos2dx_Label_getTextColor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getBlendFunc", js_cocos2dx_Label_getBlendFunc, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("enableWrap", js_cocos2dx_Label_enableWrap, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setWidth", js_cocos2dx_Label_setWidth, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getAdditionalKerning", js_cocos2dx_Label_getAdditionalKerning, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getBMFontSize", js_cocos2dx_Label_getBMFontSize, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getMaxLineWidth", js_cocos2dx_Label_getMaxLineWidth, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getHorizontalAlignment", js_cocos2dx_Label_getHorizontalAlignment, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getShadowOffset", js_cocos2dx_Label_getShadowOffset, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getLineSpacing", js_cocos2dx_Label_getLineSpacing, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setClipMarginEnabled", js_cocos2dx_Label_setClipMarginEnabled, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setString", js_cocos2dx_Label_setString, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setSystemFontName", js_cocos2dx_Label_setSystemFontName, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("isWrapEnabled", js_cocos2dx_Label_isWrapEnabled, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getOutlineSize", js_cocos2dx_Label_getOutlineSize, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setBMFontFilePath", js_cocos2dx_Label_setBMFontFilePath, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initWithTTF", js_cocos2dx_Label_initWithTTF, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setLineHeight", js_cocos2dx_Label_setLineHeight, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setSystemFontSize", js_cocos2dx_Label_setSystemFontSize, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setOverflow", js_cocos2dx_Label_setOverflow, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("enableStrikethrough", js_cocos2dx_Label_enableStrikethrough, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("updateContent", js_cocos2dx_Label_updateContent, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getStringLength", js_cocos2dx_Label_getStringLength, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setLineBreakWithoutSpace", js_cocos2dx_Label_setLineBreakWithoutSpace, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getStringNumLines", js_cocos2dx_Label_getStringNumLines, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("enableOutline", js_cocos2dx_Label_enableOutline, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getShadowBlurRadius", js_cocos2dx_Label_getShadowBlurRadius, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getEffectColor", js_cocos2dx_Label_getEffectColor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("removeAllChildrenWithCleanup", js_cocos2dx_Label_removeAllChildrenWithCleanup, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setCharMap", js_cocos2dx_Label_setCharMap, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getDimensions", js_cocos2dx_Label_getDimensions, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setMaxLineWidth", js_cocos2dx_Label_setMaxLineWidth, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getSystemFontName", js_cocos2dx_Label_getSystemFontName, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setVerticalAlignment", js_cocos2dx_Label_setVerticalAlignment, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setLineSpacing", js_cocos2dx_Label_setLineSpacing, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getLineHeight", js_cocos2dx_Label_getLineHeight, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getShadowColor", js_cocos2dx_Label_getShadowColor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getTTFConfig", js_cocos2dx_Label_getTTFConfig, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("enableItalics", js_cocos2dx_Label_enableItalics, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setTextColor", js_cocos2dx_Label_setTextColor, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getLetter", js_cocos2dx_Label_getLetter, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setHeight", js_cocos2dx_Label_setHeight, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("isShadowEnabled", js_cocos2dx_Label_isShadowEnabled, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("enableGlow", js_cocos2dx_Label_enableGlow, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getOverflow", js_cocos2dx_Label_getOverflow, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getVerticalAlignment", js_cocos2dx_Label_getVerticalAlignment, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setAdditionalKerning", js_cocos2dx_Label_setAdditionalKerning, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getSystemFontSize", js_cocos2dx_Label_getSystemFontSize, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setBlendFunc", js_cocos2dx_Label_setBlendFunc, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getTextAlignment", js_cocos2dx_Label_getTextAlignment, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getBMFontFilePath", js_cocos2dx_Label_getBMFontFilePath, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setHorizontalAlignment", js_cocos2dx_Label_setHorizontalAlignment, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("enableBold", js_cocos2dx_Label_enableBold, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("enableUnderline", js_cocos2dx_Label_enableUnderline, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getLabelEffectType", js_cocos2dx_Label_getLabelEffectType, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setAlignment", js_cocos2dx_Label_setAlignment, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("requestSystemFontRefresh", js_cocos2dx_Label_requestSystemFontRefresh, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setBMFontSize", js_cocos2dx_Label_setBMFontSize, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_Label_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("createWithBMFont", js_cocos2dx_Label_createWithBMFont, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("create", js_cocos2dx_Label_create, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("createWithCharMap", js_cocos2dx_Label_createWithCharMap, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("createWithSystemFont", js_cocos2dx_Label_createWithSystemFont, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_Node_prototype);
|
|
jsb_cocos2d_Label_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_Label_class,
|
|
js_cocos2dx_Label_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_Label_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "Label"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::Label>(cx, jsb_cocos2d_Label_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.Label.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_LabelAtlas_class;
|
|
JSObject *jsb_cocos2d_LabelAtlas_prototype;
|
|
|
|
bool js_cocos2dx_LabelAtlas_setString(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::LabelAtlas* cobj = (cocos2d::LabelAtlas *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_LabelAtlas_setString : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_LabelAtlas_setString : Error processing arguments");
|
|
cobj->setString(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_LabelAtlas_setString : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_LabelAtlas_initWithString(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::LabelAtlas* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::LabelAtlas *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_LabelAtlas_initWithString : Invalid Native Object");
|
|
do {
|
|
if (argc == 2) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
std::string arg1;
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
bool ret = cobj->initWithString(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 5) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
std::string arg1;
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
int arg2 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2);
|
|
if (!ok) { ok = true; break; }
|
|
int arg3 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(3), (int32_t *)&arg3);
|
|
if (!ok) { ok = true; break; }
|
|
int arg4 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(4), (int32_t *)&arg4);
|
|
if (!ok) { ok = true; break; }
|
|
bool ret = cobj->initWithString(arg0, arg1, arg2, arg3, arg4);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 5) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Texture2D* arg1 = nullptr;
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::Texture2D*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
if (!ok) { ok = true; break; }
|
|
int arg2 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2);
|
|
if (!ok) { ok = true; break; }
|
|
int arg3 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(3), (int32_t *)&arg3);
|
|
if (!ok) { ok = true; break; }
|
|
int arg4 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(4), (int32_t *)&arg4);
|
|
if (!ok) { ok = true; break; }
|
|
bool ret = cobj->initWithString(arg0, arg1, arg2, arg3, arg4);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_LabelAtlas_initWithString : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_LabelAtlas_getString(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::LabelAtlas* cobj = (cocos2d::LabelAtlas *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_LabelAtlas_getString : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const std::string& ret = cobj->getString();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = std_string_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_LabelAtlas_getString : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_LabelAtlas_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
|
|
do {
|
|
if (argc == 5) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
std::string arg1;
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
int arg2 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2);
|
|
if (!ok) { ok = true; break; }
|
|
int arg3 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(3), (int32_t *)&arg3);
|
|
if (!ok) { ok = true; break; }
|
|
int arg4 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(4), (int32_t *)&arg4);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::LabelAtlas* ret = cocos2d::LabelAtlas::create(arg0, arg1, arg2, arg3, arg4);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::LabelAtlas>(cx, (cocos2d::LabelAtlas*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
|
|
do {
|
|
if (argc == 0) {
|
|
cocos2d::LabelAtlas* ret = cocos2d::LabelAtlas::create();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::LabelAtlas>(cx, (cocos2d::LabelAtlas*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
|
|
do {
|
|
if (argc == 2) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
std::string arg1;
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::LabelAtlas* ret = cocos2d::LabelAtlas::create(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::LabelAtlas>(cx, (cocos2d::LabelAtlas*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
JS_ReportError(cx, "js_cocos2dx_LabelAtlas_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_LabelAtlas_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::LabelAtlas* cobj = new (std::nothrow) cocos2d::LabelAtlas();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::LabelAtlas>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::LabelAtlas"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_LabelAtlas_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::LabelAtlas *nobj = new (std::nothrow) cocos2d::LabelAtlas();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::LabelAtlas");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_AtlasNode_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_LabelAtlas(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_LabelAtlas_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_LabelAtlas_class->name = "LabelAtlas";
|
|
jsb_cocos2d_LabelAtlas_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_LabelAtlas_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_LabelAtlas_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_LabelAtlas_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_LabelAtlas_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_LabelAtlas_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_LabelAtlas_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_LabelAtlas_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("setString", js_cocos2dx_LabelAtlas_setString, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initWithString", js_cocos2dx_LabelAtlas_initWithString, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getString", js_cocos2dx_LabelAtlas_getString, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_LabelAtlas_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("_create", js_cocos2dx_LabelAtlas_create, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_AtlasNode_prototype);
|
|
jsb_cocos2d_LabelAtlas_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_LabelAtlas_class,
|
|
js_cocos2dx_LabelAtlas_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_LabelAtlas_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "LabelAtlas"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::LabelAtlas>(cx, jsb_cocos2d_LabelAtlas_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.LabelAtlas.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_LabelBMFont_class;
|
|
JSObject *jsb_cocos2d_LabelBMFont_prototype;
|
|
|
|
bool js_cocos2dx_LabelBMFont_setLineBreakWithoutSpace(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::LabelBMFont* cobj = (cocos2d::LabelBMFont *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_LabelBMFont_setLineBreakWithoutSpace : Invalid Native Object");
|
|
if (argc == 1) {
|
|
bool arg0;
|
|
arg0 = JS::ToBoolean(args.get(0));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_LabelBMFont_setLineBreakWithoutSpace : Error processing arguments");
|
|
cobj->setLineBreakWithoutSpace(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_LabelBMFont_setLineBreakWithoutSpace : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_LabelBMFont_getBlendFunc(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::LabelBMFont* cobj = (cocos2d::LabelBMFont *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_LabelBMFont_getBlendFunc : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const cocos2d::BlendFunc& ret = cobj->getBlendFunc();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = blendfunc_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_LabelBMFont_getBlendFunc : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_LabelBMFont_getLetter(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::LabelBMFont* cobj = (cocos2d::LabelBMFont *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_LabelBMFont_getLetter : Invalid Native Object");
|
|
if (argc == 1) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_LabelBMFont_getLetter : Error processing arguments");
|
|
cocos2d::Sprite* ret = cobj->getLetter(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Sprite>(cx, (cocos2d::Sprite*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_LabelBMFont_getLetter : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_LabelBMFont_getString(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::LabelBMFont* cobj = (cocos2d::LabelBMFont *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_LabelBMFont_getString : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const std::string& ret = cobj->getString();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = std_string_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_LabelBMFont_getString : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_LabelBMFont_setBlendFunc(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::LabelBMFont* cobj = (cocos2d::LabelBMFont *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_LabelBMFont_setBlendFunc : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::BlendFunc arg0;
|
|
ok &= jsval_to_blendfunc(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_LabelBMFont_setBlendFunc : Error processing arguments");
|
|
cobj->setBlendFunc(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_LabelBMFont_setBlendFunc : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_LabelBMFont_setString(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::LabelBMFont* cobj = (cocos2d::LabelBMFont *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_LabelBMFont_setString : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_LabelBMFont_setString : Error processing arguments");
|
|
cobj->setString(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_LabelBMFont_setString : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_LabelBMFont_initWithString(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::LabelBMFont* cobj = (cocos2d::LabelBMFont *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_LabelBMFont_initWithString : Invalid Native Object");
|
|
if (argc == 2) {
|
|
std::string arg0;
|
|
std::string arg1;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_LabelBMFont_initWithString : Error processing arguments");
|
|
bool ret = cobj->initWithString(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
if (argc == 3) {
|
|
std::string arg0;
|
|
std::string arg1;
|
|
double arg2 = 0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_LabelBMFont_initWithString : Error processing arguments");
|
|
bool ret = cobj->initWithString(arg0, arg1, arg2);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
if (argc == 4) {
|
|
std::string arg0;
|
|
std::string arg1;
|
|
double arg2 = 0;
|
|
cocos2d::TextHAlignment arg3;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
ok &= jsval_to_int32(cx, args.get(3), (int32_t *)&arg3);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_LabelBMFont_initWithString : Error processing arguments");
|
|
bool ret = cobj->initWithString(arg0, arg1, arg2, arg3);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
if (argc == 5) {
|
|
std::string arg0;
|
|
std::string arg1;
|
|
double arg2 = 0;
|
|
cocos2d::TextHAlignment arg3;
|
|
cocos2d::Vec2 arg4;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
ok &= jsval_to_int32(cx, args.get(3), (int32_t *)&arg3);
|
|
ok &= jsval_to_vector2(cx, args.get(4), &arg4);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_LabelBMFont_initWithString : Error processing arguments");
|
|
bool ret = cobj->initWithString(arg0, arg1, arg2, arg3, arg4);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_LabelBMFont_initWithString : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_LabelBMFont_getFntFile(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::LabelBMFont* cobj = (cocos2d::LabelBMFont *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_LabelBMFont_getFntFile : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const std::string& ret = cobj->getFntFile();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = std_string_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_LabelBMFont_getFntFile : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_LabelBMFont_setFntFile(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::LabelBMFont* cobj = (cocos2d::LabelBMFont *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_LabelBMFont_setFntFile : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_LabelBMFont_setFntFile : Error processing arguments");
|
|
cobj->setFntFile(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
if (argc == 2) {
|
|
std::string arg0;
|
|
cocos2d::Vec2 arg1;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
ok &= jsval_to_vector2(cx, args.get(1), &arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_LabelBMFont_setFntFile : Error processing arguments");
|
|
cobj->setFntFile(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_LabelBMFont_setFntFile : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_LabelBMFont_setAlignment(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::LabelBMFont* cobj = (cocos2d::LabelBMFont *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_LabelBMFont_setAlignment : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::TextHAlignment arg0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_LabelBMFont_setAlignment : Error processing arguments");
|
|
cobj->setAlignment(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_LabelBMFont_setAlignment : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_LabelBMFont_setWidth(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::LabelBMFont* cobj = (cocos2d::LabelBMFont *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_LabelBMFont_setWidth : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_LabelBMFont_setWidth : Error processing arguments");
|
|
cobj->setWidth(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_LabelBMFont_setWidth : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_LabelBMFont_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
|
|
do {
|
|
if (argc == 0) {
|
|
cocos2d::LabelBMFont* ret = cocos2d::LabelBMFont::create();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::LabelBMFont>(cx, (cocos2d::LabelBMFont*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
|
|
do {
|
|
if (argc == 2) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
std::string arg1;
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::LabelBMFont* ret = cocos2d::LabelBMFont::create(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::LabelBMFont>(cx, (cocos2d::LabelBMFont*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
do {
|
|
if (argc == 3) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
std::string arg1;
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
double arg2 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::LabelBMFont* ret = cocos2d::LabelBMFont::create(arg0, arg1, arg2);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::LabelBMFont>(cx, (cocos2d::LabelBMFont*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
do {
|
|
if (argc == 4) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
std::string arg1;
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
double arg2 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::TextHAlignment arg3;
|
|
ok &= jsval_to_int32(cx, args.get(3), (int32_t *)&arg3);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::LabelBMFont* ret = cocos2d::LabelBMFont::create(arg0, arg1, arg2, arg3);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::LabelBMFont>(cx, (cocos2d::LabelBMFont*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
do {
|
|
if (argc == 5) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
std::string arg1;
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
double arg2 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::TextHAlignment arg3;
|
|
ok &= jsval_to_int32(cx, args.get(3), (int32_t *)&arg3);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Vec2 arg4;
|
|
ok &= jsval_to_vector2(cx, args.get(4), &arg4);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::LabelBMFont* ret = cocos2d::LabelBMFont::create(arg0, arg1, arg2, arg3, arg4);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::LabelBMFont>(cx, (cocos2d::LabelBMFont*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
JS_ReportError(cx, "js_cocos2dx_LabelBMFont_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_LabelBMFont_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::LabelBMFont* cobj = new (std::nothrow) cocos2d::LabelBMFont();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::LabelBMFont>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::LabelBMFont"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_LabelBMFont_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::LabelBMFont *nobj = new (std::nothrow) cocos2d::LabelBMFont();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::LabelBMFont");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_Node_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_LabelBMFont(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_LabelBMFont_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_LabelBMFont_class->name = "LabelBMFont";
|
|
jsb_cocos2d_LabelBMFont_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_LabelBMFont_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_LabelBMFont_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_LabelBMFont_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_LabelBMFont_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_LabelBMFont_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_LabelBMFont_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_LabelBMFont_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("setLineBreakWithoutSpace", js_cocos2dx_LabelBMFont_setLineBreakWithoutSpace, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getBlendFunc", js_cocos2dx_LabelBMFont_getBlendFunc, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getLetter", js_cocos2dx_LabelBMFont_getLetter, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getString", js_cocos2dx_LabelBMFont_getString, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setBlendFunc", js_cocos2dx_LabelBMFont_setBlendFunc, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setString", js_cocos2dx_LabelBMFont_setString, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initWithString", js_cocos2dx_LabelBMFont_initWithString, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getFntFile", js_cocos2dx_LabelBMFont_getFntFile, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setFntFile", js_cocos2dx_LabelBMFont_setFntFile, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setAlignment", js_cocos2dx_LabelBMFont_setAlignment, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setWidth", js_cocos2dx_LabelBMFont_setWidth, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_LabelBMFont_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_LabelBMFont_create, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_Node_prototype);
|
|
jsb_cocos2d_LabelBMFont_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_LabelBMFont_class,
|
|
js_cocos2dx_LabelBMFont_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_LabelBMFont_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "LabelBMFont"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::LabelBMFont>(cx, jsb_cocos2d_LabelBMFont_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.LabelBMFont.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_LabelTTF_class;
|
|
JSObject *jsb_cocos2d_LabelTTF_prototype;
|
|
|
|
bool js_cocos2dx_LabelTTF_enableShadow(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::LabelTTF* cobj = (cocos2d::LabelTTF *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_LabelTTF_enableShadow : Invalid Native Object");
|
|
if (argc == 3) {
|
|
cocos2d::Size arg0;
|
|
double arg1 = 0;
|
|
double arg2 = 0;
|
|
ok &= jsval_to_ccsize(cx, args.get(0), &arg0);
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_LabelTTF_enableShadow : Error processing arguments");
|
|
cobj->enableShadow(arg0, arg1, arg2);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
if (argc == 4) {
|
|
cocos2d::Size arg0;
|
|
double arg1 = 0;
|
|
double arg2 = 0;
|
|
bool arg3;
|
|
ok &= jsval_to_ccsize(cx, args.get(0), &arg0);
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
arg3 = JS::ToBoolean(args.get(3));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_LabelTTF_enableShadow : Error processing arguments");
|
|
cobj->enableShadow(arg0, arg1, arg2, arg3);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_LabelTTF_enableShadow : wrong number of arguments: %d, was expecting %d", argc, 3);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_LabelTTF_setDimensions(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::LabelTTF* cobj = (cocos2d::LabelTTF *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_LabelTTF_setDimensions : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Size arg0;
|
|
ok &= jsval_to_ccsize(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_LabelTTF_setDimensions : Error processing arguments");
|
|
cobj->setDimensions(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_LabelTTF_setDimensions : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_LabelTTF_getFontSize(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::LabelTTF* cobj = (cocos2d::LabelTTF *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_LabelTTF_getFontSize : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getFontSize();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_LabelTTF_getFontSize : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_LabelTTF_getString(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::LabelTTF* cobj = (cocos2d::LabelTTF *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_LabelTTF_getString : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const std::string& ret = cobj->getString();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = std_string_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_LabelTTF_getString : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_LabelTTF_setFlippedY(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::LabelTTF* cobj = (cocos2d::LabelTTF *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_LabelTTF_setFlippedY : Invalid Native Object");
|
|
if (argc == 1) {
|
|
bool arg0;
|
|
arg0 = JS::ToBoolean(args.get(0));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_LabelTTF_setFlippedY : Error processing arguments");
|
|
cobj->setFlippedY(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_LabelTTF_setFlippedY : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_LabelTTF_setFlippedX(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::LabelTTF* cobj = (cocos2d::LabelTTF *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_LabelTTF_setFlippedX : Invalid Native Object");
|
|
if (argc == 1) {
|
|
bool arg0;
|
|
arg0 = JS::ToBoolean(args.get(0));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_LabelTTF_setFlippedX : Error processing arguments");
|
|
cobj->setFlippedX(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_LabelTTF_setFlippedX : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_LabelTTF_setTextDefinition(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::LabelTTF* cobj = (cocos2d::LabelTTF *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_LabelTTF_setTextDefinition : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::FontDefinition arg0;
|
|
ok &= jsval_to_FontDefinition(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_LabelTTF_setTextDefinition : Error processing arguments");
|
|
cobj->setTextDefinition(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_LabelTTF_setTextDefinition : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_LabelTTF_setFontName(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::LabelTTF* cobj = (cocos2d::LabelTTF *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_LabelTTF_setFontName : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_LabelTTF_setFontName : Error processing arguments");
|
|
cobj->setFontName(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_LabelTTF_setFontName : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_LabelTTF_getHorizontalAlignment(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::LabelTTF* cobj = (cocos2d::LabelTTF *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_LabelTTF_getHorizontalAlignment : Invalid Native Object");
|
|
if (argc == 0) {
|
|
int ret = (int)cobj->getHorizontalAlignment();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = int32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_LabelTTF_getHorizontalAlignment : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_LabelTTF_initWithStringAndTextDefinition(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::LabelTTF* cobj = (cocos2d::LabelTTF *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_LabelTTF_initWithStringAndTextDefinition : Invalid Native Object");
|
|
if (argc == 2) {
|
|
std::string arg0;
|
|
cocos2d::FontDefinition arg1;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
ok &= jsval_to_FontDefinition(cx, args.get(1), &arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_LabelTTF_initWithStringAndTextDefinition : Error processing arguments");
|
|
bool ret = cobj->initWithStringAndTextDefinition(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_LabelTTF_initWithStringAndTextDefinition : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_LabelTTF_setString(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::LabelTTF* cobj = (cocos2d::LabelTTF *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_LabelTTF_setString : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_LabelTTF_setString : Error processing arguments");
|
|
cobj->setString(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_LabelTTF_setString : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_LabelTTF_initWithString(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::LabelTTF* cobj = (cocos2d::LabelTTF *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_LabelTTF_initWithString : Invalid Native Object");
|
|
if (argc == 3) {
|
|
std::string arg0;
|
|
std::string arg1;
|
|
double arg2 = 0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_LabelTTF_initWithString : Error processing arguments");
|
|
bool ret = cobj->initWithString(arg0, arg1, arg2);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
if (argc == 4) {
|
|
std::string arg0;
|
|
std::string arg1;
|
|
double arg2 = 0;
|
|
cocos2d::Size arg3;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
ok &= jsval_to_ccsize(cx, args.get(3), &arg3);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_LabelTTF_initWithString : Error processing arguments");
|
|
bool ret = cobj->initWithString(arg0, arg1, arg2, arg3);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
if (argc == 5) {
|
|
std::string arg0;
|
|
std::string arg1;
|
|
double arg2 = 0;
|
|
cocos2d::Size arg3;
|
|
cocos2d::TextHAlignment arg4;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
ok &= jsval_to_ccsize(cx, args.get(3), &arg3);
|
|
ok &= jsval_to_int32(cx, args.get(4), (int32_t *)&arg4);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_LabelTTF_initWithString : Error processing arguments");
|
|
bool ret = cobj->initWithString(arg0, arg1, arg2, arg3, arg4);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
if (argc == 6) {
|
|
std::string arg0;
|
|
std::string arg1;
|
|
double arg2 = 0;
|
|
cocos2d::Size arg3;
|
|
cocos2d::TextHAlignment arg4;
|
|
cocos2d::TextVAlignment arg5;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
ok &= jsval_to_ccsize(cx, args.get(3), &arg3);
|
|
ok &= jsval_to_int32(cx, args.get(4), (int32_t *)&arg4);
|
|
ok &= jsval_to_int32(cx, args.get(5), (int32_t *)&arg5);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_LabelTTF_initWithString : Error processing arguments");
|
|
bool ret = cobj->initWithString(arg0, arg1, arg2, arg3, arg4, arg5);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_LabelTTF_initWithString : wrong number of arguments: %d, was expecting %d", argc, 3);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_LabelTTF_setFontFillColor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::LabelTTF* cobj = (cocos2d::LabelTTF *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_LabelTTF_setFontFillColor : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Color3B arg0;
|
|
ok &= jsval_to_cccolor3b(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_LabelTTF_setFontFillColor : Error processing arguments");
|
|
cobj->setFontFillColor(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
if (argc == 2) {
|
|
cocos2d::Color3B arg0;
|
|
bool arg1;
|
|
ok &= jsval_to_cccolor3b(cx, args.get(0), &arg0);
|
|
arg1 = JS::ToBoolean(args.get(1));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_LabelTTF_setFontFillColor : Error processing arguments");
|
|
cobj->setFontFillColor(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_LabelTTF_setFontFillColor : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_LabelTTF_getBlendFunc(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::LabelTTF* cobj = (cocos2d::LabelTTF *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_LabelTTF_getBlendFunc : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const cocos2d::BlendFunc& ret = cobj->getBlendFunc();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = blendfunc_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_LabelTTF_getBlendFunc : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_LabelTTF_enableStroke(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::LabelTTF* cobj = (cocos2d::LabelTTF *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_LabelTTF_enableStroke : Invalid Native Object");
|
|
if (argc == 2) {
|
|
cocos2d::Color3B arg0;
|
|
double arg1 = 0;
|
|
ok &= jsval_to_cccolor3b(cx, args.get(0), &arg0);
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_LabelTTF_enableStroke : Error processing arguments");
|
|
cobj->enableStroke(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
if (argc == 3) {
|
|
cocos2d::Color3B arg0;
|
|
double arg1 = 0;
|
|
bool arg2;
|
|
ok &= jsval_to_cccolor3b(cx, args.get(0), &arg0);
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
arg2 = JS::ToBoolean(args.get(2));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_LabelTTF_enableStroke : Error processing arguments");
|
|
cobj->enableStroke(arg0, arg1, arg2);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_LabelTTF_enableStroke : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_LabelTTF_getDimensions(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::LabelTTF* cobj = (cocos2d::LabelTTF *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_LabelTTF_getDimensions : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const cocos2d::Size& ret = cobj->getDimensions();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ccsize_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_LabelTTF_getDimensions : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_LabelTTF_setVerticalAlignment(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::LabelTTF* cobj = (cocos2d::LabelTTF *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_LabelTTF_setVerticalAlignment : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::TextVAlignment arg0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_LabelTTF_setVerticalAlignment : Error processing arguments");
|
|
cobj->setVerticalAlignment(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_LabelTTF_setVerticalAlignment : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_LabelTTF_setFontSize(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::LabelTTF* cobj = (cocos2d::LabelTTF *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_LabelTTF_setFontSize : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_LabelTTF_setFontSize : Error processing arguments");
|
|
cobj->setFontSize(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_LabelTTF_setFontSize : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_LabelTTF_getVerticalAlignment(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::LabelTTF* cobj = (cocos2d::LabelTTF *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_LabelTTF_getVerticalAlignment : Invalid Native Object");
|
|
if (argc == 0) {
|
|
int ret = (int)cobj->getVerticalAlignment();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = int32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_LabelTTF_getVerticalAlignment : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_LabelTTF_getTextDefinition(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::LabelTTF* cobj = (cocos2d::LabelTTF *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_LabelTTF_getTextDefinition : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const cocos2d::FontDefinition& ret = cobj->getTextDefinition();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = FontDefinition_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_LabelTTF_getTextDefinition : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_LabelTTF_setBlendFunc(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::LabelTTF* cobj = (cocos2d::LabelTTF *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_LabelTTF_setBlendFunc : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::BlendFunc arg0;
|
|
ok &= jsval_to_blendfunc(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_LabelTTF_setBlendFunc : Error processing arguments");
|
|
cobj->setBlendFunc(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_LabelTTF_setBlendFunc : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_LabelTTF_getFontName(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::LabelTTF* cobj = (cocos2d::LabelTTF *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_LabelTTF_getFontName : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const std::string& ret = cobj->getFontName();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = std_string_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_LabelTTF_getFontName : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_LabelTTF_setHorizontalAlignment(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::LabelTTF* cobj = (cocos2d::LabelTTF *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_LabelTTF_setHorizontalAlignment : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::TextHAlignment arg0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_LabelTTF_setHorizontalAlignment : Error processing arguments");
|
|
cobj->setHorizontalAlignment(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_LabelTTF_setHorizontalAlignment : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_LabelTTF_disableShadow(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::LabelTTF* cobj = (cocos2d::LabelTTF *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_LabelTTF_disableShadow : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->disableShadow();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
if (argc == 1) {
|
|
bool arg0;
|
|
arg0 = JS::ToBoolean(args.get(0));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_LabelTTF_disableShadow : Error processing arguments");
|
|
cobj->disableShadow(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_LabelTTF_disableShadow : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_LabelTTF_disableStroke(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::LabelTTF* cobj = (cocos2d::LabelTTF *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_LabelTTF_disableStroke : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->disableStroke();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
if (argc == 1) {
|
|
bool arg0;
|
|
arg0 = JS::ToBoolean(args.get(0));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_LabelTTF_disableStroke : Error processing arguments");
|
|
cobj->disableStroke(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_LabelTTF_disableStroke : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_LabelTTF_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
|
|
do {
|
|
if (argc == 0) {
|
|
cocos2d::LabelTTF* ret = cocos2d::LabelTTF::create();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::LabelTTF>(cx, (cocos2d::LabelTTF*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
|
|
do {
|
|
if (argc == 3) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
std::string arg1;
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
double arg2 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::LabelTTF* ret = cocos2d::LabelTTF::create(arg0, arg1, arg2);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::LabelTTF>(cx, (cocos2d::LabelTTF*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
do {
|
|
if (argc == 4) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
std::string arg1;
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
double arg2 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Size arg3;
|
|
ok &= jsval_to_ccsize(cx, args.get(3), &arg3);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::LabelTTF* ret = cocos2d::LabelTTF::create(arg0, arg1, arg2, arg3);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::LabelTTF>(cx, (cocos2d::LabelTTF*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
do {
|
|
if (argc == 5) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
std::string arg1;
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
double arg2 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Size arg3;
|
|
ok &= jsval_to_ccsize(cx, args.get(3), &arg3);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::TextHAlignment arg4;
|
|
ok &= jsval_to_int32(cx, args.get(4), (int32_t *)&arg4);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::LabelTTF* ret = cocos2d::LabelTTF::create(arg0, arg1, arg2, arg3, arg4);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::LabelTTF>(cx, (cocos2d::LabelTTF*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
do {
|
|
if (argc == 6) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
std::string arg1;
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
double arg2 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Size arg3;
|
|
ok &= jsval_to_ccsize(cx, args.get(3), &arg3);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::TextHAlignment arg4;
|
|
ok &= jsval_to_int32(cx, args.get(4), (int32_t *)&arg4);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::TextVAlignment arg5;
|
|
ok &= jsval_to_int32(cx, args.get(5), (int32_t *)&arg5);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::LabelTTF* ret = cocos2d::LabelTTF::create(arg0, arg1, arg2, arg3, arg4, arg5);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::LabelTTF>(cx, (cocos2d::LabelTTF*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
JS_ReportError(cx, "js_cocos2dx_LabelTTF_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_LabelTTF_createWithFontDefinition(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 2) {
|
|
std::string arg0;
|
|
cocos2d::FontDefinition arg1;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
ok &= jsval_to_FontDefinition(cx, args.get(1), &arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_LabelTTF_createWithFontDefinition : Error processing arguments");
|
|
|
|
auto ret = cocos2d::LabelTTF::createWithFontDefinition(arg0, arg1);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::LabelTTF>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::LabelTTF"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_LabelTTF_createWithFontDefinition : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_LabelTTF_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::LabelTTF* cobj = new (std::nothrow) cocos2d::LabelTTF();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::LabelTTF>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::LabelTTF"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_LabelTTF_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::LabelTTF *nobj = new (std::nothrow) cocos2d::LabelTTF();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::LabelTTF");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_Node_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_LabelTTF(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_LabelTTF_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_LabelTTF_class->name = "LabelTTF";
|
|
jsb_cocos2d_LabelTTF_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_LabelTTF_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_LabelTTF_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_LabelTTF_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_LabelTTF_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_LabelTTF_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_LabelTTF_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_LabelTTF_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("enableShadow", js_cocos2dx_LabelTTF_enableShadow, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setDimensions", js_cocos2dx_LabelTTF_setDimensions, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getFontSize", js_cocos2dx_LabelTTF_getFontSize, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getString", js_cocos2dx_LabelTTF_getString, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setFlippedY", js_cocos2dx_LabelTTF_setFlippedY, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setFlippedX", js_cocos2dx_LabelTTF_setFlippedX, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setTextDefinition", js_cocos2dx_LabelTTF_setTextDefinition, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setFontName", js_cocos2dx_LabelTTF_setFontName, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getHorizontalAlignment", js_cocos2dx_LabelTTF_getHorizontalAlignment, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initWithStringAndTextDefinition", js_cocos2dx_LabelTTF_initWithStringAndTextDefinition, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setString", js_cocos2dx_LabelTTF_setString, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initWithString", js_cocos2dx_LabelTTF_initWithString, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setFontFillColor", js_cocos2dx_LabelTTF_setFontFillColor, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getBlendFunc", js_cocos2dx_LabelTTF_getBlendFunc, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("enableStroke", js_cocos2dx_LabelTTF_enableStroke, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getDimensions", js_cocos2dx_LabelTTF_getDimensions, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setVerticalAlignment", js_cocos2dx_LabelTTF_setVerticalAlignment, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setFontSize", js_cocos2dx_LabelTTF_setFontSize, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getVerticalAlignment", js_cocos2dx_LabelTTF_getVerticalAlignment, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getTextDefinition", js_cocos2dx_LabelTTF_getTextDefinition, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setBlendFunc", js_cocos2dx_LabelTTF_setBlendFunc, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getFontName", js_cocos2dx_LabelTTF_getFontName, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setHorizontalAlignment", js_cocos2dx_LabelTTF_setHorizontalAlignment, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("disableShadow", js_cocos2dx_LabelTTF_disableShadow, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("disableStroke", js_cocos2dx_LabelTTF_disableStroke, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_LabelTTF_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_LabelTTF_create, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("createWithFontDefinition", js_cocos2dx_LabelTTF_createWithFontDefinition, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_Node_prototype);
|
|
jsb_cocos2d_LabelTTF_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_LabelTTF_class,
|
|
js_cocos2dx_LabelTTF_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_LabelTTF_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "LabelTTF"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::LabelTTF>(cx, jsb_cocos2d_LabelTTF_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.LabelTTF.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_Layer_class;
|
|
JSObject *jsb_cocos2d_Layer_prototype;
|
|
|
|
bool js_cocos2dx_Layer_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
if (argc == 0) {
|
|
|
|
auto ret = cocos2d::Layer::create();
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::Layer>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::Layer"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_Layer_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_Layer_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::Layer* cobj = new (std::nothrow) cocos2d::Layer();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::Layer>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::Layer"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_Layer_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::Layer *nobj = new (std::nothrow) cocos2d::Layer();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::Layer");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_Node_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_Layer(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_Layer_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_Layer_class->name = "Layer";
|
|
jsb_cocos2d_Layer_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Layer_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_Layer_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Layer_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_Layer_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_Layer_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_Layer_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_Layer_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("ctor", js_cocos2dx_Layer_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_Layer_create, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_Node_prototype);
|
|
jsb_cocos2d_Layer_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_Layer_class,
|
|
js_cocos2dx_Layer_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_Layer_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "Layer"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::Layer>(cx, jsb_cocos2d_Layer_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.Layer.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d___LayerRGBA_class;
|
|
JSObject *jsb_cocos2d___LayerRGBA_prototype;
|
|
|
|
bool js_cocos2dx___LayerRGBA_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
if (argc == 0) {
|
|
|
|
auto ret = cocos2d::__LayerRGBA::create();
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::__LayerRGBA>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::__LayerRGBA"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx___LayerRGBA_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx___LayerRGBA_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::__LayerRGBA* cobj = new (std::nothrow) cocos2d::__LayerRGBA();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::__LayerRGBA>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::__LayerRGBA"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_Layer_prototype;
|
|
|
|
void js_register_cocos2dx___LayerRGBA(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d___LayerRGBA_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d___LayerRGBA_class->name = "__LayerRGBA";
|
|
jsb_cocos2d___LayerRGBA_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d___LayerRGBA_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d___LayerRGBA_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d___LayerRGBA_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d___LayerRGBA_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d___LayerRGBA_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d___LayerRGBA_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d___LayerRGBA_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx___LayerRGBA_create, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_Layer_prototype);
|
|
jsb_cocos2d___LayerRGBA_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d___LayerRGBA_class,
|
|
js_cocos2dx___LayerRGBA_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d___LayerRGBA_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "__LayerRGBA"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::__LayerRGBA>(cx, jsb_cocos2d___LayerRGBA_class, proto, parent_proto);
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_LayerColor_class;
|
|
JSObject *jsb_cocos2d_LayerColor_prototype;
|
|
|
|
bool js_cocos2dx_LayerColor_changeWidthAndHeight(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::LayerColor* cobj = (cocos2d::LayerColor *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_LayerColor_changeWidthAndHeight : Invalid Native Object");
|
|
if (argc == 2) {
|
|
double arg0 = 0;
|
|
double arg1 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_LayerColor_changeWidthAndHeight : Error processing arguments");
|
|
cobj->changeWidthAndHeight(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_LayerColor_changeWidthAndHeight : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_LayerColor_getBlendFunc(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::LayerColor* cobj = (cocos2d::LayerColor *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_LayerColor_getBlendFunc : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const cocos2d::BlendFunc& ret = cobj->getBlendFunc();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = blendfunc_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_LayerColor_getBlendFunc : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_LayerColor_setBlendFunc(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::LayerColor* cobj = (cocos2d::LayerColor *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_LayerColor_setBlendFunc : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::BlendFunc arg0;
|
|
ok &= jsval_to_blendfunc(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_LayerColor_setBlendFunc : Error processing arguments");
|
|
cobj->setBlendFunc(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_LayerColor_setBlendFunc : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_LayerColor_changeWidth(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::LayerColor* cobj = (cocos2d::LayerColor *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_LayerColor_changeWidth : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_LayerColor_changeWidth : Error processing arguments");
|
|
cobj->changeWidth(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_LayerColor_changeWidth : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_LayerColor_initWithColor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::LayerColor* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::LayerColor *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_LayerColor_initWithColor : Invalid Native Object");
|
|
do {
|
|
if (argc == 1) {
|
|
cocos2d::Color4B arg0;
|
|
ok &= jsval_to_cccolor4b(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
bool ret = cobj->initWithColor(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 3) {
|
|
cocos2d::Color4B arg0;
|
|
ok &= jsval_to_cccolor4b(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
double arg1 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
if (!ok) { ok = true; break; }
|
|
double arg2 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
if (!ok) { ok = true; break; }
|
|
bool ret = cobj->initWithColor(arg0, arg1, arg2);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_LayerColor_initWithColor : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_LayerColor_changeHeight(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::LayerColor* cobj = (cocos2d::LayerColor *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_LayerColor_changeHeight : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_LayerColor_changeHeight : Error processing arguments");
|
|
cobj->changeHeight(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_LayerColor_changeHeight : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_LayerColor_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
|
|
do {
|
|
if (argc == 3) {
|
|
cocos2d::Color4B arg0;
|
|
ok &= jsval_to_cccolor4b(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
double arg1 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
if (!ok) { ok = true; break; }
|
|
double arg2 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::LayerColor* ret = cocos2d::LayerColor::create(arg0, arg1, arg2);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::LayerColor>(cx, (cocos2d::LayerColor*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
|
|
do {
|
|
if (argc == 0) {
|
|
cocos2d::LayerColor* ret = cocos2d::LayerColor::create();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::LayerColor>(cx, (cocos2d::LayerColor*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
|
|
do {
|
|
if (argc == 1) {
|
|
cocos2d::Color4B arg0;
|
|
ok &= jsval_to_cccolor4b(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::LayerColor* ret = cocos2d::LayerColor::create(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::LayerColor>(cx, (cocos2d::LayerColor*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
JS_ReportError(cx, "js_cocos2dx_LayerColor_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_LayerColor_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::LayerColor* cobj = new (std::nothrow) cocos2d::LayerColor();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::LayerColor>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::LayerColor"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_LayerColor_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::LayerColor *nobj = new (std::nothrow) cocos2d::LayerColor();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::LayerColor");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_Layer_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_LayerColor(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_LayerColor_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_LayerColor_class->name = "LayerColor";
|
|
jsb_cocos2d_LayerColor_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_LayerColor_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_LayerColor_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_LayerColor_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_LayerColor_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_LayerColor_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_LayerColor_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_LayerColor_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("changeWidthAndHeight", js_cocos2dx_LayerColor_changeWidthAndHeight, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getBlendFunc", js_cocos2dx_LayerColor_getBlendFunc, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setBlendFunc", js_cocos2dx_LayerColor_setBlendFunc, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("changeWidth", js_cocos2dx_LayerColor_changeWidth, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("init", js_cocos2dx_LayerColor_initWithColor, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("changeHeight", js_cocos2dx_LayerColor_changeHeight, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_LayerColor_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_LayerColor_create, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_Layer_prototype);
|
|
jsb_cocos2d_LayerColor_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_LayerColor_class,
|
|
js_cocos2dx_LayerColor_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_LayerColor_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "LayerColor"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::LayerColor>(cx, jsb_cocos2d_LayerColor_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.LayerColor.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_LayerGradient_class;
|
|
JSObject *jsb_cocos2d_LayerGradient_prototype;
|
|
|
|
bool js_cocos2dx_LayerGradient_getStartColor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::LayerGradient* cobj = (cocos2d::LayerGradient *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_LayerGradient_getStartColor : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const cocos2d::Color3B& ret = cobj->getStartColor();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = cccolor3b_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_LayerGradient_getStartColor : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_LayerGradient_isCompressedInterpolation(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::LayerGradient* cobj = (cocos2d::LayerGradient *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_LayerGradient_isCompressedInterpolation : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->isCompressedInterpolation();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_LayerGradient_isCompressedInterpolation : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_LayerGradient_getStartOpacity(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::LayerGradient* cobj = (cocos2d::LayerGradient *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_LayerGradient_getStartOpacity : Invalid Native Object");
|
|
if (argc == 0) {
|
|
uint16_t ret = cobj->getStartOpacity();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = uint32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_LayerGradient_getStartOpacity : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_LayerGradient_setVector(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::LayerGradient* cobj = (cocos2d::LayerGradient *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_LayerGradient_setVector : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Vec2 arg0;
|
|
ok &= jsval_to_vector2(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_LayerGradient_setVector : Error processing arguments");
|
|
cobj->setVector(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_LayerGradient_setVector : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_LayerGradient_setStartOpacity(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::LayerGradient* cobj = (cocos2d::LayerGradient *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_LayerGradient_setStartOpacity : Invalid Native Object");
|
|
if (argc == 1) {
|
|
uint16_t arg0;
|
|
ok &= jsval_to_uint16(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_LayerGradient_setStartOpacity : Error processing arguments");
|
|
cobj->setStartOpacity(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_LayerGradient_setStartOpacity : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_LayerGradient_setCompressedInterpolation(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::LayerGradient* cobj = (cocos2d::LayerGradient *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_LayerGradient_setCompressedInterpolation : Invalid Native Object");
|
|
if (argc == 1) {
|
|
bool arg0;
|
|
arg0 = JS::ToBoolean(args.get(0));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_LayerGradient_setCompressedInterpolation : Error processing arguments");
|
|
cobj->setCompressedInterpolation(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_LayerGradient_setCompressedInterpolation : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_LayerGradient_setEndOpacity(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::LayerGradient* cobj = (cocos2d::LayerGradient *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_LayerGradient_setEndOpacity : Invalid Native Object");
|
|
if (argc == 1) {
|
|
uint16_t arg0;
|
|
ok &= jsval_to_uint16(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_LayerGradient_setEndOpacity : Error processing arguments");
|
|
cobj->setEndOpacity(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_LayerGradient_setEndOpacity : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_LayerGradient_getVector(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::LayerGradient* cobj = (cocos2d::LayerGradient *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_LayerGradient_getVector : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const cocos2d::Vec2& ret = cobj->getVector();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = vector2_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_LayerGradient_getVector : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_LayerGradient_setEndColor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::LayerGradient* cobj = (cocos2d::LayerGradient *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_LayerGradient_setEndColor : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Color3B arg0;
|
|
ok &= jsval_to_cccolor3b(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_LayerGradient_setEndColor : Error processing arguments");
|
|
cobj->setEndColor(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_LayerGradient_setEndColor : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_LayerGradient_initWithColor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::LayerGradient* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::LayerGradient *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_LayerGradient_initWithColor : Invalid Native Object");
|
|
do {
|
|
if (argc == 3) {
|
|
cocos2d::Color4B arg0;
|
|
ok &= jsval_to_cccolor4b(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Color4B arg1;
|
|
ok &= jsval_to_cccolor4b(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Vec2 arg2;
|
|
ok &= jsval_to_vector2(cx, args.get(2), &arg2);
|
|
if (!ok) { ok = true; break; }
|
|
bool ret = cobj->initWithColor(arg0, arg1, arg2);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 2) {
|
|
cocos2d::Color4B arg0;
|
|
ok &= jsval_to_cccolor4b(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Color4B arg1;
|
|
ok &= jsval_to_cccolor4b(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
bool ret = cobj->initWithColor(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_LayerGradient_initWithColor : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_LayerGradient_getEndColor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::LayerGradient* cobj = (cocos2d::LayerGradient *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_LayerGradient_getEndColor : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const cocos2d::Color3B& ret = cobj->getEndColor();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = cccolor3b_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_LayerGradient_getEndColor : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_LayerGradient_getEndOpacity(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::LayerGradient* cobj = (cocos2d::LayerGradient *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_LayerGradient_getEndOpacity : Invalid Native Object");
|
|
if (argc == 0) {
|
|
uint16_t ret = cobj->getEndOpacity();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = uint32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_LayerGradient_getEndOpacity : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_LayerGradient_setStartColor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::LayerGradient* cobj = (cocos2d::LayerGradient *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_LayerGradient_setStartColor : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Color3B arg0;
|
|
ok &= jsval_to_cccolor3b(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_LayerGradient_setStartColor : Error processing arguments");
|
|
cobj->setStartColor(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_LayerGradient_setStartColor : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_LayerGradient_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
|
|
do {
|
|
if (argc == 2) {
|
|
cocos2d::Color4B arg0;
|
|
ok &= jsval_to_cccolor4b(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Color4B arg1;
|
|
ok &= jsval_to_cccolor4b(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::LayerGradient* ret = cocos2d::LayerGradient::create(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::LayerGradient>(cx, (cocos2d::LayerGradient*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
|
|
do {
|
|
if (argc == 0) {
|
|
cocos2d::LayerGradient* ret = cocos2d::LayerGradient::create();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::LayerGradient>(cx, (cocos2d::LayerGradient*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
|
|
do {
|
|
if (argc == 3) {
|
|
cocos2d::Color4B arg0;
|
|
ok &= jsval_to_cccolor4b(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Color4B arg1;
|
|
ok &= jsval_to_cccolor4b(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Vec2 arg2;
|
|
ok &= jsval_to_vector2(cx, args.get(2), &arg2);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::LayerGradient* ret = cocos2d::LayerGradient::create(arg0, arg1, arg2);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::LayerGradient>(cx, (cocos2d::LayerGradient*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
JS_ReportError(cx, "js_cocos2dx_LayerGradient_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_LayerGradient_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::LayerGradient* cobj = new (std::nothrow) cocos2d::LayerGradient();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::LayerGradient>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::LayerGradient"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_LayerGradient_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::LayerGradient *nobj = new (std::nothrow) cocos2d::LayerGradient();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::LayerGradient");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_LayerColor_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_LayerGradient(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_LayerGradient_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_LayerGradient_class->name = "LayerGradient";
|
|
jsb_cocos2d_LayerGradient_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_LayerGradient_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_LayerGradient_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_LayerGradient_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_LayerGradient_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_LayerGradient_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_LayerGradient_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_LayerGradient_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("getStartColor", js_cocos2dx_LayerGradient_getStartColor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("isCompressedInterpolation", js_cocos2dx_LayerGradient_isCompressedInterpolation, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getStartOpacity", js_cocos2dx_LayerGradient_getStartOpacity, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setVector", js_cocos2dx_LayerGradient_setVector, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setStartOpacity", js_cocos2dx_LayerGradient_setStartOpacity, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setCompressedInterpolation", js_cocos2dx_LayerGradient_setCompressedInterpolation, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setEndOpacity", js_cocos2dx_LayerGradient_setEndOpacity, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getVector", js_cocos2dx_LayerGradient_getVector, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setEndColor", js_cocos2dx_LayerGradient_setEndColor, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initWithColor", js_cocos2dx_LayerGradient_initWithColor, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getEndColor", js_cocos2dx_LayerGradient_getEndColor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getEndOpacity", js_cocos2dx_LayerGradient_getEndOpacity, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setStartColor", js_cocos2dx_LayerGradient_setStartColor, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_LayerGradient_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_LayerGradient_create, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_LayerColor_prototype);
|
|
jsb_cocos2d_LayerGradient_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_LayerGradient_class,
|
|
js_cocos2dx_LayerGradient_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_LayerGradient_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "LayerGradient"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::LayerGradient>(cx, jsb_cocos2d_LayerGradient_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.LayerGradient.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_LayerMultiplex_class;
|
|
JSObject *jsb_cocos2d_LayerMultiplex_prototype;
|
|
|
|
bool js_cocos2dx_LayerMultiplex_initWithArray(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::LayerMultiplex* cobj = (cocos2d::LayerMultiplex *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_LayerMultiplex_initWithArray : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Vector<cocos2d::Layer *> arg0;
|
|
ok &= jsval_to_ccvector(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_LayerMultiplex_initWithArray : Error processing arguments");
|
|
bool ret = cobj->initWithArray(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_LayerMultiplex_initWithArray : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_LayerMultiplex_switchToAndReleaseMe(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::LayerMultiplex* cobj = (cocos2d::LayerMultiplex *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_LayerMultiplex_switchToAndReleaseMe : Invalid Native Object");
|
|
if (argc == 1) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_LayerMultiplex_switchToAndReleaseMe : Error processing arguments");
|
|
cobj->switchToAndReleaseMe(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_LayerMultiplex_switchToAndReleaseMe : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_LayerMultiplex_addLayer(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::LayerMultiplex* cobj = (cocos2d::LayerMultiplex *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_LayerMultiplex_addLayer : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Layer* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Layer*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_LayerMultiplex_addLayer : Error processing arguments");
|
|
cobj->addLayer(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_LayerMultiplex_addLayer : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_LayerMultiplex_switchTo(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::LayerMultiplex* cobj = (cocos2d::LayerMultiplex *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_LayerMultiplex_switchTo : Invalid Native Object");
|
|
if (argc == 1) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_LayerMultiplex_switchTo : Error processing arguments");
|
|
cobj->switchTo(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_LayerMultiplex_switchTo : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_LayerMultiplex_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::LayerMultiplex* cobj = new (std::nothrow) cocos2d::LayerMultiplex();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::LayerMultiplex>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::LayerMultiplex"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_LayerMultiplex_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::LayerMultiplex *nobj = new (std::nothrow) cocos2d::LayerMultiplex();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::LayerMultiplex");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_Layer_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_LayerMultiplex(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_LayerMultiplex_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_LayerMultiplex_class->name = "LayerMultiplex";
|
|
jsb_cocos2d_LayerMultiplex_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_LayerMultiplex_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_LayerMultiplex_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_LayerMultiplex_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_LayerMultiplex_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_LayerMultiplex_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_LayerMultiplex_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_LayerMultiplex_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("initWithArray", js_cocos2dx_LayerMultiplex_initWithArray, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("switchToAndReleaseMe", js_cocos2dx_LayerMultiplex_switchToAndReleaseMe, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("addLayer", js_cocos2dx_LayerMultiplex_addLayer, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("switchTo", js_cocos2dx_LayerMultiplex_switchTo, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_LayerMultiplex_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JSFunctionSpec *st_funcs = NULL;
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_Layer_prototype);
|
|
jsb_cocos2d_LayerMultiplex_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_LayerMultiplex_class,
|
|
js_cocos2dx_LayerMultiplex_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_LayerMultiplex_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "LayerMultiplex"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::LayerMultiplex>(cx, jsb_cocos2d_LayerMultiplex_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.LayerMultiplex.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_MenuItem_class;
|
|
JSObject *jsb_cocos2d_MenuItem_prototype;
|
|
|
|
bool js_cocos2dx_MenuItem_setEnabled(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::MenuItem* cobj = (cocos2d::MenuItem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_MenuItem_setEnabled : Invalid Native Object");
|
|
if (argc == 1) {
|
|
bool arg0;
|
|
arg0 = JS::ToBoolean(args.get(0));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_MenuItem_setEnabled : Error processing arguments");
|
|
cobj->setEnabled(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_MenuItem_setEnabled : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_MenuItem_activate(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::MenuItem* cobj = (cocos2d::MenuItem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_MenuItem_activate : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->activate();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_MenuItem_activate : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_MenuItem_initWithCallback(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::MenuItem* cobj = (cocos2d::MenuItem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_MenuItem_initWithCallback : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::function<void (cocos2d::Ref *)> arg0;
|
|
do {
|
|
if(JS_TypeOfValue(cx, args.get(0)) == JSTYPE_FUNCTION)
|
|
{
|
|
JS::RootedObject jstarget(cx, args.thisv().toObjectOrNull());
|
|
std::shared_ptr<JSFunctionWrapper> func(new JSFunctionWrapper(cx, jstarget, args.get(0), args.thisv()));
|
|
auto lambda = [=](cocos2d::Ref* larg0) -> void {
|
|
JSB_AUTOCOMPARTMENT_WITH_GLOBAL_OBJCET
|
|
jsval largv[1];
|
|
if (larg0) {
|
|
largv[0] = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Ref>(cx, (cocos2d::Ref*)larg0));
|
|
} else {
|
|
largv[0] = JSVAL_NULL;
|
|
};
|
|
JS::RootedValue rval(cx);
|
|
bool succeed = func->invoke(1, &largv[0], &rval);
|
|
if (!succeed && JS_IsExceptionPending(cx)) {
|
|
JS_ReportPendingException(cx);
|
|
}
|
|
};
|
|
arg0 = lambda;
|
|
}
|
|
else
|
|
{
|
|
arg0 = nullptr;
|
|
}
|
|
} while(0)
|
|
;
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_MenuItem_initWithCallback : Error processing arguments");
|
|
bool ret = cobj->initWithCallback(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_MenuItem_initWithCallback : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_MenuItem_isEnabled(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::MenuItem* cobj = (cocos2d::MenuItem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_MenuItem_isEnabled : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->isEnabled();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_MenuItem_isEnabled : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_MenuItem_selected(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::MenuItem* cobj = (cocos2d::MenuItem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_MenuItem_selected : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->selected();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_MenuItem_selected : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_MenuItem_isSelected(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::MenuItem* cobj = (cocos2d::MenuItem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_MenuItem_isSelected : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->isSelected();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_MenuItem_isSelected : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_MenuItem_setCallback(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::MenuItem* cobj = (cocos2d::MenuItem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_MenuItem_setCallback : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::function<void (cocos2d::Ref *)> arg0;
|
|
do {
|
|
if(JS_TypeOfValue(cx, args.get(0)) == JSTYPE_FUNCTION)
|
|
{
|
|
JS::RootedObject jstarget(cx, args.thisv().toObjectOrNull());
|
|
std::shared_ptr<JSFunctionWrapper> func(new JSFunctionWrapper(cx, jstarget, args.get(0), args.thisv()));
|
|
auto lambda = [=](cocos2d::Ref* larg0) -> void {
|
|
JSB_AUTOCOMPARTMENT_WITH_GLOBAL_OBJCET
|
|
jsval largv[1];
|
|
if (larg0) {
|
|
largv[0] = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Ref>(cx, (cocos2d::Ref*)larg0));
|
|
} else {
|
|
largv[0] = JSVAL_NULL;
|
|
};
|
|
JS::RootedValue rval(cx);
|
|
bool succeed = func->invoke(1, &largv[0], &rval);
|
|
if (!succeed && JS_IsExceptionPending(cx)) {
|
|
JS_ReportPendingException(cx);
|
|
}
|
|
};
|
|
arg0 = lambda;
|
|
}
|
|
else
|
|
{
|
|
arg0 = nullptr;
|
|
}
|
|
} while(0)
|
|
;
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_MenuItem_setCallback : Error processing arguments");
|
|
cobj->setCallback(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_MenuItem_setCallback : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_MenuItem_unselected(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::MenuItem* cobj = (cocos2d::MenuItem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_MenuItem_unselected : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->unselected();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_MenuItem_unselected : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_MenuItem_rect(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::MenuItem* cobj = (cocos2d::MenuItem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_MenuItem_rect : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::Rect ret = cobj->rect();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ccrect_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_MenuItem_rect : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_MenuItem_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::MenuItem* cobj = new (std::nothrow) cocos2d::MenuItem();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::MenuItem>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::MenuItem"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_MenuItem_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::MenuItem *nobj = new (std::nothrow) cocos2d::MenuItem();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::MenuItem");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_Node_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_MenuItem(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_MenuItem_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_MenuItem_class->name = "MenuItem";
|
|
jsb_cocos2d_MenuItem_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_MenuItem_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_MenuItem_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_MenuItem_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_MenuItem_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_MenuItem_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_MenuItem_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_MenuItem_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("setEnabled", js_cocos2dx_MenuItem_setEnabled, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("activate", js_cocos2dx_MenuItem_activate, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initWithCallback", js_cocos2dx_MenuItem_initWithCallback, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("isEnabled", js_cocos2dx_MenuItem_isEnabled, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("selected", js_cocos2dx_MenuItem_selected, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("isSelected", js_cocos2dx_MenuItem_isSelected, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setCallback", js_cocos2dx_MenuItem_setCallback, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("unselected", js_cocos2dx_MenuItem_unselected, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("rect", js_cocos2dx_MenuItem_rect, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_MenuItem_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JSFunctionSpec *st_funcs = NULL;
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_Node_prototype);
|
|
jsb_cocos2d_MenuItem_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_MenuItem_class,
|
|
js_cocos2dx_MenuItem_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_MenuItem_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "MenuItem"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::MenuItem>(cx, jsb_cocos2d_MenuItem_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.MenuItem.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_MenuItemLabel_class;
|
|
JSObject *jsb_cocos2d_MenuItemLabel_prototype;
|
|
|
|
bool js_cocos2dx_MenuItemLabel_setLabel(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::MenuItemLabel* cobj = (cocos2d::MenuItemLabel *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_MenuItemLabel_setLabel : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Node* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_MenuItemLabel_setLabel : Error processing arguments");
|
|
cobj->setLabel(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_MenuItemLabel_setLabel : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_MenuItemLabel_getString(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::MenuItemLabel* cobj = (cocos2d::MenuItemLabel *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_MenuItemLabel_getString : Invalid Native Object");
|
|
if (argc == 0) {
|
|
std::string ret = cobj->getString();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = std_string_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_MenuItemLabel_getString : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_MenuItemLabel_getDisabledColor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::MenuItemLabel* cobj = (cocos2d::MenuItemLabel *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_MenuItemLabel_getDisabledColor : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const cocos2d::Color3B& ret = cobj->getDisabledColor();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = cccolor3b_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_MenuItemLabel_getDisabledColor : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_MenuItemLabel_setString(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::MenuItemLabel* cobj = (cocos2d::MenuItemLabel *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_MenuItemLabel_setString : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_MenuItemLabel_setString : Error processing arguments");
|
|
cobj->setString(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_MenuItemLabel_setString : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_MenuItemLabel_initWithLabel(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::MenuItemLabel* cobj = (cocos2d::MenuItemLabel *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_MenuItemLabel_initWithLabel : Invalid Native Object");
|
|
if (argc == 2) {
|
|
cocos2d::Node* arg0 = nullptr;
|
|
std::function<void (cocos2d::Ref *)> arg1;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
do {
|
|
if(JS_TypeOfValue(cx, args.get(1)) == JSTYPE_FUNCTION)
|
|
{
|
|
JS::RootedObject jstarget(cx, args.thisv().toObjectOrNull());
|
|
std::shared_ptr<JSFunctionWrapper> func(new JSFunctionWrapper(cx, jstarget, args.get(1), args.thisv()));
|
|
auto lambda = [=](cocos2d::Ref* larg0) -> void {
|
|
JSB_AUTOCOMPARTMENT_WITH_GLOBAL_OBJCET
|
|
jsval largv[1];
|
|
if (larg0) {
|
|
largv[0] = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Ref>(cx, (cocos2d::Ref*)larg0));
|
|
} else {
|
|
largv[0] = JSVAL_NULL;
|
|
};
|
|
JS::RootedValue rval(cx);
|
|
bool succeed = func->invoke(1, &largv[0], &rval);
|
|
if (!succeed && JS_IsExceptionPending(cx)) {
|
|
JS_ReportPendingException(cx);
|
|
}
|
|
};
|
|
arg1 = lambda;
|
|
}
|
|
else
|
|
{
|
|
arg1 = nullptr;
|
|
}
|
|
} while(0)
|
|
;
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_MenuItemLabel_initWithLabel : Error processing arguments");
|
|
bool ret = cobj->initWithLabel(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_MenuItemLabel_initWithLabel : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_MenuItemLabel_setDisabledColor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::MenuItemLabel* cobj = (cocos2d::MenuItemLabel *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_MenuItemLabel_setDisabledColor : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Color3B arg0;
|
|
ok &= jsval_to_cccolor3b(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_MenuItemLabel_setDisabledColor : Error processing arguments");
|
|
cobj->setDisabledColor(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_MenuItemLabel_setDisabledColor : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_MenuItemLabel_getLabel(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::MenuItemLabel* cobj = (cocos2d::MenuItemLabel *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_MenuItemLabel_getLabel : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::Node* ret = cobj->getLabel();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Node>(cx, (cocos2d::Node*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_MenuItemLabel_getLabel : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_MenuItemLabel_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::MenuItemLabel* cobj = new (std::nothrow) cocos2d::MenuItemLabel();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::MenuItemLabel>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::MenuItemLabel"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_MenuItemLabel_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::MenuItemLabel *nobj = new (std::nothrow) cocos2d::MenuItemLabel();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::MenuItemLabel");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_MenuItem_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_MenuItemLabel(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_MenuItemLabel_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_MenuItemLabel_class->name = "MenuItemLabel";
|
|
jsb_cocos2d_MenuItemLabel_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_MenuItemLabel_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_MenuItemLabel_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_MenuItemLabel_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_MenuItemLabel_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_MenuItemLabel_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_MenuItemLabel_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_MenuItemLabel_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("setLabel", js_cocos2dx_MenuItemLabel_setLabel, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getString", js_cocos2dx_MenuItemLabel_getString, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getDisabledColor", js_cocos2dx_MenuItemLabel_getDisabledColor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setString", js_cocos2dx_MenuItemLabel_setString, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initWithLabel", js_cocos2dx_MenuItemLabel_initWithLabel, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setDisabledColor", js_cocos2dx_MenuItemLabel_setDisabledColor, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getLabel", js_cocos2dx_MenuItemLabel_getLabel, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_MenuItemLabel_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JSFunctionSpec *st_funcs = NULL;
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_MenuItem_prototype);
|
|
jsb_cocos2d_MenuItemLabel_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_MenuItemLabel_class,
|
|
js_cocos2dx_MenuItemLabel_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_MenuItemLabel_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "MenuItemLabel"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::MenuItemLabel>(cx, jsb_cocos2d_MenuItemLabel_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.MenuItemLabel.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_MenuItemAtlasFont_class;
|
|
JSObject *jsb_cocos2d_MenuItemAtlasFont_prototype;
|
|
|
|
bool js_cocos2dx_MenuItemAtlasFont_initWithString(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::MenuItemAtlasFont* cobj = (cocos2d::MenuItemAtlasFont *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_MenuItemAtlasFont_initWithString : Invalid Native Object");
|
|
if (argc == 6) {
|
|
std::string arg0;
|
|
std::string arg1;
|
|
int arg2 = 0;
|
|
int arg3 = 0;
|
|
int32_t arg4;
|
|
std::function<void (cocos2d::Ref *)> arg5;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
|
ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2);
|
|
ok &= jsval_to_int32(cx, args.get(3), (int32_t *)&arg3);
|
|
ok &= jsval_to_int32(cx, args.get(4), &arg4);
|
|
do {
|
|
if(JS_TypeOfValue(cx, args.get(5)) == JSTYPE_FUNCTION)
|
|
{
|
|
JS::RootedObject jstarget(cx, args.thisv().toObjectOrNull());
|
|
std::shared_ptr<JSFunctionWrapper> func(new JSFunctionWrapper(cx, jstarget, args.get(5), args.thisv()));
|
|
auto lambda = [=](cocos2d::Ref* larg0) -> void {
|
|
JSB_AUTOCOMPARTMENT_WITH_GLOBAL_OBJCET
|
|
jsval largv[1];
|
|
if (larg0) {
|
|
largv[0] = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Ref>(cx, (cocos2d::Ref*)larg0));
|
|
} else {
|
|
largv[0] = JSVAL_NULL;
|
|
};
|
|
JS::RootedValue rval(cx);
|
|
bool succeed = func->invoke(1, &largv[0], &rval);
|
|
if (!succeed && JS_IsExceptionPending(cx)) {
|
|
JS_ReportPendingException(cx);
|
|
}
|
|
};
|
|
arg5 = lambda;
|
|
}
|
|
else
|
|
{
|
|
arg5 = nullptr;
|
|
}
|
|
} while(0)
|
|
;
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_MenuItemAtlasFont_initWithString : Error processing arguments");
|
|
bool ret = cobj->initWithString(arg0, arg1, arg2, arg3, arg4, arg5);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_MenuItemAtlasFont_initWithString : wrong number of arguments: %d, was expecting %d", argc, 6);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_MenuItemAtlasFont_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::MenuItemAtlasFont* cobj = new (std::nothrow) cocos2d::MenuItemAtlasFont();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::MenuItemAtlasFont>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::MenuItemAtlasFont"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_MenuItemAtlasFont_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::MenuItemAtlasFont *nobj = new (std::nothrow) cocos2d::MenuItemAtlasFont();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::MenuItemAtlasFont");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_MenuItemLabel_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_MenuItemAtlasFont(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_MenuItemAtlasFont_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_MenuItemAtlasFont_class->name = "MenuItemAtlasFont";
|
|
jsb_cocos2d_MenuItemAtlasFont_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_MenuItemAtlasFont_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_MenuItemAtlasFont_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_MenuItemAtlasFont_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_MenuItemAtlasFont_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_MenuItemAtlasFont_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_MenuItemAtlasFont_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_MenuItemAtlasFont_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("initWithString", js_cocos2dx_MenuItemAtlasFont_initWithString, 6, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_MenuItemAtlasFont_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JSFunctionSpec *st_funcs = NULL;
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_MenuItemLabel_prototype);
|
|
jsb_cocos2d_MenuItemAtlasFont_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_MenuItemAtlasFont_class,
|
|
js_cocos2dx_MenuItemAtlasFont_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_MenuItemAtlasFont_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "MenuItemAtlasFont"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::MenuItemAtlasFont>(cx, jsb_cocos2d_MenuItemAtlasFont_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.MenuItemAtlasFont.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_MenuItemFont_class;
|
|
JSObject *jsb_cocos2d_MenuItemFont_prototype;
|
|
|
|
bool js_cocos2dx_MenuItemFont_setFontNameObj(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::MenuItemFont* cobj = (cocos2d::MenuItemFont *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_MenuItemFont_setFontNameObj : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_MenuItemFont_setFontNameObj : Error processing arguments");
|
|
cobj->setFontNameObj(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_MenuItemFont_setFontNameObj : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_MenuItemFont_getFontSizeObj(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::MenuItemFont* cobj = (cocos2d::MenuItemFont *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_MenuItemFont_getFontSizeObj : Invalid Native Object");
|
|
if (argc == 0) {
|
|
int ret = cobj->getFontSizeObj();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = int32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_MenuItemFont_getFontSizeObj : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_MenuItemFont_setFontSizeObj(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::MenuItemFont* cobj = (cocos2d::MenuItemFont *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_MenuItemFont_setFontSizeObj : Invalid Native Object");
|
|
if (argc == 1) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_MenuItemFont_setFontSizeObj : Error processing arguments");
|
|
cobj->setFontSizeObj(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_MenuItemFont_setFontSizeObj : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_MenuItemFont_initWithString(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::MenuItemFont* cobj = (cocos2d::MenuItemFont *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_MenuItemFont_initWithString : Invalid Native Object");
|
|
if (argc == 2) {
|
|
std::string arg0;
|
|
std::function<void (cocos2d::Ref *)> arg1;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
do {
|
|
if(JS_TypeOfValue(cx, args.get(1)) == JSTYPE_FUNCTION)
|
|
{
|
|
JS::RootedObject jstarget(cx, args.thisv().toObjectOrNull());
|
|
std::shared_ptr<JSFunctionWrapper> func(new JSFunctionWrapper(cx, jstarget, args.get(1), args.thisv()));
|
|
auto lambda = [=](cocos2d::Ref* larg0) -> void {
|
|
JSB_AUTOCOMPARTMENT_WITH_GLOBAL_OBJCET
|
|
jsval largv[1];
|
|
if (larg0) {
|
|
largv[0] = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Ref>(cx, (cocos2d::Ref*)larg0));
|
|
} else {
|
|
largv[0] = JSVAL_NULL;
|
|
};
|
|
JS::RootedValue rval(cx);
|
|
bool succeed = func->invoke(1, &largv[0], &rval);
|
|
if (!succeed && JS_IsExceptionPending(cx)) {
|
|
JS_ReportPendingException(cx);
|
|
}
|
|
};
|
|
arg1 = lambda;
|
|
}
|
|
else
|
|
{
|
|
arg1 = nullptr;
|
|
}
|
|
} while(0)
|
|
;
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_MenuItemFont_initWithString : Error processing arguments");
|
|
bool ret = cobj->initWithString(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_MenuItemFont_initWithString : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_MenuItemFont_getFontNameObj(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::MenuItemFont* cobj = (cocos2d::MenuItemFont *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_MenuItemFont_getFontNameObj : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const std::string& ret = cobj->getFontNameObj();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = std_string_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_MenuItemFont_getFontNameObj : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_MenuItemFont_setFontName(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_MenuItemFont_setFontName : Error processing arguments");
|
|
cocos2d::MenuItemFont::setFontName(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_MenuItemFont_setFontName : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_MenuItemFont_getFontSize(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
if (argc == 0) {
|
|
|
|
int ret = cocos2d::MenuItemFont::getFontSize();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = int32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_MenuItemFont_getFontSize : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_MenuItemFont_getFontName(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
if (argc == 0) {
|
|
|
|
const std::string& ret = cocos2d::MenuItemFont::getFontName();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = std_string_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_MenuItemFont_getFontName : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_MenuItemFont_setFontSize(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_MenuItemFont_setFontSize : Error processing arguments");
|
|
cocos2d::MenuItemFont::setFontSize(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_MenuItemFont_setFontSize : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_MenuItemFont_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::MenuItemFont* cobj = new (std::nothrow) cocos2d::MenuItemFont();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::MenuItemFont>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::MenuItemFont"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_MenuItemFont_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::MenuItemFont *nobj = new (std::nothrow) cocos2d::MenuItemFont();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::MenuItemFont");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_MenuItemLabel_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_MenuItemFont(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_MenuItemFont_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_MenuItemFont_class->name = "MenuItemFont";
|
|
jsb_cocos2d_MenuItemFont_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_MenuItemFont_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_MenuItemFont_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_MenuItemFont_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_MenuItemFont_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_MenuItemFont_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_MenuItemFont_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_MenuItemFont_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("setFontName", js_cocos2dx_MenuItemFont_setFontNameObj, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getFontSize", js_cocos2dx_MenuItemFont_getFontSizeObj, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setFontSize", js_cocos2dx_MenuItemFont_setFontSizeObj, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initWithString", js_cocos2dx_MenuItemFont_initWithString, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getFontName", js_cocos2dx_MenuItemFont_getFontNameObj, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_MenuItemFont_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("setFontName", js_cocos2dx_MenuItemFont_setFontName, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getFontSize", js_cocos2dx_MenuItemFont_getFontSize, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getFontName", js_cocos2dx_MenuItemFont_getFontName, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setFontSize", js_cocos2dx_MenuItemFont_setFontSize, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_MenuItemLabel_prototype);
|
|
jsb_cocos2d_MenuItemFont_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_MenuItemFont_class,
|
|
js_cocos2dx_MenuItemFont_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_MenuItemFont_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "MenuItemFont"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::MenuItemFont>(cx, jsb_cocos2d_MenuItemFont_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.MenuItemFont.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_MenuItemSprite_class;
|
|
JSObject *jsb_cocos2d_MenuItemSprite_prototype;
|
|
|
|
bool js_cocos2dx_MenuItemSprite_setEnabled(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::MenuItemSprite* cobj = (cocos2d::MenuItemSprite *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_MenuItemSprite_setEnabled : Invalid Native Object");
|
|
if (argc == 1) {
|
|
bool arg0;
|
|
arg0 = JS::ToBoolean(args.get(0));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_MenuItemSprite_setEnabled : Error processing arguments");
|
|
cobj->setEnabled(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_MenuItemSprite_setEnabled : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_MenuItemSprite_selected(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::MenuItemSprite* cobj = (cocos2d::MenuItemSprite *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_MenuItemSprite_selected : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->selected();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_MenuItemSprite_selected : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_MenuItemSprite_setNormalImage(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::MenuItemSprite* cobj = (cocos2d::MenuItemSprite *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_MenuItemSprite_setNormalImage : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Node* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_MenuItemSprite_setNormalImage : Error processing arguments");
|
|
cobj->setNormalImage(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_MenuItemSprite_setNormalImage : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_MenuItemSprite_setDisabledImage(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::MenuItemSprite* cobj = (cocos2d::MenuItemSprite *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_MenuItemSprite_setDisabledImage : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Node* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_MenuItemSprite_setDisabledImage : Error processing arguments");
|
|
cobj->setDisabledImage(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_MenuItemSprite_setDisabledImage : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_MenuItemSprite_initWithNormalSprite(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::MenuItemSprite* cobj = (cocos2d::MenuItemSprite *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_MenuItemSprite_initWithNormalSprite : Invalid Native Object");
|
|
if (argc == 4) {
|
|
cocos2d::Node* arg0 = nullptr;
|
|
cocos2d::Node* arg1 = nullptr;
|
|
cocos2d::Node* arg2 = nullptr;
|
|
std::function<void (cocos2d::Ref *)> arg3;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
do {
|
|
if (args.get(2).isNull()) { arg2 = nullptr; break; }
|
|
if (!args.get(2).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(2).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg2 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg2, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
do {
|
|
if(JS_TypeOfValue(cx, args.get(3)) == JSTYPE_FUNCTION)
|
|
{
|
|
JS::RootedObject jstarget(cx, args.thisv().toObjectOrNull());
|
|
std::shared_ptr<JSFunctionWrapper> func(new JSFunctionWrapper(cx, jstarget, args.get(3), args.thisv()));
|
|
auto lambda = [=](cocos2d::Ref* larg0) -> void {
|
|
JSB_AUTOCOMPARTMENT_WITH_GLOBAL_OBJCET
|
|
jsval largv[1];
|
|
if (larg0) {
|
|
largv[0] = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Ref>(cx, (cocos2d::Ref*)larg0));
|
|
} else {
|
|
largv[0] = JSVAL_NULL;
|
|
};
|
|
JS::RootedValue rval(cx);
|
|
bool succeed = func->invoke(1, &largv[0], &rval);
|
|
if (!succeed && JS_IsExceptionPending(cx)) {
|
|
JS_ReportPendingException(cx);
|
|
}
|
|
};
|
|
arg3 = lambda;
|
|
}
|
|
else
|
|
{
|
|
arg3 = nullptr;
|
|
}
|
|
} while(0)
|
|
;
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_MenuItemSprite_initWithNormalSprite : Error processing arguments");
|
|
bool ret = cobj->initWithNormalSprite(arg0, arg1, arg2, arg3);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_MenuItemSprite_initWithNormalSprite : wrong number of arguments: %d, was expecting %d", argc, 4);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_MenuItemSprite_setSelectedImage(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::MenuItemSprite* cobj = (cocos2d::MenuItemSprite *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_MenuItemSprite_setSelectedImage : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Node* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_MenuItemSprite_setSelectedImage : Error processing arguments");
|
|
cobj->setSelectedImage(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_MenuItemSprite_setSelectedImage : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_MenuItemSprite_getDisabledImage(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::MenuItemSprite* cobj = (cocos2d::MenuItemSprite *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_MenuItemSprite_getDisabledImage : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::Node* ret = cobj->getDisabledImage();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Node>(cx, (cocos2d::Node*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_MenuItemSprite_getDisabledImage : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_MenuItemSprite_getSelectedImage(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::MenuItemSprite* cobj = (cocos2d::MenuItemSprite *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_MenuItemSprite_getSelectedImage : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::Node* ret = cobj->getSelectedImage();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Node>(cx, (cocos2d::Node*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_MenuItemSprite_getSelectedImage : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_MenuItemSprite_getNormalImage(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::MenuItemSprite* cobj = (cocos2d::MenuItemSprite *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_MenuItemSprite_getNormalImage : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::Node* ret = cobj->getNormalImage();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Node>(cx, (cocos2d::Node*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_MenuItemSprite_getNormalImage : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_MenuItemSprite_unselected(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::MenuItemSprite* cobj = (cocos2d::MenuItemSprite *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_MenuItemSprite_unselected : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->unselected();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_MenuItemSprite_unselected : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_MenuItemSprite_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::MenuItemSprite* cobj = new (std::nothrow) cocos2d::MenuItemSprite();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::MenuItemSprite>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::MenuItemSprite"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_MenuItemSprite_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::MenuItemSprite *nobj = new (std::nothrow) cocos2d::MenuItemSprite();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::MenuItemSprite");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_MenuItem_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_MenuItemSprite(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_MenuItemSprite_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_MenuItemSprite_class->name = "MenuItemSprite";
|
|
jsb_cocos2d_MenuItemSprite_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_MenuItemSprite_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_MenuItemSprite_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_MenuItemSprite_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_MenuItemSprite_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_MenuItemSprite_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_MenuItemSprite_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_MenuItemSprite_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("setEnabled", js_cocos2dx_MenuItemSprite_setEnabled, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("selected", js_cocos2dx_MenuItemSprite_selected, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setNormalImage", js_cocos2dx_MenuItemSprite_setNormalImage, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setDisabledImage", js_cocos2dx_MenuItemSprite_setDisabledImage, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initWithNormalSprite", js_cocos2dx_MenuItemSprite_initWithNormalSprite, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setSelectedImage", js_cocos2dx_MenuItemSprite_setSelectedImage, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getDisabledImage", js_cocos2dx_MenuItemSprite_getDisabledImage, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getSelectedImage", js_cocos2dx_MenuItemSprite_getSelectedImage, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getNormalImage", js_cocos2dx_MenuItemSprite_getNormalImage, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("unselected", js_cocos2dx_MenuItemSprite_unselected, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_MenuItemSprite_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JSFunctionSpec *st_funcs = NULL;
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_MenuItem_prototype);
|
|
jsb_cocos2d_MenuItemSprite_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_MenuItemSprite_class,
|
|
js_cocos2dx_MenuItemSprite_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_MenuItemSprite_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "MenuItemSprite"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::MenuItemSprite>(cx, jsb_cocos2d_MenuItemSprite_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.MenuItemSprite.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_MenuItemImage_class;
|
|
JSObject *jsb_cocos2d_MenuItemImage_prototype;
|
|
|
|
bool js_cocos2dx_MenuItemImage_setDisabledSpriteFrame(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::MenuItemImage* cobj = (cocos2d::MenuItemImage *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_MenuItemImage_setDisabledSpriteFrame : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::SpriteFrame* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::SpriteFrame*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_MenuItemImage_setDisabledSpriteFrame : Error processing arguments");
|
|
cobj->setDisabledSpriteFrame(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_MenuItemImage_setDisabledSpriteFrame : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_MenuItemImage_setSelectedSpriteFrame(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::MenuItemImage* cobj = (cocos2d::MenuItemImage *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_MenuItemImage_setSelectedSpriteFrame : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::SpriteFrame* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::SpriteFrame*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_MenuItemImage_setSelectedSpriteFrame : Error processing arguments");
|
|
cobj->setSelectedSpriteFrame(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_MenuItemImage_setSelectedSpriteFrame : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_MenuItemImage_setNormalSpriteFrame(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::MenuItemImage* cobj = (cocos2d::MenuItemImage *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_MenuItemImage_setNormalSpriteFrame : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::SpriteFrame* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::SpriteFrame*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_MenuItemImage_setNormalSpriteFrame : Error processing arguments");
|
|
cobj->setNormalSpriteFrame(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_MenuItemImage_setNormalSpriteFrame : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_MenuItemImage_init(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::MenuItemImage* cobj = (cocos2d::MenuItemImage *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_MenuItemImage_init : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->init();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_MenuItemImage_init : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_MenuItemImage_initWithNormalImage(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::MenuItemImage* cobj = (cocos2d::MenuItemImage *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_MenuItemImage_initWithNormalImage : Invalid Native Object");
|
|
if (argc == 4) {
|
|
std::string arg0;
|
|
std::string arg1;
|
|
std::string arg2;
|
|
std::function<void (cocos2d::Ref *)> arg3;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
|
ok &= jsval_to_std_string(cx, args.get(2), &arg2);
|
|
do {
|
|
if(JS_TypeOfValue(cx, args.get(3)) == JSTYPE_FUNCTION)
|
|
{
|
|
JS::RootedObject jstarget(cx, args.thisv().toObjectOrNull());
|
|
std::shared_ptr<JSFunctionWrapper> func(new JSFunctionWrapper(cx, jstarget, args.get(3), args.thisv()));
|
|
auto lambda = [=](cocos2d::Ref* larg0) -> void {
|
|
JSB_AUTOCOMPARTMENT_WITH_GLOBAL_OBJCET
|
|
jsval largv[1];
|
|
if (larg0) {
|
|
largv[0] = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Ref>(cx, (cocos2d::Ref*)larg0));
|
|
} else {
|
|
largv[0] = JSVAL_NULL;
|
|
};
|
|
JS::RootedValue rval(cx);
|
|
bool succeed = func->invoke(1, &largv[0], &rval);
|
|
if (!succeed && JS_IsExceptionPending(cx)) {
|
|
JS_ReportPendingException(cx);
|
|
}
|
|
};
|
|
arg3 = lambda;
|
|
}
|
|
else
|
|
{
|
|
arg3 = nullptr;
|
|
}
|
|
} while(0)
|
|
;
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_MenuItemImage_initWithNormalImage : Error processing arguments");
|
|
bool ret = cobj->initWithNormalImage(arg0, arg1, arg2, arg3);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_MenuItemImage_initWithNormalImage : wrong number of arguments: %d, was expecting %d", argc, 4);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_MenuItemImage_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::MenuItemImage* cobj = new (std::nothrow) cocos2d::MenuItemImage();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::MenuItemImage>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::MenuItemImage"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_MenuItemImage_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::MenuItemImage *nobj = new (std::nothrow) cocos2d::MenuItemImage();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::MenuItemImage");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_MenuItemSprite_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_MenuItemImage(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_MenuItemImage_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_MenuItemImage_class->name = "MenuItemImage";
|
|
jsb_cocos2d_MenuItemImage_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_MenuItemImage_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_MenuItemImage_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_MenuItemImage_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_MenuItemImage_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_MenuItemImage_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_MenuItemImage_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_MenuItemImage_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("setDisabledSpriteFrame", js_cocos2dx_MenuItemImage_setDisabledSpriteFrame, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setSelectedSpriteFrame", js_cocos2dx_MenuItemImage_setSelectedSpriteFrame, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setNormalSpriteFrame", js_cocos2dx_MenuItemImage_setNormalSpriteFrame, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("init", js_cocos2dx_MenuItemImage_init, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initWithNormalImage", js_cocos2dx_MenuItemImage_initWithNormalImage, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_MenuItemImage_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JSFunctionSpec *st_funcs = NULL;
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_MenuItemSprite_prototype);
|
|
jsb_cocos2d_MenuItemImage_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_MenuItemImage_class,
|
|
js_cocos2dx_MenuItemImage_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_MenuItemImage_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "MenuItemImage"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::MenuItemImage>(cx, jsb_cocos2d_MenuItemImage_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.MenuItemImage.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_MenuItemToggle_class;
|
|
JSObject *jsb_cocos2d_MenuItemToggle_prototype;
|
|
|
|
bool js_cocos2dx_MenuItemToggle_setSubItems(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::MenuItemToggle* cobj = (cocos2d::MenuItemToggle *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_MenuItemToggle_setSubItems : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Vector<cocos2d::MenuItem *> arg0;
|
|
ok &= jsval_to_ccvector(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_MenuItemToggle_setSubItems : Error processing arguments");
|
|
cobj->setSubItems(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_MenuItemToggle_setSubItems : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_MenuItemToggle_initWithItem(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::MenuItemToggle* cobj = (cocos2d::MenuItemToggle *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_MenuItemToggle_initWithItem : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::MenuItem* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::MenuItem*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_MenuItemToggle_initWithItem : Error processing arguments");
|
|
bool ret = cobj->initWithItem(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_MenuItemToggle_initWithItem : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_MenuItemToggle_getSelectedIndex(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::MenuItemToggle* cobj = (cocos2d::MenuItemToggle *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_MenuItemToggle_getSelectedIndex : Invalid Native Object");
|
|
if (argc == 0) {
|
|
unsigned int ret = cobj->getSelectedIndex();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = uint32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_MenuItemToggle_getSelectedIndex : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_MenuItemToggle_addSubItem(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::MenuItemToggle* cobj = (cocos2d::MenuItemToggle *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_MenuItemToggle_addSubItem : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::MenuItem* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::MenuItem*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_MenuItemToggle_addSubItem : Error processing arguments");
|
|
cobj->addSubItem(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_MenuItemToggle_addSubItem : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_MenuItemToggle_getSelectedItem(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::MenuItemToggle* cobj = (cocos2d::MenuItemToggle *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_MenuItemToggle_getSelectedItem : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::MenuItem* ret = cobj->getSelectedItem();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::MenuItem>(cx, (cocos2d::MenuItem*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_MenuItemToggle_getSelectedItem : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_MenuItemToggle_setSelectedIndex(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::MenuItemToggle* cobj = (cocos2d::MenuItemToggle *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_MenuItemToggle_setSelectedIndex : Invalid Native Object");
|
|
if (argc == 1) {
|
|
unsigned int arg0 = 0;
|
|
ok &= jsval_to_uint32(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_MenuItemToggle_setSelectedIndex : Error processing arguments");
|
|
cobj->setSelectedIndex(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_MenuItemToggle_setSelectedIndex : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_MenuItemToggle_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::MenuItemToggle* cobj = new (std::nothrow) cocos2d::MenuItemToggle();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::MenuItemToggle>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::MenuItemToggle"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_MenuItemToggle_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::MenuItemToggle *nobj = new (std::nothrow) cocos2d::MenuItemToggle();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::MenuItemToggle");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_MenuItem_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_MenuItemToggle(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_MenuItemToggle_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_MenuItemToggle_class->name = "MenuItemToggle";
|
|
jsb_cocos2d_MenuItemToggle_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_MenuItemToggle_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_MenuItemToggle_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_MenuItemToggle_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_MenuItemToggle_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_MenuItemToggle_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_MenuItemToggle_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_MenuItemToggle_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("setSubItems", js_cocos2dx_MenuItemToggle_setSubItems, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initWithItem", js_cocos2dx_MenuItemToggle_initWithItem, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getSelectedIndex", js_cocos2dx_MenuItemToggle_getSelectedIndex, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("addSubItem", js_cocos2dx_MenuItemToggle_addSubItem, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getSelectedItem", js_cocos2dx_MenuItemToggle_getSelectedItem, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setSelectedIndex", js_cocos2dx_MenuItemToggle_setSelectedIndex, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_MenuItemToggle_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JSFunctionSpec *st_funcs = NULL;
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_MenuItem_prototype);
|
|
jsb_cocos2d_MenuItemToggle_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_MenuItemToggle_class,
|
|
js_cocos2dx_MenuItemToggle_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_MenuItemToggle_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "MenuItemToggle"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::MenuItemToggle>(cx, jsb_cocos2d_MenuItemToggle_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.MenuItemToggle.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_Menu_class;
|
|
JSObject *jsb_cocos2d_Menu_prototype;
|
|
|
|
bool js_cocos2dx_Menu_initWithArray(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Menu* cobj = (cocos2d::Menu *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Menu_initWithArray : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Vector<cocos2d::MenuItem *> arg0;
|
|
ok &= jsval_to_ccvector(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Menu_initWithArray : Error processing arguments");
|
|
bool ret = cobj->initWithArray(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Menu_initWithArray : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Menu_setEnabled(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Menu* cobj = (cocos2d::Menu *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Menu_setEnabled : Invalid Native Object");
|
|
if (argc == 1) {
|
|
bool arg0;
|
|
arg0 = JS::ToBoolean(args.get(0));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Menu_setEnabled : Error processing arguments");
|
|
cobj->setEnabled(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Menu_setEnabled : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Menu_alignItemsVertically(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Menu* cobj = (cocos2d::Menu *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Menu_alignItemsVertically : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->alignItemsVertically();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Menu_alignItemsVertically : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Menu_isEnabled(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Menu* cobj = (cocos2d::Menu *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Menu_isEnabled : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->isEnabled();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Menu_isEnabled : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Menu_alignItemsHorizontallyWithPadding(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Menu* cobj = (cocos2d::Menu *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Menu_alignItemsHorizontallyWithPadding : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Menu_alignItemsHorizontallyWithPadding : Error processing arguments");
|
|
cobj->alignItemsHorizontallyWithPadding(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Menu_alignItemsHorizontallyWithPadding : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Menu_alignItemsVerticallyWithPadding(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Menu* cobj = (cocos2d::Menu *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Menu_alignItemsVerticallyWithPadding : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Menu_alignItemsVerticallyWithPadding : Error processing arguments");
|
|
cobj->alignItemsVerticallyWithPadding(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Menu_alignItemsVerticallyWithPadding : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Menu_alignItemsHorizontally(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Menu* cobj = (cocos2d::Menu *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Menu_alignItemsHorizontally : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->alignItemsHorizontally();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Menu_alignItemsHorizontally : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Menu_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::Menu* cobj = new (std::nothrow) cocos2d::Menu();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::Menu>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::Menu"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_Menu_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::Menu *nobj = new (std::nothrow) cocos2d::Menu();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::Menu");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_Layer_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_Menu(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_Menu_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_Menu_class->name = "Menu";
|
|
jsb_cocos2d_Menu_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Menu_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_Menu_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Menu_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_Menu_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_Menu_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_Menu_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_Menu_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("initWithArray", js_cocos2dx_Menu_initWithArray, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setEnabled", js_cocos2dx_Menu_setEnabled, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("alignItemsVertically", js_cocos2dx_Menu_alignItemsVertically, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("isEnabled", js_cocos2dx_Menu_isEnabled, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("alignItemsHorizontallyWithPadding", js_cocos2dx_Menu_alignItemsHorizontallyWithPadding, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("alignItemsVerticallyWithPadding", js_cocos2dx_Menu_alignItemsVerticallyWithPadding, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("alignItemsHorizontally", js_cocos2dx_Menu_alignItemsHorizontally, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_Menu_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JSFunctionSpec *st_funcs = NULL;
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_Layer_prototype);
|
|
jsb_cocos2d_Menu_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_Menu_class,
|
|
js_cocos2dx_Menu_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_Menu_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "Menu"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::Menu>(cx, jsb_cocos2d_Menu_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.Menu.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_MotionStreak_class;
|
|
JSObject *jsb_cocos2d_MotionStreak_prototype;
|
|
|
|
bool js_cocos2dx_MotionStreak_reset(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::MotionStreak* cobj = (cocos2d::MotionStreak *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_MotionStreak_reset : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->reset();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_MotionStreak_reset : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_MotionStreak_setTexture(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::MotionStreak* cobj = (cocos2d::MotionStreak *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_MotionStreak_setTexture : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Texture2D* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Texture2D*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_MotionStreak_setTexture : Error processing arguments");
|
|
cobj->setTexture(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_MotionStreak_setTexture : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_MotionStreak_getTexture(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::MotionStreak* cobj = (cocos2d::MotionStreak *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_MotionStreak_getTexture : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::Texture2D* ret = cobj->getTexture();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Texture2D>(cx, (cocos2d::Texture2D*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_MotionStreak_getTexture : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_MotionStreak_tintWithColor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::MotionStreak* cobj = (cocos2d::MotionStreak *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_MotionStreak_tintWithColor : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Color3B arg0;
|
|
ok &= jsval_to_cccolor3b(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_MotionStreak_tintWithColor : Error processing arguments");
|
|
cobj->tintWithColor(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_MotionStreak_tintWithColor : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_MotionStreak_setBlendFunc(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::MotionStreak* cobj = (cocos2d::MotionStreak *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_MotionStreak_setBlendFunc : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::BlendFunc arg0;
|
|
ok &= jsval_to_blendfunc(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_MotionStreak_setBlendFunc : Error processing arguments");
|
|
cobj->setBlendFunc(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_MotionStreak_setBlendFunc : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_MotionStreak_setStartingPositionInitialized(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::MotionStreak* cobj = (cocos2d::MotionStreak *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_MotionStreak_setStartingPositionInitialized : Invalid Native Object");
|
|
if (argc == 1) {
|
|
bool arg0;
|
|
arg0 = JS::ToBoolean(args.get(0));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_MotionStreak_setStartingPositionInitialized : Error processing arguments");
|
|
cobj->setStartingPositionInitialized(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_MotionStreak_setStartingPositionInitialized : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_MotionStreak_getBlendFunc(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::MotionStreak* cobj = (cocos2d::MotionStreak *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_MotionStreak_getBlendFunc : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const cocos2d::BlendFunc& ret = cobj->getBlendFunc();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = blendfunc_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_MotionStreak_getBlendFunc : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_MotionStreak_isStartingPositionInitialized(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::MotionStreak* cobj = (cocos2d::MotionStreak *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_MotionStreak_isStartingPositionInitialized : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->isStartingPositionInitialized();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_MotionStreak_isStartingPositionInitialized : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_MotionStreak_isFastMode(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::MotionStreak* cobj = (cocos2d::MotionStreak *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_MotionStreak_isFastMode : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->isFastMode();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_MotionStreak_isFastMode : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_MotionStreak_getStroke(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::MotionStreak* cobj = (cocos2d::MotionStreak *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_MotionStreak_getStroke : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getStroke();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_MotionStreak_getStroke : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_MotionStreak_initWithFade(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::MotionStreak* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::MotionStreak *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_MotionStreak_initWithFade : Invalid Native Object");
|
|
do {
|
|
if (argc == 5) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
if (!ok) { ok = true; break; }
|
|
double arg1 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
if (!ok) { ok = true; break; }
|
|
double arg2 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Color3B arg3;
|
|
ok &= jsval_to_cccolor3b(cx, args.get(3), &arg3);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Texture2D* arg4 = nullptr;
|
|
do {
|
|
if (args.get(4).isNull()) { arg4 = nullptr; break; }
|
|
if (!args.get(4).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(4).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg4 = (cocos2d::Texture2D*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg4, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
if (!ok) { ok = true; break; }
|
|
bool ret = cobj->initWithFade(arg0, arg1, arg2, arg3, arg4);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 5) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
if (!ok) { ok = true; break; }
|
|
double arg1 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
if (!ok) { ok = true; break; }
|
|
double arg2 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Color3B arg3;
|
|
ok &= jsval_to_cccolor3b(cx, args.get(3), &arg3);
|
|
if (!ok) { ok = true; break; }
|
|
std::string arg4;
|
|
ok &= jsval_to_std_string(cx, args.get(4), &arg4);
|
|
if (!ok) { ok = true; break; }
|
|
bool ret = cobj->initWithFade(arg0, arg1, arg2, arg3, arg4);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_MotionStreak_initWithFade : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_MotionStreak_setFastMode(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::MotionStreak* cobj = (cocos2d::MotionStreak *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_MotionStreak_setFastMode : Invalid Native Object");
|
|
if (argc == 1) {
|
|
bool arg0;
|
|
arg0 = JS::ToBoolean(args.get(0));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_MotionStreak_setFastMode : Error processing arguments");
|
|
cobj->setFastMode(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_MotionStreak_setFastMode : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_MotionStreak_setStroke(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::MotionStreak* cobj = (cocos2d::MotionStreak *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_MotionStreak_setStroke : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_MotionStreak_setStroke : Error processing arguments");
|
|
cobj->setStroke(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_MotionStreak_setStroke : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_MotionStreak_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
|
|
do {
|
|
if (argc == 5) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
if (!ok) { ok = true; break; }
|
|
double arg1 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
if (!ok) { ok = true; break; }
|
|
double arg2 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Color3B arg3;
|
|
ok &= jsval_to_cccolor3b(cx, args.get(3), &arg3);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Texture2D* arg4 = nullptr;
|
|
do {
|
|
if (args.get(4).isNull()) { arg4 = nullptr; break; }
|
|
if (!args.get(4).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(4).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg4 = (cocos2d::Texture2D*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg4, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::MotionStreak* ret = cocos2d::MotionStreak::create(arg0, arg1, arg2, arg3, arg4);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::MotionStreak>(cx, (cocos2d::MotionStreak*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
|
|
do {
|
|
if (argc == 5) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
if (!ok) { ok = true; break; }
|
|
double arg1 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
if (!ok) { ok = true; break; }
|
|
double arg2 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Color3B arg3;
|
|
ok &= jsval_to_cccolor3b(cx, args.get(3), &arg3);
|
|
if (!ok) { ok = true; break; }
|
|
std::string arg4;
|
|
ok &= jsval_to_std_string(cx, args.get(4), &arg4);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::MotionStreak* ret = cocos2d::MotionStreak::create(arg0, arg1, arg2, arg3, arg4);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::MotionStreak>(cx, (cocos2d::MotionStreak*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
JS_ReportError(cx, "js_cocos2dx_MotionStreak_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_MotionStreak_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::MotionStreak* cobj = new (std::nothrow) cocos2d::MotionStreak();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::MotionStreak>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::MotionStreak"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_MotionStreak_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::MotionStreak *nobj = new (std::nothrow) cocos2d::MotionStreak();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::MotionStreak");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_Node_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_MotionStreak(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_MotionStreak_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_MotionStreak_class->name = "MotionStreak";
|
|
jsb_cocos2d_MotionStreak_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_MotionStreak_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_MotionStreak_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_MotionStreak_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_MotionStreak_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_MotionStreak_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_MotionStreak_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_MotionStreak_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("reset", js_cocos2dx_MotionStreak_reset, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setTexture", js_cocos2dx_MotionStreak_setTexture, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getTexture", js_cocos2dx_MotionStreak_getTexture, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("tintWithColor", js_cocos2dx_MotionStreak_tintWithColor, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setBlendFunc", js_cocos2dx_MotionStreak_setBlendFunc, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setStartingPositionInitialized", js_cocos2dx_MotionStreak_setStartingPositionInitialized, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getBlendFunc", js_cocos2dx_MotionStreak_getBlendFunc, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("isStartingPositionInitialized", js_cocos2dx_MotionStreak_isStartingPositionInitialized, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("isFastMode", js_cocos2dx_MotionStreak_isFastMode, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getStroke", js_cocos2dx_MotionStreak_getStroke, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initWithFade", js_cocos2dx_MotionStreak_initWithFade, 5, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setFastMode", js_cocos2dx_MotionStreak_setFastMode, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setStroke", js_cocos2dx_MotionStreak_setStroke, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_MotionStreak_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_MotionStreak_create, 5, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_Node_prototype);
|
|
jsb_cocos2d_MotionStreak_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_MotionStreak_class,
|
|
js_cocos2dx_MotionStreak_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_MotionStreak_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "MotionStreak"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::MotionStreak>(cx, jsb_cocos2d_MotionStreak_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.MotionStreak.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_NodeGrid_class;
|
|
JSObject *jsb_cocos2d_NodeGrid_prototype;
|
|
|
|
bool js_cocos2dx_NodeGrid_setTarget(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::NodeGrid* cobj = (cocos2d::NodeGrid *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_NodeGrid_setTarget : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Node* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_NodeGrid_setTarget : Error processing arguments");
|
|
cobj->setTarget(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_NodeGrid_setTarget : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_NodeGrid_getGrid(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::NodeGrid* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::NodeGrid *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_NodeGrid_getGrid : Invalid Native Object");
|
|
do {
|
|
if (argc == 0) {
|
|
const cocos2d::GridBase* ret = cobj->getGrid();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::GridBase>(cx, (cocos2d::GridBase*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 0) {
|
|
cocos2d::GridBase* ret = cobj->getGrid();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::GridBase>(cx, (cocos2d::GridBase*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_NodeGrid_getGrid : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_NodeGrid_getGridRect(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::NodeGrid* cobj = (cocos2d::NodeGrid *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_NodeGrid_getGridRect : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const cocos2d::Rect& ret = cobj->getGridRect();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ccrect_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_NodeGrid_getGridRect : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_NodeGrid_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
|
|
do {
|
|
if (argc == 1) {
|
|
cocos2d::Rect arg0;
|
|
ok &= jsval_to_ccrect(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::NodeGrid* ret = cocos2d::NodeGrid::create(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::NodeGrid>(cx, (cocos2d::NodeGrid*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
|
|
do {
|
|
if (argc == 0) {
|
|
cocos2d::NodeGrid* ret = cocos2d::NodeGrid::create();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::NodeGrid>(cx, (cocos2d::NodeGrid*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
JS_ReportError(cx, "js_cocos2dx_NodeGrid_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_NodeGrid_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::NodeGrid* cobj = new (std::nothrow) cocos2d::NodeGrid();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::NodeGrid>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::NodeGrid"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_Node_prototype;
|
|
|
|
void js_register_cocos2dx_NodeGrid(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_NodeGrid_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_NodeGrid_class->name = "NodeGrid";
|
|
jsb_cocos2d_NodeGrid_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_NodeGrid_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_NodeGrid_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_NodeGrid_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_NodeGrid_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_NodeGrid_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_NodeGrid_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_NodeGrid_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("setTarget", js_cocos2dx_NodeGrid_setTarget, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getGrid", js_cocos2dx_NodeGrid_getGrid, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getGridRect", js_cocos2dx_NodeGrid_getGridRect, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_NodeGrid_create, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_Node_prototype);
|
|
jsb_cocos2d_NodeGrid_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_NodeGrid_class,
|
|
js_cocos2dx_NodeGrid_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_NodeGrid_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "NodeGrid"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::NodeGrid>(cx, jsb_cocos2d_NodeGrid_class, proto, parent_proto);
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_ParticleBatchNode_class;
|
|
JSObject *jsb_cocos2d_ParticleBatchNode_prototype;
|
|
|
|
bool js_cocos2dx_ParticleBatchNode_setTexture(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleBatchNode* cobj = (cocos2d::ParticleBatchNode *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleBatchNode_setTexture : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Texture2D* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Texture2D*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleBatchNode_setTexture : Error processing arguments");
|
|
cobj->setTexture(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleBatchNode_setTexture : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleBatchNode_initWithTexture(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleBatchNode* cobj = (cocos2d::ParticleBatchNode *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleBatchNode_initWithTexture : Invalid Native Object");
|
|
if (argc == 2) {
|
|
cocos2d::Texture2D* arg0 = nullptr;
|
|
int arg1 = 0;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Texture2D*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleBatchNode_initWithTexture : Error processing arguments");
|
|
bool ret = cobj->initWithTexture(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleBatchNode_initWithTexture : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleBatchNode_disableParticle(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleBatchNode* cobj = (cocos2d::ParticleBatchNode *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleBatchNode_disableParticle : Invalid Native Object");
|
|
if (argc == 1) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleBatchNode_disableParticle : Error processing arguments");
|
|
cobj->disableParticle(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleBatchNode_disableParticle : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleBatchNode_getTexture(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleBatchNode* cobj = (cocos2d::ParticleBatchNode *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleBatchNode_getTexture : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::Texture2D* ret = cobj->getTexture();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Texture2D>(cx, (cocos2d::Texture2D*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleBatchNode_getTexture : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleBatchNode_setTextureAtlas(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleBatchNode* cobj = (cocos2d::ParticleBatchNode *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleBatchNode_setTextureAtlas : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::TextureAtlas* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::TextureAtlas*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleBatchNode_setTextureAtlas : Error processing arguments");
|
|
cobj->setTextureAtlas(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleBatchNode_setTextureAtlas : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleBatchNode_initWithFile(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleBatchNode* cobj = (cocos2d::ParticleBatchNode *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleBatchNode_initWithFile : Invalid Native Object");
|
|
if (argc == 2) {
|
|
std::string arg0;
|
|
int arg1 = 0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleBatchNode_initWithFile : Error processing arguments");
|
|
bool ret = cobj->initWithFile(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleBatchNode_initWithFile : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleBatchNode_setBlendFunc(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleBatchNode* cobj = (cocos2d::ParticleBatchNode *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleBatchNode_setBlendFunc : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::BlendFunc arg0;
|
|
ok &= jsval_to_blendfunc(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleBatchNode_setBlendFunc : Error processing arguments");
|
|
cobj->setBlendFunc(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleBatchNode_setBlendFunc : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleBatchNode_removeAllChildrenWithCleanup(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleBatchNode* cobj = (cocos2d::ParticleBatchNode *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleBatchNode_removeAllChildrenWithCleanup : Invalid Native Object");
|
|
if (argc == 1) {
|
|
bool arg0;
|
|
arg0 = JS::ToBoolean(args.get(0));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleBatchNode_removeAllChildrenWithCleanup : Error processing arguments");
|
|
cobj->removeAllChildrenWithCleanup(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleBatchNode_removeAllChildrenWithCleanup : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleBatchNode_getTextureAtlas(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleBatchNode* cobj = (cocos2d::ParticleBatchNode *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleBatchNode_getTextureAtlas : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::TextureAtlas* ret = cobj->getTextureAtlas();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::TextureAtlas>(cx, (cocos2d::TextureAtlas*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleBatchNode_getTextureAtlas : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleBatchNode_getBlendFunc(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleBatchNode* cobj = (cocos2d::ParticleBatchNode *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleBatchNode_getBlendFunc : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const cocos2d::BlendFunc& ret = cobj->getBlendFunc();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = blendfunc_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleBatchNode_getBlendFunc : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleBatchNode_insertChild(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleBatchNode* cobj = (cocos2d::ParticleBatchNode *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleBatchNode_insertChild : Invalid Native Object");
|
|
if (argc == 2) {
|
|
cocos2d::ParticleSystem* arg0 = nullptr;
|
|
int arg1 = 0;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::ParticleSystem*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleBatchNode_insertChild : Error processing arguments");
|
|
cobj->insertChild(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleBatchNode_insertChild : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleBatchNode_removeChildAtIndex(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleBatchNode* cobj = (cocos2d::ParticleBatchNode *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleBatchNode_removeChildAtIndex : Invalid Native Object");
|
|
if (argc == 2) {
|
|
int arg0 = 0;
|
|
bool arg1;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
arg1 = JS::ToBoolean(args.get(1));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleBatchNode_removeChildAtIndex : Error processing arguments");
|
|
cobj->removeChildAtIndex(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleBatchNode_removeChildAtIndex : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleBatchNode_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleBatchNode_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::ParticleBatchNode::create(arg0);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::ParticleBatchNode>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::ParticleBatchNode"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
if (argc == 2) {
|
|
std::string arg0;
|
|
int arg1 = 0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleBatchNode_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::ParticleBatchNode::create(arg0, arg1);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::ParticleBatchNode>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::ParticleBatchNode"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleBatchNode_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_ParticleBatchNode_createWithTexture(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
cocos2d::Texture2D* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Texture2D*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleBatchNode_createWithTexture : Error processing arguments");
|
|
|
|
auto ret = cocos2d::ParticleBatchNode::createWithTexture(arg0);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::ParticleBatchNode>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::ParticleBatchNode"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
if (argc == 2) {
|
|
cocos2d::Texture2D* arg0 = nullptr;
|
|
int arg1 = 0;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Texture2D*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleBatchNode_createWithTexture : Error processing arguments");
|
|
|
|
auto ret = cocos2d::ParticleBatchNode::createWithTexture(arg0, arg1);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::ParticleBatchNode>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::ParticleBatchNode"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleBatchNode_createWithTexture : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_ParticleBatchNode_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::ParticleBatchNode* cobj = new (std::nothrow) cocos2d::ParticleBatchNode();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::ParticleBatchNode>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::ParticleBatchNode"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_ParticleBatchNode_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::ParticleBatchNode *nobj = new (std::nothrow) cocos2d::ParticleBatchNode();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::ParticleBatchNode");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_Node_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_ParticleBatchNode(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_ParticleBatchNode_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_ParticleBatchNode_class->name = "ParticleBatchNode";
|
|
jsb_cocos2d_ParticleBatchNode_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_ParticleBatchNode_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_ParticleBatchNode_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_ParticleBatchNode_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_ParticleBatchNode_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_ParticleBatchNode_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_ParticleBatchNode_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_ParticleBatchNode_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("setTexture", js_cocos2dx_ParticleBatchNode_setTexture, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initWithTexture", js_cocos2dx_ParticleBatchNode_initWithTexture, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("disableParticle", js_cocos2dx_ParticleBatchNode_disableParticle, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getTexture", js_cocos2dx_ParticleBatchNode_getTexture, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setTextureAtlas", js_cocos2dx_ParticleBatchNode_setTextureAtlas, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initWithFile", js_cocos2dx_ParticleBatchNode_initWithFile, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setBlendFunc", js_cocos2dx_ParticleBatchNode_setBlendFunc, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("removeAllChildrenWithCleanup", js_cocos2dx_ParticleBatchNode_removeAllChildrenWithCleanup, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getTextureAtlas", js_cocos2dx_ParticleBatchNode_getTextureAtlas, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getBlendFunc", js_cocos2dx_ParticleBatchNode_getBlendFunc, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("insertChild", js_cocos2dx_ParticleBatchNode_insertChild, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("removeChildAtIndex", js_cocos2dx_ParticleBatchNode_removeChildAtIndex, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_ParticleBatchNode_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_ParticleBatchNode_create, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("createWithTexture", js_cocos2dx_ParticleBatchNode_createWithTexture, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_Node_prototype);
|
|
jsb_cocos2d_ParticleBatchNode_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_ParticleBatchNode_class,
|
|
js_cocos2dx_ParticleBatchNode_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_ParticleBatchNode_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "ParticleBatchNode"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::ParticleBatchNode>(cx, jsb_cocos2d_ParticleBatchNode_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.ParticleBatchNode.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_ParticleData_class;
|
|
JSObject *jsb_cocos2d_ParticleData_prototype;
|
|
|
|
bool js_cocos2dx_ParticleData_release(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleData* cobj = (cocos2d::ParticleData *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleData_release : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->release();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleData_release : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleData_getMaxCount(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleData* cobj = (cocos2d::ParticleData *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleData_getMaxCount : Invalid Native Object");
|
|
if (argc == 0) {
|
|
unsigned int ret = cobj->getMaxCount();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = uint32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleData_getMaxCount : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleData_init(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleData* cobj = (cocos2d::ParticleData *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleData_init : Invalid Native Object");
|
|
if (argc == 1) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleData_init : Error processing arguments");
|
|
bool ret = cobj->init(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleData_init : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleData_copyParticle(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleData* cobj = (cocos2d::ParticleData *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleData_copyParticle : Invalid Native Object");
|
|
if (argc == 2) {
|
|
int arg0 = 0;
|
|
int arg1 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleData_copyParticle : Error processing arguments");
|
|
cobj->copyParticle(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleData_copyParticle : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleData_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::ParticleData* cobj = new (std::nothrow) cocos2d::ParticleData();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::ParticleData>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_create_weak_jsobject(cx, cobj, typeClass, "cocos2d::ParticleData"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
|
|
|
|
void js_cocos2d_ParticleData_finalize(JSFreeOp *fop, JSObject *obj) {
|
|
CCLOGINFO("jsbindings: finalizing JS object %p (ParticleData)", obj);
|
|
js_proxy_t* nproxy;
|
|
js_proxy_t* jsproxy;
|
|
JSContext *cx = ScriptingCore::getInstance()->getGlobalContext();
|
|
JS::RootedObject jsobj(cx, obj);
|
|
jsproxy = jsb_get_js_proxy(jsobj);
|
|
if (jsproxy) {
|
|
cocos2d::ParticleData *nobj = static_cast<cocos2d::ParticleData *>(jsproxy->ptr);
|
|
nproxy = jsb_get_native_proxy(jsproxy->ptr);
|
|
|
|
if (nobj) {
|
|
jsb_remove_proxy(nproxy, jsproxy);
|
|
delete nobj;
|
|
}
|
|
else
|
|
jsb_remove_proxy(nullptr, jsproxy);
|
|
}
|
|
}
|
|
void js_register_cocos2dx_ParticleData(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_ParticleData_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_ParticleData_class->name = "ParticleData";
|
|
jsb_cocos2d_ParticleData_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_ParticleData_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_ParticleData_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_ParticleData_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_ParticleData_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_ParticleData_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_ParticleData_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_ParticleData_class->finalize = js_cocos2d_ParticleData_finalize;
|
|
jsb_cocos2d_ParticleData_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("release", js_cocos2dx_ParticleData_release, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getMaxCount", js_cocos2dx_ParticleData_getMaxCount, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("init", js_cocos2dx_ParticleData_init, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("copyParticle", js_cocos2dx_ParticleData_copyParticle, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JSFunctionSpec *st_funcs = NULL;
|
|
|
|
jsb_cocos2d_ParticleData_prototype = JS_InitClass(
|
|
cx, global,
|
|
JS::NullPtr(),
|
|
jsb_cocos2d_ParticleData_class,
|
|
js_cocos2dx_ParticleData_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_ParticleData_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "ParticleData"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::FalseHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::ParticleData>(cx, jsb_cocos2d_ParticleData_class, proto, JS::NullPtr());
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_ParticleSystem_class;
|
|
JSObject *jsb_cocos2d_ParticleSystem_prototype;
|
|
|
|
bool js_cocos2dx_ParticleSystem_getStartSizeVar(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_getStartSizeVar : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getStartSizeVar();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_getStartSizeVar : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_getTexture(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_getTexture : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::Texture2D* ret = cobj->getTexture();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Texture2D>(cx, (cocos2d::Texture2D*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_getTexture : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_isFull(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_isFull : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->isFull();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_isFull : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_getBatchNode(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_getBatchNode : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::ParticleBatchNode* ret = cobj->getBatchNode();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::ParticleBatchNode>(cx, (cocos2d::ParticleBatchNode*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_getBatchNode : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_getStartColor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_getStartColor : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const cocos2d::Color4F& ret = cobj->getStartColor();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = cccolor4f_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_getStartColor : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_getPositionType(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_getPositionType : Invalid Native Object");
|
|
if (argc == 0) {
|
|
int ret = (int)cobj->getPositionType();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = int32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_getPositionType : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_setPosVar(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_setPosVar : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Vec2 arg0;
|
|
ok &= jsval_to_vector2(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystem_setPosVar : Error processing arguments");
|
|
cobj->setPosVar(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_setPosVar : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_getEndSpin(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_getEndSpin : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getEndSpin();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_getEndSpin : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_setRotatePerSecondVar(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_setRotatePerSecondVar : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystem_setRotatePerSecondVar : Error processing arguments");
|
|
cobj->setRotatePerSecondVar(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_setRotatePerSecondVar : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_getStartSpinVar(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_getStartSpinVar : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getStartSpinVar();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_getStartSpinVar : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_getRadialAccelVar(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_getRadialAccelVar : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getRadialAccelVar();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_getRadialAccelVar : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_getEndSizeVar(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_getEndSizeVar : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getEndSizeVar();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_getEndSizeVar : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_setTangentialAccel(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_setTangentialAccel : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystem_setTangentialAccel : Error processing arguments");
|
|
cobj->setTangentialAccel(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_setTangentialAccel : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_getRadialAccel(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_getRadialAccel : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getRadialAccel();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_getRadialAccel : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_setStartRadius(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_setStartRadius : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystem_setStartRadius : Error processing arguments");
|
|
cobj->setStartRadius(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_setStartRadius : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_setRotatePerSecond(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_setRotatePerSecond : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystem_setRotatePerSecond : Error processing arguments");
|
|
cobj->setRotatePerSecond(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_setRotatePerSecond : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_setEndSize(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_setEndSize : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystem_setEndSize : Error processing arguments");
|
|
cobj->setEndSize(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_setEndSize : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_getGravity(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_getGravity : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const cocos2d::Vec2& ret = cobj->getGravity();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = vector2_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_getGravity : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_resumeEmissions(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_resumeEmissions : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->resumeEmissions();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_resumeEmissions : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_getTangentialAccel(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_getTangentialAccel : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getTangentialAccel();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_getTangentialAccel : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_setEndRadius(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_setEndRadius : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystem_setEndRadius : Error processing arguments");
|
|
cobj->setEndRadius(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_setEndRadius : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_getSpeed(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_getSpeed : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getSpeed();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_getSpeed : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_pauseEmissions(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_pauseEmissions : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->pauseEmissions();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_pauseEmissions : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_getAngle(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_getAngle : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getAngle();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_getAngle : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_setEndColor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_setEndColor : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Color4F arg0;
|
|
ok &= jsval_to_cccolor4f(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystem_setEndColor : Error processing arguments");
|
|
cobj->setEndColor(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_setEndColor : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_setStartSpin(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_setStartSpin : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystem_setStartSpin : Error processing arguments");
|
|
cobj->setStartSpin(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_setStartSpin : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_setDuration(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_setDuration : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystem_setDuration : Error processing arguments");
|
|
cobj->setDuration(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_setDuration : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_initWithTotalParticles(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_initWithTotalParticles : Invalid Native Object");
|
|
if (argc == 1) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystem_initWithTotalParticles : Error processing arguments");
|
|
bool ret = cobj->initWithTotalParticles(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_initWithTotalParticles : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_addParticles(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_addParticles : Invalid Native Object");
|
|
if (argc == 1) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystem_addParticles : Error processing arguments");
|
|
cobj->addParticles(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_addParticles : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_setTexture(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_setTexture : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Texture2D* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Texture2D*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystem_setTexture : Error processing arguments");
|
|
cobj->setTexture(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_setTexture : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_getPosVar(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_getPosVar : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const cocos2d::Vec2& ret = cobj->getPosVar();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = vector2_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_getPosVar : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_updateWithNoTime(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_updateWithNoTime : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->updateWithNoTime();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_updateWithNoTime : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_isBlendAdditive(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_isBlendAdditive : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->isBlendAdditive();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_isBlendAdditive : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_getSpeedVar(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_getSpeedVar : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getSpeedVar();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_getSpeedVar : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_setPositionType(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_setPositionType : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::ParticleSystem::PositionType arg0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystem_setPositionType : Error processing arguments");
|
|
cobj->setPositionType(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_setPositionType : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_stopSystem(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_stopSystem : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->stopSystem();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_stopSystem : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_getSourcePosition(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_getSourcePosition : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const cocos2d::Vec2& ret = cobj->getSourcePosition();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = vector2_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_getSourcePosition : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_setLifeVar(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_setLifeVar : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystem_setLifeVar : Error processing arguments");
|
|
cobj->setLifeVar(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_setLifeVar : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_setTotalParticles(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_setTotalParticles : Invalid Native Object");
|
|
if (argc == 1) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystem_setTotalParticles : Error processing arguments");
|
|
cobj->setTotalParticles(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_setTotalParticles : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_setEndColorVar(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_setEndColorVar : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Color4F arg0;
|
|
ok &= jsval_to_cccolor4f(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystem_setEndColorVar : Error processing arguments");
|
|
cobj->setEndColorVar(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_setEndColorVar : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_getAtlasIndex(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_getAtlasIndex : Invalid Native Object");
|
|
if (argc == 0) {
|
|
int ret = cobj->getAtlasIndex();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = int32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_getAtlasIndex : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_getStartSize(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_getStartSize : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getStartSize();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_getStartSize : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_setStartSpinVar(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_setStartSpinVar : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystem_setStartSpinVar : Error processing arguments");
|
|
cobj->setStartSpinVar(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_setStartSpinVar : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_resetSystem(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_resetSystem : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->resetSystem();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_resetSystem : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_setAtlasIndex(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_setAtlasIndex : Invalid Native Object");
|
|
if (argc == 1) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystem_setAtlasIndex : Error processing arguments");
|
|
cobj->setAtlasIndex(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_setAtlasIndex : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_setTangentialAccelVar(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_setTangentialAccelVar : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystem_setTangentialAccelVar : Error processing arguments");
|
|
cobj->setTangentialAccelVar(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_setTangentialAccelVar : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_setEndRadiusVar(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_setEndRadiusVar : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystem_setEndRadiusVar : Error processing arguments");
|
|
cobj->setEndRadiusVar(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_setEndRadiusVar : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_getEndRadius(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_getEndRadius : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getEndRadius();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_getEndRadius : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_isActive(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_isActive : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->isActive();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_isActive : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_setRadialAccelVar(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_setRadialAccelVar : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystem_setRadialAccelVar : Error processing arguments");
|
|
cobj->setRadialAccelVar(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_setRadialAccelVar : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_setStartSize(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_setStartSize : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystem_setStartSize : Error processing arguments");
|
|
cobj->setStartSize(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_setStartSize : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_setSpeed(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_setSpeed : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystem_setSpeed : Error processing arguments");
|
|
cobj->setSpeed(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_setSpeed : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_getStartSpin(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_getStartSpin : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getStartSpin();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_getStartSpin : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_getResourceFile(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_getResourceFile : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const std::string& ret = cobj->getResourceFile();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = std_string_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_getResourceFile : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_getRotatePerSecond(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_getRotatePerSecond : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getRotatePerSecond();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_getRotatePerSecond : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_setEmitterMode(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_setEmitterMode : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::ParticleSystem::Mode arg0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystem_setEmitterMode : Error processing arguments");
|
|
cobj->setEmitterMode(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_setEmitterMode : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_getDuration(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_getDuration : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getDuration();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_getDuration : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_setSourcePosition(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_setSourcePosition : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Vec2 arg0;
|
|
ok &= jsval_to_vector2(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystem_setSourcePosition : Error processing arguments");
|
|
cobj->setSourcePosition(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_setSourcePosition : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_stop(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_stop : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->stop();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_stop : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_updateParticleQuads(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_updateParticleQuads : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->updateParticleQuads();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_updateParticleQuads : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_getEndSpinVar(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_getEndSpinVar : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getEndSpinVar();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_getEndSpinVar : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_setBlendAdditive(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_setBlendAdditive : Invalid Native Object");
|
|
if (argc == 1) {
|
|
bool arg0;
|
|
arg0 = JS::ToBoolean(args.get(0));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystem_setBlendAdditive : Error processing arguments");
|
|
cobj->setBlendAdditive(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_setBlendAdditive : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_setLife(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_setLife : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystem_setLife : Error processing arguments");
|
|
cobj->setLife(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_setLife : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_setAngleVar(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_setAngleVar : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystem_setAngleVar : Error processing arguments");
|
|
cobj->setAngleVar(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_setAngleVar : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_setRotationIsDir(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_setRotationIsDir : Invalid Native Object");
|
|
if (argc == 1) {
|
|
bool arg0;
|
|
arg0 = JS::ToBoolean(args.get(0));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystem_setRotationIsDir : Error processing arguments");
|
|
cobj->setRotationIsDir(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_setRotationIsDir : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_start(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_start : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->start();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_start : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_setEndSizeVar(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_setEndSizeVar : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystem_setEndSizeVar : Error processing arguments");
|
|
cobj->setEndSizeVar(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_setEndSizeVar : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_setAngle(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_setAngle : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystem_setAngle : Error processing arguments");
|
|
cobj->setAngle(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_setAngle : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_setBatchNode(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_setBatchNode : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::ParticleBatchNode* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::ParticleBatchNode*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystem_setBatchNode : Error processing arguments");
|
|
cobj->setBatchNode(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_setBatchNode : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_getTangentialAccelVar(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_getTangentialAccelVar : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getTangentialAccelVar();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_getTangentialAccelVar : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_getEmitterMode(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_getEmitterMode : Invalid Native Object");
|
|
if (argc == 0) {
|
|
int ret = (int)cobj->getEmitterMode();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = int32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_getEmitterMode : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_setEndSpinVar(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_setEndSpinVar : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystem_setEndSpinVar : Error processing arguments");
|
|
cobj->setEndSpinVar(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_setEndSpinVar : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_initWithFile(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_initWithFile : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystem_initWithFile : Error processing arguments");
|
|
bool ret = cobj->initWithFile(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_initWithFile : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_getAngleVar(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_getAngleVar : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getAngleVar();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_getAngleVar : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_setStartColor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_setStartColor : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Color4F arg0;
|
|
ok &= jsval_to_cccolor4f(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystem_setStartColor : Error processing arguments");
|
|
cobj->setStartColor(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_setStartColor : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_getRotatePerSecondVar(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_getRotatePerSecondVar : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getRotatePerSecondVar();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_getRotatePerSecondVar : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_getEndSize(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_getEndSize : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getEndSize();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_getEndSize : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_getLife(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_getLife : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getLife();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_getLife : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_isPaused(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_isPaused : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->isPaused();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_isPaused : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_setSpeedVar(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_setSpeedVar : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystem_setSpeedVar : Error processing arguments");
|
|
cobj->setSpeedVar(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_setSpeedVar : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_setAutoRemoveOnFinish(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_setAutoRemoveOnFinish : Invalid Native Object");
|
|
if (argc == 1) {
|
|
bool arg0;
|
|
arg0 = JS::ToBoolean(args.get(0));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystem_setAutoRemoveOnFinish : Error processing arguments");
|
|
cobj->setAutoRemoveOnFinish(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_setAutoRemoveOnFinish : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_setGravity(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_setGravity : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Vec2 arg0;
|
|
ok &= jsval_to_vector2(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystem_setGravity : Error processing arguments");
|
|
cobj->setGravity(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_setGravity : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_postStep(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_postStep : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->postStep();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_postStep : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_setEmissionRate(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_setEmissionRate : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystem_setEmissionRate : Error processing arguments");
|
|
cobj->setEmissionRate(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_setEmissionRate : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_getEndColorVar(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_getEndColorVar : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const cocos2d::Color4F& ret = cobj->getEndColorVar();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = cccolor4f_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_getEndColorVar : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_getRotationIsDir(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_getRotationIsDir : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->getRotationIsDir();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_getRotationIsDir : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_getEmissionRate(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_getEmissionRate : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getEmissionRate();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_getEmissionRate : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_getEndColor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_getEndColor : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const cocos2d::Color4F& ret = cobj->getEndColor();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = cccolor4f_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_getEndColor : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_getLifeVar(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_getLifeVar : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getLifeVar();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_getLifeVar : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_setStartSizeVar(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_setStartSizeVar : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystem_setStartSizeVar : Error processing arguments");
|
|
cobj->setStartSizeVar(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_setStartSizeVar : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_getStartRadius(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_getStartRadius : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getStartRadius();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_getStartRadius : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_getParticleCount(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_getParticleCount : Invalid Native Object");
|
|
if (argc == 0) {
|
|
unsigned int ret = cobj->getParticleCount();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = uint32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_getParticleCount : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_getStartRadiusVar(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_getStartRadiusVar : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getStartRadiusVar();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_getStartRadiusVar : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_getBlendFunc(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_getBlendFunc : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const cocos2d::BlendFunc& ret = cobj->getBlendFunc();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = blendfunc_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_getBlendFunc : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_setStartColorVar(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_setStartColorVar : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Color4F arg0;
|
|
ok &= jsval_to_cccolor4f(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystem_setStartColorVar : Error processing arguments");
|
|
cobj->setStartColorVar(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_setStartColorVar : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_setEndSpin(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_setEndSpin : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystem_setEndSpin : Error processing arguments");
|
|
cobj->setEndSpin(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_setEndSpin : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_setRadialAccel(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_setRadialAccel : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystem_setRadialAccel : Error processing arguments");
|
|
cobj->setRadialAccel(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_setRadialAccel : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_initWithDictionary(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::ParticleSystem* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_initWithDictionary : Invalid Native Object");
|
|
do {
|
|
if (argc == 2) {
|
|
cocos2d::ValueMap arg0;
|
|
ok &= jsval_to_ccvaluemap(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
std::string arg1;
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
bool ret = cobj->initWithDictionary(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 1) {
|
|
cocos2d::ValueMap arg0;
|
|
ok &= jsval_to_ccvaluemap(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
bool ret = cobj->initWithDictionary(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_initWithDictionary : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_isAutoRemoveOnFinish(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_isAutoRemoveOnFinish : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->isAutoRemoveOnFinish();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_isAutoRemoveOnFinish : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_getTotalParticles(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_getTotalParticles : Invalid Native Object");
|
|
if (argc == 0) {
|
|
int ret = cobj->getTotalParticles();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = int32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_getTotalParticles : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_setStartRadiusVar(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_setStartRadiusVar : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystem_setStartRadiusVar : Error processing arguments");
|
|
cobj->setStartRadiusVar(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_setStartRadiusVar : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_setBlendFunc(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_setBlendFunc : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::BlendFunc arg0;
|
|
ok &= jsval_to_blendfunc(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystem_setBlendFunc : Error processing arguments");
|
|
cobj->setBlendFunc(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_setBlendFunc : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_getEndRadiusVar(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_getEndRadiusVar : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getEndRadiusVar();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_getEndRadiusVar : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_getStartColorVar(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystem* cobj = (cocos2d::ParticleSystem *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystem_getStartColorVar : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const cocos2d::Color4F& ret = cobj->getStartColorVar();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = cccolor4f_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_getStartColorVar : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystem_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystem_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::ParticleSystem::create(arg0);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::ParticleSystem>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::ParticleSystem"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_ParticleSystem_createWithTotalParticles(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystem_createWithTotalParticles : Error processing arguments");
|
|
|
|
auto ret = cocos2d::ParticleSystem::createWithTotalParticles(arg0);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::ParticleSystem>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::ParticleSystem"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystem_createWithTotalParticles : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_ParticleSystem_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::ParticleSystem* cobj = new (std::nothrow) cocos2d::ParticleSystem();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::ParticleSystem>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::ParticleSystem"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_ParticleSystem_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::ParticleSystem *nobj = new (std::nothrow) cocos2d::ParticleSystem();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::ParticleSystem");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_Node_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_ParticleSystem(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_ParticleSystem_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_ParticleSystem_class->name = "ParticleSystem";
|
|
jsb_cocos2d_ParticleSystem_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_ParticleSystem_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_ParticleSystem_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_ParticleSystem_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_ParticleSystem_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_ParticleSystem_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_ParticleSystem_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_ParticleSystem_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("getStartSizeVar", js_cocos2dx_ParticleSystem_getStartSizeVar, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getTexture", js_cocos2dx_ParticleSystem_getTexture, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("isFull", js_cocos2dx_ParticleSystem_isFull, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getBatchNode", js_cocos2dx_ParticleSystem_getBatchNode, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getStartColor", js_cocos2dx_ParticleSystem_getStartColor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getPositionType", js_cocos2dx_ParticleSystem_getPositionType, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setPosVar", js_cocos2dx_ParticleSystem_setPosVar, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getEndSpin", js_cocos2dx_ParticleSystem_getEndSpin, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setRotatePerSecondVar", js_cocos2dx_ParticleSystem_setRotatePerSecondVar, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getStartSpinVar", js_cocos2dx_ParticleSystem_getStartSpinVar, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getRadialAccelVar", js_cocos2dx_ParticleSystem_getRadialAccelVar, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getEndSizeVar", js_cocos2dx_ParticleSystem_getEndSizeVar, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setTangentialAccel", js_cocos2dx_ParticleSystem_setTangentialAccel, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getRadialAccel", js_cocos2dx_ParticleSystem_getRadialAccel, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setStartRadius", js_cocos2dx_ParticleSystem_setStartRadius, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setRotatePerSecond", js_cocos2dx_ParticleSystem_setRotatePerSecond, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setEndSize", js_cocos2dx_ParticleSystem_setEndSize, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getGravity", js_cocos2dx_ParticleSystem_getGravity, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("resumeEmissions", js_cocos2dx_ParticleSystem_resumeEmissions, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getTangentialAccel", js_cocos2dx_ParticleSystem_getTangentialAccel, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setEndRadius", js_cocos2dx_ParticleSystem_setEndRadius, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getSpeed", js_cocos2dx_ParticleSystem_getSpeed, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("pauseEmissions", js_cocos2dx_ParticleSystem_pauseEmissions, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getAngle", js_cocos2dx_ParticleSystem_getAngle, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setEndColor", js_cocos2dx_ParticleSystem_setEndColor, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setStartSpin", js_cocos2dx_ParticleSystem_setStartSpin, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setDuration", js_cocos2dx_ParticleSystem_setDuration, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initWithTotalParticles", js_cocos2dx_ParticleSystem_initWithTotalParticles, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("addParticles", js_cocos2dx_ParticleSystem_addParticles, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setTexture", js_cocos2dx_ParticleSystem_setTexture, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getPosVar", js_cocos2dx_ParticleSystem_getPosVar, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("updateWithNoTime", js_cocos2dx_ParticleSystem_updateWithNoTime, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("isBlendAdditive", js_cocos2dx_ParticleSystem_isBlendAdditive, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getSpeedVar", js_cocos2dx_ParticleSystem_getSpeedVar, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setPositionType", js_cocos2dx_ParticleSystem_setPositionType, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("stopSystem", js_cocos2dx_ParticleSystem_stopSystem, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getSourcePosition", js_cocos2dx_ParticleSystem_getSourcePosition, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setLifeVar", js_cocos2dx_ParticleSystem_setLifeVar, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setTotalParticles", js_cocos2dx_ParticleSystem_setTotalParticles, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setEndColorVar", js_cocos2dx_ParticleSystem_setEndColorVar, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getAtlasIndex", js_cocos2dx_ParticleSystem_getAtlasIndex, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getStartSize", js_cocos2dx_ParticleSystem_getStartSize, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setStartSpinVar", js_cocos2dx_ParticleSystem_setStartSpinVar, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("resetSystem", js_cocos2dx_ParticleSystem_resetSystem, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setAtlasIndex", js_cocos2dx_ParticleSystem_setAtlasIndex, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setTangentialAccelVar", js_cocos2dx_ParticleSystem_setTangentialAccelVar, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setEndRadiusVar", js_cocos2dx_ParticleSystem_setEndRadiusVar, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getEndRadius", js_cocos2dx_ParticleSystem_getEndRadius, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("isActive", js_cocos2dx_ParticleSystem_isActive, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setRadialAccelVar", js_cocos2dx_ParticleSystem_setRadialAccelVar, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setStartSize", js_cocos2dx_ParticleSystem_setStartSize, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setSpeed", js_cocos2dx_ParticleSystem_setSpeed, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getStartSpin", js_cocos2dx_ParticleSystem_getStartSpin, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getResourceFile", js_cocos2dx_ParticleSystem_getResourceFile, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getRotatePerSecond", js_cocos2dx_ParticleSystem_getRotatePerSecond, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setEmitterMode", js_cocos2dx_ParticleSystem_setEmitterMode, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getDuration", js_cocos2dx_ParticleSystem_getDuration, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setSourcePosition", js_cocos2dx_ParticleSystem_setSourcePosition, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("stop", js_cocos2dx_ParticleSystem_stop, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("updateParticleQuads", js_cocos2dx_ParticleSystem_updateParticleQuads, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getEndSpinVar", js_cocos2dx_ParticleSystem_getEndSpinVar, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setBlendAdditive", js_cocos2dx_ParticleSystem_setBlendAdditive, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setLife", js_cocos2dx_ParticleSystem_setLife, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setAngleVar", js_cocos2dx_ParticleSystem_setAngleVar, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setRotationIsDir", js_cocos2dx_ParticleSystem_setRotationIsDir, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("start", js_cocos2dx_ParticleSystem_start, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setEndSizeVar", js_cocos2dx_ParticleSystem_setEndSizeVar, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setAngle", js_cocos2dx_ParticleSystem_setAngle, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setBatchNode", js_cocos2dx_ParticleSystem_setBatchNode, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getTangentialAccelVar", js_cocos2dx_ParticleSystem_getTangentialAccelVar, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getEmitterMode", js_cocos2dx_ParticleSystem_getEmitterMode, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setEndSpinVar", js_cocos2dx_ParticleSystem_setEndSpinVar, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initWithFile", js_cocos2dx_ParticleSystem_initWithFile, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getAngleVar", js_cocos2dx_ParticleSystem_getAngleVar, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setStartColor", js_cocos2dx_ParticleSystem_setStartColor, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getRotatePerSecondVar", js_cocos2dx_ParticleSystem_getRotatePerSecondVar, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getEndSize", js_cocos2dx_ParticleSystem_getEndSize, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getLife", js_cocos2dx_ParticleSystem_getLife, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("isPaused", js_cocos2dx_ParticleSystem_isPaused, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setSpeedVar", js_cocos2dx_ParticleSystem_setSpeedVar, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setAutoRemoveOnFinish", js_cocos2dx_ParticleSystem_setAutoRemoveOnFinish, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setGravity", js_cocos2dx_ParticleSystem_setGravity, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("postStep", js_cocos2dx_ParticleSystem_postStep, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setEmissionRate", js_cocos2dx_ParticleSystem_setEmissionRate, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getEndColorVar", js_cocos2dx_ParticleSystem_getEndColorVar, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getRotationIsDir", js_cocos2dx_ParticleSystem_getRotationIsDir, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getEmissionRate", js_cocos2dx_ParticleSystem_getEmissionRate, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getEndColor", js_cocos2dx_ParticleSystem_getEndColor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getLifeVar", js_cocos2dx_ParticleSystem_getLifeVar, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setStartSizeVar", js_cocos2dx_ParticleSystem_setStartSizeVar, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getStartRadius", js_cocos2dx_ParticleSystem_getStartRadius, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getParticleCount", js_cocos2dx_ParticleSystem_getParticleCount, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getStartRadiusVar", js_cocos2dx_ParticleSystem_getStartRadiusVar, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getBlendFunc", js_cocos2dx_ParticleSystem_getBlendFunc, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setStartColorVar", js_cocos2dx_ParticleSystem_setStartColorVar, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setEndSpin", js_cocos2dx_ParticleSystem_setEndSpin, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setRadialAccel", js_cocos2dx_ParticleSystem_setRadialAccel, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initWithDictionary", js_cocos2dx_ParticleSystem_initWithDictionary, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("isAutoRemoveOnFinish", js_cocos2dx_ParticleSystem_isAutoRemoveOnFinish, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getTotalParticles", js_cocos2dx_ParticleSystem_getTotalParticles, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setStartRadiusVar", js_cocos2dx_ParticleSystem_setStartRadiusVar, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setBlendFunc", js_cocos2dx_ParticleSystem_setBlendFunc, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getEndRadiusVar", js_cocos2dx_ParticleSystem_getEndRadiusVar, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getStartColorVar", js_cocos2dx_ParticleSystem_getStartColorVar, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_ParticleSystem_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_ParticleSystem_create, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("createWithTotalParticles", js_cocos2dx_ParticleSystem_createWithTotalParticles, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_Node_prototype);
|
|
jsb_cocos2d_ParticleSystem_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_ParticleSystem_class,
|
|
js_cocos2dx_ParticleSystem_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_ParticleSystem_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "ParticleSystem"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::ParticleSystem>(cx, jsb_cocos2d_ParticleSystem_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.ParticleSystem.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_ParticleSystemQuad_class;
|
|
JSObject *jsb_cocos2d_ParticleSystemQuad_prototype;
|
|
|
|
bool js_cocos2dx_ParticleSystemQuad_setDisplayFrame(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystemQuad* cobj = (cocos2d::ParticleSystemQuad *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystemQuad_setDisplayFrame : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::SpriteFrame* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::SpriteFrame*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystemQuad_setDisplayFrame : Error processing arguments");
|
|
cobj->setDisplayFrame(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystemQuad_setDisplayFrame : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystemQuad_setTextureWithRect(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystemQuad* cobj = (cocos2d::ParticleSystemQuad *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystemQuad_setTextureWithRect : Invalid Native Object");
|
|
if (argc == 2) {
|
|
cocos2d::Texture2D* arg0 = nullptr;
|
|
cocos2d::Rect arg1;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Texture2D*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
ok &= jsval_to_ccrect(cx, args.get(1), &arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystemQuad_setTextureWithRect : Error processing arguments");
|
|
cobj->setTextureWithRect(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystemQuad_setTextureWithRect : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystemQuad_listenRendererRecreated(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSystemQuad* cobj = (cocos2d::ParticleSystemQuad *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSystemQuad_listenRendererRecreated : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::EventCustom* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::EventCustom*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystemQuad_listenRendererRecreated : Error processing arguments");
|
|
cobj->listenRendererRecreated(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystemQuad_listenRendererRecreated : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystemQuad_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
|
|
do {
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::ParticleSystemQuad* ret = cocos2d::ParticleSystemQuad::create(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::ParticleSystemQuad>(cx, (cocos2d::ParticleSystemQuad*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
|
|
do {
|
|
if (argc == 0) {
|
|
cocos2d::ParticleSystemQuad* ret = cocos2d::ParticleSystemQuad::create();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::ParticleSystemQuad>(cx, (cocos2d::ParticleSystemQuad*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
|
|
do {
|
|
if (argc == 1) {
|
|
cocos2d::ValueMap arg0;
|
|
ok &= jsval_to_ccvaluemap(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::ParticleSystemQuad* ret = cocos2d::ParticleSystemQuad::create(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::ParticleSystemQuad>(cx, (cocos2d::ParticleSystemQuad*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystemQuad_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSystemQuad_createWithTotalParticles(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSystemQuad_createWithTotalParticles : Error processing arguments");
|
|
|
|
auto ret = cocos2d::ParticleSystemQuad::createWithTotalParticles(arg0);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::ParticleSystemQuad>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::ParticleSystemQuad"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSystemQuad_createWithTotalParticles : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_ParticleSystemQuad_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::ParticleSystemQuad* cobj = new (std::nothrow) cocos2d::ParticleSystemQuad();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::ParticleSystemQuad>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::ParticleSystemQuad"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_ParticleSystem_prototype;
|
|
|
|
void js_register_cocos2dx_ParticleSystemQuad(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_ParticleSystemQuad_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_ParticleSystemQuad_class->name = "ParticleSystem";
|
|
jsb_cocos2d_ParticleSystemQuad_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_ParticleSystemQuad_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_ParticleSystemQuad_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_ParticleSystemQuad_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_ParticleSystemQuad_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_ParticleSystemQuad_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_ParticleSystemQuad_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_ParticleSystemQuad_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("setDisplayFrame", js_cocos2dx_ParticleSystemQuad_setDisplayFrame, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setTextureWithRect", js_cocos2dx_ParticleSystemQuad_setTextureWithRect, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("listenRendererRecreated", js_cocos2dx_ParticleSystemQuad_listenRendererRecreated, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_ParticleSystemQuad_create, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("createWithTotalParticles", js_cocos2dx_ParticleSystemQuad_createWithTotalParticles, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_ParticleSystem_prototype);
|
|
jsb_cocos2d_ParticleSystemQuad_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_ParticleSystemQuad_class,
|
|
js_cocos2dx_ParticleSystemQuad_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_ParticleSystemQuad_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "ParticleSystemQuad"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::ParticleSystemQuad>(cx, jsb_cocos2d_ParticleSystemQuad_class, proto, parent_proto);
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_ParticleFire_class;
|
|
JSObject *jsb_cocos2d_ParticleFire_prototype;
|
|
|
|
bool js_cocos2dx_ParticleFire_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
if (argc == 0) {
|
|
|
|
auto ret = cocos2d::ParticleFire::create();
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::ParticleFire>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::ParticleFire"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleFire_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_ParticleFire_createWithTotalParticles(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleFire_createWithTotalParticles : Error processing arguments");
|
|
|
|
auto ret = cocos2d::ParticleFire::createWithTotalParticles(arg0);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::ParticleFire>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::ParticleFire"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleFire_createWithTotalParticles : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_ParticleFire_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::ParticleFire* cobj = new (std::nothrow) cocos2d::ParticleFire();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::ParticleFire>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::ParticleFire"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_ParticleSystemQuad_prototype;
|
|
|
|
void js_register_cocos2dx_ParticleFire(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_ParticleFire_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_ParticleFire_class->name = "ParticleFire";
|
|
jsb_cocos2d_ParticleFire_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_ParticleFire_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_ParticleFire_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_ParticleFire_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_ParticleFire_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_ParticleFire_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_ParticleFire_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_ParticleFire_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_ParticleFire_create, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("createWithTotalParticles", js_cocos2dx_ParticleFire_createWithTotalParticles, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_ParticleSystemQuad_prototype);
|
|
jsb_cocos2d_ParticleFire_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_ParticleFire_class,
|
|
js_cocos2dx_ParticleFire_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_ParticleFire_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "ParticleFire"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::ParticleFire>(cx, jsb_cocos2d_ParticleFire_class, proto, parent_proto);
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_ParticleFireworks_class;
|
|
JSObject *jsb_cocos2d_ParticleFireworks_prototype;
|
|
|
|
bool js_cocos2dx_ParticleFireworks_init(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleFireworks* cobj = (cocos2d::ParticleFireworks *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleFireworks_init : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->init();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleFireworks_init : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleFireworks_initWithTotalParticles(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleFireworks* cobj = (cocos2d::ParticleFireworks *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleFireworks_initWithTotalParticles : Invalid Native Object");
|
|
if (argc == 1) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleFireworks_initWithTotalParticles : Error processing arguments");
|
|
bool ret = cobj->initWithTotalParticles(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleFireworks_initWithTotalParticles : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleFireworks_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
if (argc == 0) {
|
|
|
|
auto ret = cocos2d::ParticleFireworks::create();
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::ParticleFireworks>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::ParticleFireworks"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleFireworks_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_ParticleFireworks_createWithTotalParticles(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleFireworks_createWithTotalParticles : Error processing arguments");
|
|
|
|
auto ret = cocos2d::ParticleFireworks::createWithTotalParticles(arg0);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::ParticleFireworks>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::ParticleFireworks"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleFireworks_createWithTotalParticles : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_ParticleFireworks_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::ParticleFireworks* cobj = new (std::nothrow) cocos2d::ParticleFireworks();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::ParticleFireworks>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::ParticleFireworks"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_ParticleSystemQuad_prototype;
|
|
|
|
void js_register_cocos2dx_ParticleFireworks(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_ParticleFireworks_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_ParticleFireworks_class->name = "ParticleFireworks";
|
|
jsb_cocos2d_ParticleFireworks_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_ParticleFireworks_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_ParticleFireworks_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_ParticleFireworks_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_ParticleFireworks_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_ParticleFireworks_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_ParticleFireworks_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_ParticleFireworks_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("init", js_cocos2dx_ParticleFireworks_init, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initWithTotalParticles", js_cocos2dx_ParticleFireworks_initWithTotalParticles, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_ParticleFireworks_create, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("createWithTotalParticles", js_cocos2dx_ParticleFireworks_createWithTotalParticles, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_ParticleSystemQuad_prototype);
|
|
jsb_cocos2d_ParticleFireworks_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_ParticleFireworks_class,
|
|
js_cocos2dx_ParticleFireworks_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_ParticleFireworks_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "ParticleFireworks"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::ParticleFireworks>(cx, jsb_cocos2d_ParticleFireworks_class, proto, parent_proto);
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_ParticleSun_class;
|
|
JSObject *jsb_cocos2d_ParticleSun_prototype;
|
|
|
|
bool js_cocos2dx_ParticleSun_init(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSun* cobj = (cocos2d::ParticleSun *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSun_init : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->init();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSun_init : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSun_initWithTotalParticles(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSun* cobj = (cocos2d::ParticleSun *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSun_initWithTotalParticles : Invalid Native Object");
|
|
if (argc == 1) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSun_initWithTotalParticles : Error processing arguments");
|
|
bool ret = cobj->initWithTotalParticles(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSun_initWithTotalParticles : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSun_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
if (argc == 0) {
|
|
|
|
auto ret = cocos2d::ParticleSun::create();
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::ParticleSun>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::ParticleSun"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSun_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_ParticleSun_createWithTotalParticles(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSun_createWithTotalParticles : Error processing arguments");
|
|
|
|
auto ret = cocos2d::ParticleSun::createWithTotalParticles(arg0);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::ParticleSun>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::ParticleSun"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSun_createWithTotalParticles : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_ParticleSun_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::ParticleSun* cobj = new (std::nothrow) cocos2d::ParticleSun();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::ParticleSun>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::ParticleSun"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_ParticleSystemQuad_prototype;
|
|
|
|
void js_register_cocos2dx_ParticleSun(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_ParticleSun_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_ParticleSun_class->name = "ParticleSun";
|
|
jsb_cocos2d_ParticleSun_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_ParticleSun_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_ParticleSun_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_ParticleSun_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_ParticleSun_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_ParticleSun_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_ParticleSun_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_ParticleSun_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("init", js_cocos2dx_ParticleSun_init, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initWithTotalParticles", js_cocos2dx_ParticleSun_initWithTotalParticles, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_ParticleSun_create, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("createWithTotalParticles", js_cocos2dx_ParticleSun_createWithTotalParticles, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_ParticleSystemQuad_prototype);
|
|
jsb_cocos2d_ParticleSun_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_ParticleSun_class,
|
|
js_cocos2dx_ParticleSun_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_ParticleSun_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "ParticleSun"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::ParticleSun>(cx, jsb_cocos2d_ParticleSun_class, proto, parent_proto);
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_ParticleGalaxy_class;
|
|
JSObject *jsb_cocos2d_ParticleGalaxy_prototype;
|
|
|
|
bool js_cocos2dx_ParticleGalaxy_init(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleGalaxy* cobj = (cocos2d::ParticleGalaxy *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleGalaxy_init : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->init();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleGalaxy_init : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleGalaxy_initWithTotalParticles(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleGalaxy* cobj = (cocos2d::ParticleGalaxy *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleGalaxy_initWithTotalParticles : Invalid Native Object");
|
|
if (argc == 1) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleGalaxy_initWithTotalParticles : Error processing arguments");
|
|
bool ret = cobj->initWithTotalParticles(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleGalaxy_initWithTotalParticles : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleGalaxy_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
if (argc == 0) {
|
|
|
|
auto ret = cocos2d::ParticleGalaxy::create();
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::ParticleGalaxy>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::ParticleGalaxy"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleGalaxy_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_ParticleGalaxy_createWithTotalParticles(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleGalaxy_createWithTotalParticles : Error processing arguments");
|
|
|
|
auto ret = cocos2d::ParticleGalaxy::createWithTotalParticles(arg0);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::ParticleGalaxy>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::ParticleGalaxy"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleGalaxy_createWithTotalParticles : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_ParticleGalaxy_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::ParticleGalaxy* cobj = new (std::nothrow) cocos2d::ParticleGalaxy();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::ParticleGalaxy>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::ParticleGalaxy"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_ParticleSystemQuad_prototype;
|
|
|
|
void js_register_cocos2dx_ParticleGalaxy(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_ParticleGalaxy_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_ParticleGalaxy_class->name = "ParticleGalaxy";
|
|
jsb_cocos2d_ParticleGalaxy_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_ParticleGalaxy_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_ParticleGalaxy_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_ParticleGalaxy_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_ParticleGalaxy_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_ParticleGalaxy_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_ParticleGalaxy_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_ParticleGalaxy_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("init", js_cocos2dx_ParticleGalaxy_init, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initWithTotalParticles", js_cocos2dx_ParticleGalaxy_initWithTotalParticles, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_ParticleGalaxy_create, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("createWithTotalParticles", js_cocos2dx_ParticleGalaxy_createWithTotalParticles, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_ParticleSystemQuad_prototype);
|
|
jsb_cocos2d_ParticleGalaxy_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_ParticleGalaxy_class,
|
|
js_cocos2dx_ParticleGalaxy_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_ParticleGalaxy_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "ParticleGalaxy"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::ParticleGalaxy>(cx, jsb_cocos2d_ParticleGalaxy_class, proto, parent_proto);
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_ParticleFlower_class;
|
|
JSObject *jsb_cocos2d_ParticleFlower_prototype;
|
|
|
|
bool js_cocos2dx_ParticleFlower_init(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleFlower* cobj = (cocos2d::ParticleFlower *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleFlower_init : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->init();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleFlower_init : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleFlower_initWithTotalParticles(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleFlower* cobj = (cocos2d::ParticleFlower *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleFlower_initWithTotalParticles : Invalid Native Object");
|
|
if (argc == 1) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleFlower_initWithTotalParticles : Error processing arguments");
|
|
bool ret = cobj->initWithTotalParticles(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleFlower_initWithTotalParticles : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleFlower_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
if (argc == 0) {
|
|
|
|
auto ret = cocos2d::ParticleFlower::create();
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::ParticleFlower>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::ParticleFlower"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleFlower_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_ParticleFlower_createWithTotalParticles(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleFlower_createWithTotalParticles : Error processing arguments");
|
|
|
|
auto ret = cocos2d::ParticleFlower::createWithTotalParticles(arg0);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::ParticleFlower>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::ParticleFlower"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleFlower_createWithTotalParticles : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_ParticleFlower_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::ParticleFlower* cobj = new (std::nothrow) cocos2d::ParticleFlower();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::ParticleFlower>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::ParticleFlower"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_ParticleSystemQuad_prototype;
|
|
|
|
void js_register_cocos2dx_ParticleFlower(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_ParticleFlower_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_ParticleFlower_class->name = "ParticleFlower";
|
|
jsb_cocos2d_ParticleFlower_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_ParticleFlower_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_ParticleFlower_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_ParticleFlower_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_ParticleFlower_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_ParticleFlower_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_ParticleFlower_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_ParticleFlower_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("init", js_cocos2dx_ParticleFlower_init, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initWithTotalParticles", js_cocos2dx_ParticleFlower_initWithTotalParticles, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_ParticleFlower_create, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("createWithTotalParticles", js_cocos2dx_ParticleFlower_createWithTotalParticles, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_ParticleSystemQuad_prototype);
|
|
jsb_cocos2d_ParticleFlower_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_ParticleFlower_class,
|
|
js_cocos2dx_ParticleFlower_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_ParticleFlower_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "ParticleFlower"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::ParticleFlower>(cx, jsb_cocos2d_ParticleFlower_class, proto, parent_proto);
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_ParticleMeteor_class;
|
|
JSObject *jsb_cocos2d_ParticleMeteor_prototype;
|
|
|
|
bool js_cocos2dx_ParticleMeteor_init(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleMeteor* cobj = (cocos2d::ParticleMeteor *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleMeteor_init : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->init();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleMeteor_init : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleMeteor_initWithTotalParticles(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleMeteor* cobj = (cocos2d::ParticleMeteor *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleMeteor_initWithTotalParticles : Invalid Native Object");
|
|
if (argc == 1) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleMeteor_initWithTotalParticles : Error processing arguments");
|
|
bool ret = cobj->initWithTotalParticles(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleMeteor_initWithTotalParticles : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleMeteor_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
if (argc == 0) {
|
|
|
|
auto ret = cocos2d::ParticleMeteor::create();
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::ParticleMeteor>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::ParticleMeteor"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleMeteor_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_ParticleMeteor_createWithTotalParticles(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleMeteor_createWithTotalParticles : Error processing arguments");
|
|
|
|
auto ret = cocos2d::ParticleMeteor::createWithTotalParticles(arg0);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::ParticleMeteor>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::ParticleMeteor"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleMeteor_createWithTotalParticles : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_ParticleMeteor_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::ParticleMeteor* cobj = new (std::nothrow) cocos2d::ParticleMeteor();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::ParticleMeteor>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::ParticleMeteor"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_ParticleSystemQuad_prototype;
|
|
|
|
void js_register_cocos2dx_ParticleMeteor(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_ParticleMeteor_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_ParticleMeteor_class->name = "ParticleMeteor";
|
|
jsb_cocos2d_ParticleMeteor_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_ParticleMeteor_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_ParticleMeteor_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_ParticleMeteor_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_ParticleMeteor_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_ParticleMeteor_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_ParticleMeteor_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_ParticleMeteor_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("init", js_cocos2dx_ParticleMeteor_init, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initWithTotalParticles", js_cocos2dx_ParticleMeteor_initWithTotalParticles, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_ParticleMeteor_create, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("createWithTotalParticles", js_cocos2dx_ParticleMeteor_createWithTotalParticles, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_ParticleSystemQuad_prototype);
|
|
jsb_cocos2d_ParticleMeteor_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_ParticleMeteor_class,
|
|
js_cocos2dx_ParticleMeteor_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_ParticleMeteor_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "ParticleMeteor"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::ParticleMeteor>(cx, jsb_cocos2d_ParticleMeteor_class, proto, parent_proto);
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_ParticleSpiral_class;
|
|
JSObject *jsb_cocos2d_ParticleSpiral_prototype;
|
|
|
|
bool js_cocos2dx_ParticleSpiral_init(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSpiral* cobj = (cocos2d::ParticleSpiral *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSpiral_init : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->init();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSpiral_init : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSpiral_initWithTotalParticles(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSpiral* cobj = (cocos2d::ParticleSpiral *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSpiral_initWithTotalParticles : Invalid Native Object");
|
|
if (argc == 1) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSpiral_initWithTotalParticles : Error processing arguments");
|
|
bool ret = cobj->initWithTotalParticles(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSpiral_initWithTotalParticles : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSpiral_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
if (argc == 0) {
|
|
|
|
auto ret = cocos2d::ParticleSpiral::create();
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::ParticleSpiral>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::ParticleSpiral"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSpiral_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_ParticleSpiral_createWithTotalParticles(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSpiral_createWithTotalParticles : Error processing arguments");
|
|
|
|
auto ret = cocos2d::ParticleSpiral::createWithTotalParticles(arg0);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::ParticleSpiral>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::ParticleSpiral"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSpiral_createWithTotalParticles : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_ParticleSpiral_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::ParticleSpiral* cobj = new (std::nothrow) cocos2d::ParticleSpiral();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::ParticleSpiral>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::ParticleSpiral"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_ParticleSystemQuad_prototype;
|
|
|
|
void js_register_cocos2dx_ParticleSpiral(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_ParticleSpiral_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_ParticleSpiral_class->name = "ParticleSpiral";
|
|
jsb_cocos2d_ParticleSpiral_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_ParticleSpiral_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_ParticleSpiral_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_ParticleSpiral_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_ParticleSpiral_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_ParticleSpiral_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_ParticleSpiral_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_ParticleSpiral_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("init", js_cocos2dx_ParticleSpiral_init, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initWithTotalParticles", js_cocos2dx_ParticleSpiral_initWithTotalParticles, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_ParticleSpiral_create, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("createWithTotalParticles", js_cocos2dx_ParticleSpiral_createWithTotalParticles, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_ParticleSystemQuad_prototype);
|
|
jsb_cocos2d_ParticleSpiral_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_ParticleSpiral_class,
|
|
js_cocos2dx_ParticleSpiral_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_ParticleSpiral_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "ParticleSpiral"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::ParticleSpiral>(cx, jsb_cocos2d_ParticleSpiral_class, proto, parent_proto);
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_ParticleExplosion_class;
|
|
JSObject *jsb_cocos2d_ParticleExplosion_prototype;
|
|
|
|
bool js_cocos2dx_ParticleExplosion_init(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleExplosion* cobj = (cocos2d::ParticleExplosion *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleExplosion_init : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->init();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleExplosion_init : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleExplosion_initWithTotalParticles(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleExplosion* cobj = (cocos2d::ParticleExplosion *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleExplosion_initWithTotalParticles : Invalid Native Object");
|
|
if (argc == 1) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleExplosion_initWithTotalParticles : Error processing arguments");
|
|
bool ret = cobj->initWithTotalParticles(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleExplosion_initWithTotalParticles : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleExplosion_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
if (argc == 0) {
|
|
|
|
auto ret = cocos2d::ParticleExplosion::create();
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::ParticleExplosion>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::ParticleExplosion"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleExplosion_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_ParticleExplosion_createWithTotalParticles(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleExplosion_createWithTotalParticles : Error processing arguments");
|
|
|
|
auto ret = cocos2d::ParticleExplosion::createWithTotalParticles(arg0);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::ParticleExplosion>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::ParticleExplosion"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleExplosion_createWithTotalParticles : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_ParticleExplosion_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::ParticleExplosion* cobj = new (std::nothrow) cocos2d::ParticleExplosion();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::ParticleExplosion>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::ParticleExplosion"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_ParticleSystemQuad_prototype;
|
|
|
|
void js_register_cocos2dx_ParticleExplosion(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_ParticleExplosion_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_ParticleExplosion_class->name = "ParticleExplosion";
|
|
jsb_cocos2d_ParticleExplosion_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_ParticleExplosion_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_ParticleExplosion_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_ParticleExplosion_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_ParticleExplosion_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_ParticleExplosion_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_ParticleExplosion_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_ParticleExplosion_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("init", js_cocos2dx_ParticleExplosion_init, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initWithTotalParticles", js_cocos2dx_ParticleExplosion_initWithTotalParticles, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_ParticleExplosion_create, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("createWithTotalParticles", js_cocos2dx_ParticleExplosion_createWithTotalParticles, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_ParticleSystemQuad_prototype);
|
|
jsb_cocos2d_ParticleExplosion_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_ParticleExplosion_class,
|
|
js_cocos2dx_ParticleExplosion_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_ParticleExplosion_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "ParticleExplosion"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::ParticleExplosion>(cx, jsb_cocos2d_ParticleExplosion_class, proto, parent_proto);
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_ParticleSmoke_class;
|
|
JSObject *jsb_cocos2d_ParticleSmoke_prototype;
|
|
|
|
bool js_cocos2dx_ParticleSmoke_init(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSmoke* cobj = (cocos2d::ParticleSmoke *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSmoke_init : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->init();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSmoke_init : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSmoke_initWithTotalParticles(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSmoke* cobj = (cocos2d::ParticleSmoke *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSmoke_initWithTotalParticles : Invalid Native Object");
|
|
if (argc == 1) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSmoke_initWithTotalParticles : Error processing arguments");
|
|
bool ret = cobj->initWithTotalParticles(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSmoke_initWithTotalParticles : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSmoke_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
if (argc == 0) {
|
|
|
|
auto ret = cocos2d::ParticleSmoke::create();
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::ParticleSmoke>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::ParticleSmoke"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSmoke_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_ParticleSmoke_createWithTotalParticles(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSmoke_createWithTotalParticles : Error processing arguments");
|
|
|
|
auto ret = cocos2d::ParticleSmoke::createWithTotalParticles(arg0);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::ParticleSmoke>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::ParticleSmoke"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSmoke_createWithTotalParticles : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_ParticleSmoke_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::ParticleSmoke* cobj = new (std::nothrow) cocos2d::ParticleSmoke();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::ParticleSmoke>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::ParticleSmoke"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_ParticleSystemQuad_prototype;
|
|
|
|
void js_register_cocos2dx_ParticleSmoke(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_ParticleSmoke_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_ParticleSmoke_class->name = "ParticleSmoke";
|
|
jsb_cocos2d_ParticleSmoke_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_ParticleSmoke_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_ParticleSmoke_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_ParticleSmoke_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_ParticleSmoke_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_ParticleSmoke_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_ParticleSmoke_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_ParticleSmoke_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("init", js_cocos2dx_ParticleSmoke_init, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initWithTotalParticles", js_cocos2dx_ParticleSmoke_initWithTotalParticles, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_ParticleSmoke_create, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("createWithTotalParticles", js_cocos2dx_ParticleSmoke_createWithTotalParticles, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_ParticleSystemQuad_prototype);
|
|
jsb_cocos2d_ParticleSmoke_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_ParticleSmoke_class,
|
|
js_cocos2dx_ParticleSmoke_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_ParticleSmoke_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "ParticleSmoke"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::ParticleSmoke>(cx, jsb_cocos2d_ParticleSmoke_class, proto, parent_proto);
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_ParticleSnow_class;
|
|
JSObject *jsb_cocos2d_ParticleSnow_prototype;
|
|
|
|
bool js_cocos2dx_ParticleSnow_init(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSnow* cobj = (cocos2d::ParticleSnow *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSnow_init : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->init();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSnow_init : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSnow_initWithTotalParticles(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleSnow* cobj = (cocos2d::ParticleSnow *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleSnow_initWithTotalParticles : Invalid Native Object");
|
|
if (argc == 1) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSnow_initWithTotalParticles : Error processing arguments");
|
|
bool ret = cobj->initWithTotalParticles(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSnow_initWithTotalParticles : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleSnow_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
if (argc == 0) {
|
|
|
|
auto ret = cocos2d::ParticleSnow::create();
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::ParticleSnow>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::ParticleSnow"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSnow_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_ParticleSnow_createWithTotalParticles(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleSnow_createWithTotalParticles : Error processing arguments");
|
|
|
|
auto ret = cocos2d::ParticleSnow::createWithTotalParticles(arg0);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::ParticleSnow>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::ParticleSnow"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleSnow_createWithTotalParticles : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_ParticleSnow_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::ParticleSnow* cobj = new (std::nothrow) cocos2d::ParticleSnow();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::ParticleSnow>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::ParticleSnow"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_ParticleSystemQuad_prototype;
|
|
|
|
void js_register_cocos2dx_ParticleSnow(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_ParticleSnow_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_ParticleSnow_class->name = "ParticleSnow";
|
|
jsb_cocos2d_ParticleSnow_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_ParticleSnow_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_ParticleSnow_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_ParticleSnow_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_ParticleSnow_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_ParticleSnow_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_ParticleSnow_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_ParticleSnow_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("init", js_cocos2dx_ParticleSnow_init, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initWithTotalParticles", js_cocos2dx_ParticleSnow_initWithTotalParticles, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_ParticleSnow_create, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("createWithTotalParticles", js_cocos2dx_ParticleSnow_createWithTotalParticles, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_ParticleSystemQuad_prototype);
|
|
jsb_cocos2d_ParticleSnow_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_ParticleSnow_class,
|
|
js_cocos2dx_ParticleSnow_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_ParticleSnow_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "ParticleSnow"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::ParticleSnow>(cx, jsb_cocos2d_ParticleSnow_class, proto, parent_proto);
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_ParticleRain_class;
|
|
JSObject *jsb_cocos2d_ParticleRain_prototype;
|
|
|
|
bool js_cocos2dx_ParticleRain_init(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleRain* cobj = (cocos2d::ParticleRain *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleRain_init : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->init();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleRain_init : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleRain_initWithTotalParticles(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParticleRain* cobj = (cocos2d::ParticleRain *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParticleRain_initWithTotalParticles : Invalid Native Object");
|
|
if (argc == 1) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleRain_initWithTotalParticles : Error processing arguments");
|
|
bool ret = cobj->initWithTotalParticles(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleRain_initWithTotalParticles : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParticleRain_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
if (argc == 0) {
|
|
|
|
auto ret = cocos2d::ParticleRain::create();
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::ParticleRain>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::ParticleRain"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleRain_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_ParticleRain_createWithTotalParticles(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParticleRain_createWithTotalParticles : Error processing arguments");
|
|
|
|
auto ret = cocos2d::ParticleRain::createWithTotalParticles(arg0);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::ParticleRain>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::ParticleRain"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_ParticleRain_createWithTotalParticles : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_ParticleRain_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::ParticleRain* cobj = new (std::nothrow) cocos2d::ParticleRain();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::ParticleRain>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::ParticleRain"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_ParticleSystemQuad_prototype;
|
|
|
|
void js_register_cocos2dx_ParticleRain(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_ParticleRain_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_ParticleRain_class->name = "ParticleRain";
|
|
jsb_cocos2d_ParticleRain_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_ParticleRain_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_ParticleRain_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_ParticleRain_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_ParticleRain_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_ParticleRain_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_ParticleRain_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_ParticleRain_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("init", js_cocos2dx_ParticleRain_init, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initWithTotalParticles", js_cocos2dx_ParticleRain_initWithTotalParticles, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_ParticleRain_create, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("createWithTotalParticles", js_cocos2dx_ParticleRain_createWithTotalParticles, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_ParticleSystemQuad_prototype);
|
|
jsb_cocos2d_ParticleRain_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_ParticleRain_class,
|
|
js_cocos2dx_ParticleRain_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_ParticleRain_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "ParticleRain"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::ParticleRain>(cx, jsb_cocos2d_ParticleRain_class, proto, parent_proto);
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_ProgressTimer_class;
|
|
JSObject *jsb_cocos2d_ProgressTimer_prototype;
|
|
|
|
bool js_cocos2dx_ProgressTimer_initWithSprite(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ProgressTimer* cobj = (cocos2d::ProgressTimer *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ProgressTimer_initWithSprite : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Sprite* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Sprite*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ProgressTimer_initWithSprite : Error processing arguments");
|
|
bool ret = cobj->initWithSprite(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ProgressTimer_initWithSprite : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ProgressTimer_isReverseDirection(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ProgressTimer* cobj = (cocos2d::ProgressTimer *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ProgressTimer_isReverseDirection : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->isReverseDirection();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ProgressTimer_isReverseDirection : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ProgressTimer_setBarChangeRate(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ProgressTimer* cobj = (cocos2d::ProgressTimer *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ProgressTimer_setBarChangeRate : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Vec2 arg0;
|
|
ok &= jsval_to_vector2(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ProgressTimer_setBarChangeRate : Error processing arguments");
|
|
cobj->setBarChangeRate(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ProgressTimer_setBarChangeRate : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ProgressTimer_getPercentage(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ProgressTimer* cobj = (cocos2d::ProgressTimer *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ProgressTimer_getPercentage : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getPercentage();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ProgressTimer_getPercentage : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ProgressTimer_setSprite(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ProgressTimer* cobj = (cocos2d::ProgressTimer *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ProgressTimer_setSprite : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Sprite* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Sprite*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ProgressTimer_setSprite : Error processing arguments");
|
|
cobj->setSprite(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ProgressTimer_setSprite : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ProgressTimer_getType(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ProgressTimer* cobj = (cocos2d::ProgressTimer *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ProgressTimer_getType : Invalid Native Object");
|
|
if (argc == 0) {
|
|
int ret = (int)cobj->getType();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = int32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ProgressTimer_getType : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ProgressTimer_getSprite(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ProgressTimer* cobj = (cocos2d::ProgressTimer *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ProgressTimer_getSprite : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::Sprite* ret = cobj->getSprite();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Sprite>(cx, (cocos2d::Sprite*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ProgressTimer_getSprite : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ProgressTimer_setMidpoint(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ProgressTimer* cobj = (cocos2d::ProgressTimer *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ProgressTimer_setMidpoint : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Vec2 arg0;
|
|
ok &= jsval_to_vector2(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ProgressTimer_setMidpoint : Error processing arguments");
|
|
cobj->setMidpoint(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ProgressTimer_setMidpoint : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ProgressTimer_getBarChangeRate(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ProgressTimer* cobj = (cocos2d::ProgressTimer *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ProgressTimer_getBarChangeRate : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::Vec2 ret = cobj->getBarChangeRate();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = vector2_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ProgressTimer_getBarChangeRate : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ProgressTimer_setReverseDirection(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ProgressTimer* cobj = (cocos2d::ProgressTimer *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ProgressTimer_setReverseDirection : Invalid Native Object");
|
|
if (argc == 1) {
|
|
bool arg0;
|
|
arg0 = JS::ToBoolean(args.get(0));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ProgressTimer_setReverseDirection : Error processing arguments");
|
|
cobj->setReverseDirection(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ProgressTimer_setReverseDirection : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ProgressTimer_getMidpoint(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ProgressTimer* cobj = (cocos2d::ProgressTimer *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ProgressTimer_getMidpoint : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::Vec2 ret = cobj->getMidpoint();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = vector2_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ProgressTimer_getMidpoint : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ProgressTimer_setPercentage(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ProgressTimer* cobj = (cocos2d::ProgressTimer *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ProgressTimer_setPercentage : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ProgressTimer_setPercentage : Error processing arguments");
|
|
cobj->setPercentage(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ProgressTimer_setPercentage : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ProgressTimer_setType(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ProgressTimer* cobj = (cocos2d::ProgressTimer *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ProgressTimer_setType : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::ProgressTimer::Type arg0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ProgressTimer_setType : Error processing arguments");
|
|
cobj->setType(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ProgressTimer_setType : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ProgressTimer_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
cocos2d::Sprite* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Sprite*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ProgressTimer_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::ProgressTimer::create(arg0);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::ProgressTimer>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::ProgressTimer"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_ProgressTimer_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_ProgressTimer_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::ProgressTimer* cobj = new (std::nothrow) cocos2d::ProgressTimer();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::ProgressTimer>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::ProgressTimer"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_ProgressTimer_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::ProgressTimer *nobj = new (std::nothrow) cocos2d::ProgressTimer();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::ProgressTimer");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_Node_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_ProgressTimer(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_ProgressTimer_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_ProgressTimer_class->name = "ProgressTimer";
|
|
jsb_cocos2d_ProgressTimer_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_ProgressTimer_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_ProgressTimer_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_ProgressTimer_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_ProgressTimer_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_ProgressTimer_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_ProgressTimer_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_ProgressTimer_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("initWithSprite", js_cocos2dx_ProgressTimer_initWithSprite, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("isReverseDirection", js_cocos2dx_ProgressTimer_isReverseDirection, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setBarChangeRate", js_cocos2dx_ProgressTimer_setBarChangeRate, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getPercentage", js_cocos2dx_ProgressTimer_getPercentage, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setSprite", js_cocos2dx_ProgressTimer_setSprite, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getType", js_cocos2dx_ProgressTimer_getType, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getSprite", js_cocos2dx_ProgressTimer_getSprite, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setMidpoint", js_cocos2dx_ProgressTimer_setMidpoint, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getBarChangeRate", js_cocos2dx_ProgressTimer_getBarChangeRate, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setReverseDirection", js_cocos2dx_ProgressTimer_setReverseDirection, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getMidpoint", js_cocos2dx_ProgressTimer_getMidpoint, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setPercentage", js_cocos2dx_ProgressTimer_setPercentage, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setType", js_cocos2dx_ProgressTimer_setType, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_ProgressTimer_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_ProgressTimer_create, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_Node_prototype);
|
|
jsb_cocos2d_ProgressTimer_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_ProgressTimer_class,
|
|
js_cocos2dx_ProgressTimer_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_ProgressTimer_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "ProgressTimer"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::ProgressTimer>(cx, jsb_cocos2d_ProgressTimer_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.ProgressTimer.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_ProtectedNode_class;
|
|
JSObject *jsb_cocos2d_ProtectedNode_prototype;
|
|
|
|
bool js_cocos2dx_ProtectedNode_addProtectedChild(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::ProtectedNode* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::ProtectedNode *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ProtectedNode_addProtectedChild : Invalid Native Object");
|
|
do {
|
|
if (argc == 2) {
|
|
cocos2d::Node* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
if (!ok) { ok = true; break; }
|
|
int arg1 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1);
|
|
if (!ok) { ok = true; break; }
|
|
cobj->addProtectedChild(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 1) {
|
|
cocos2d::Node* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
if (!ok) { ok = true; break; }
|
|
cobj->addProtectedChild(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 3) {
|
|
cocos2d::Node* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
if (!ok) { ok = true; break; }
|
|
int arg1 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1);
|
|
if (!ok) { ok = true; break; }
|
|
int arg2 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2);
|
|
if (!ok) { ok = true; break; }
|
|
cobj->addProtectedChild(arg0, arg1, arg2);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ProtectedNode_addProtectedChild : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ProtectedNode_disableCascadeColor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ProtectedNode* cobj = (cocos2d::ProtectedNode *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ProtectedNode_disableCascadeColor : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->disableCascadeColor();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ProtectedNode_disableCascadeColor : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ProtectedNode_removeProtectedChildByTag(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ProtectedNode* cobj = (cocos2d::ProtectedNode *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ProtectedNode_removeProtectedChildByTag : Invalid Native Object");
|
|
if (argc == 1) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ProtectedNode_removeProtectedChildByTag : Error processing arguments");
|
|
cobj->removeProtectedChildByTag(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
if (argc == 2) {
|
|
int arg0 = 0;
|
|
bool arg1;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
arg1 = JS::ToBoolean(args.get(1));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ProtectedNode_removeProtectedChildByTag : Error processing arguments");
|
|
cobj->removeProtectedChildByTag(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ProtectedNode_removeProtectedChildByTag : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ProtectedNode_reorderProtectedChild(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ProtectedNode* cobj = (cocos2d::ProtectedNode *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ProtectedNode_reorderProtectedChild : Invalid Native Object");
|
|
if (argc == 2) {
|
|
cocos2d::Node* arg0 = nullptr;
|
|
int arg1 = 0;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ProtectedNode_reorderProtectedChild : Error processing arguments");
|
|
cobj->reorderProtectedChild(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ProtectedNode_reorderProtectedChild : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ProtectedNode_removeAllProtectedChildrenWithCleanup(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ProtectedNode* cobj = (cocos2d::ProtectedNode *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ProtectedNode_removeAllProtectedChildrenWithCleanup : Invalid Native Object");
|
|
if (argc == 1) {
|
|
bool arg0;
|
|
arg0 = JS::ToBoolean(args.get(0));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ProtectedNode_removeAllProtectedChildrenWithCleanup : Error processing arguments");
|
|
cobj->removeAllProtectedChildrenWithCleanup(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ProtectedNode_removeAllProtectedChildrenWithCleanup : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ProtectedNode_disableCascadeOpacity(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ProtectedNode* cobj = (cocos2d::ProtectedNode *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ProtectedNode_disableCascadeOpacity : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->disableCascadeOpacity();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ProtectedNode_disableCascadeOpacity : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ProtectedNode_sortAllProtectedChildren(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ProtectedNode* cobj = (cocos2d::ProtectedNode *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ProtectedNode_sortAllProtectedChildren : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->sortAllProtectedChildren();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ProtectedNode_sortAllProtectedChildren : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ProtectedNode_getProtectedChildByTag(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ProtectedNode* cobj = (cocos2d::ProtectedNode *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ProtectedNode_getProtectedChildByTag : Invalid Native Object");
|
|
if (argc == 1) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ProtectedNode_getProtectedChildByTag : Error processing arguments");
|
|
cocos2d::Node* ret = cobj->getProtectedChildByTag(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Node>(cx, (cocos2d::Node*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ProtectedNode_getProtectedChildByTag : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ProtectedNode_removeProtectedChild(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ProtectedNode* cobj = (cocos2d::ProtectedNode *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ProtectedNode_removeProtectedChild : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Node* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ProtectedNode_removeProtectedChild : Error processing arguments");
|
|
cobj->removeProtectedChild(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
if (argc == 2) {
|
|
cocos2d::Node* arg0 = nullptr;
|
|
bool arg1;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
arg1 = JS::ToBoolean(args.get(1));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ProtectedNode_removeProtectedChild : Error processing arguments");
|
|
cobj->removeProtectedChild(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ProtectedNode_removeProtectedChild : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ProtectedNode_removeAllProtectedChildren(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ProtectedNode* cobj = (cocos2d::ProtectedNode *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ProtectedNode_removeAllProtectedChildren : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->removeAllProtectedChildren();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ProtectedNode_removeAllProtectedChildren : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ProtectedNode_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
if (argc == 0) {
|
|
|
|
auto ret = cocos2d::ProtectedNode::create();
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::ProtectedNode>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::ProtectedNode"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_ProtectedNode_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_ProtectedNode_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::ProtectedNode* cobj = new (std::nothrow) cocos2d::ProtectedNode();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::ProtectedNode>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::ProtectedNode"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_Node_prototype;
|
|
|
|
void js_register_cocos2dx_ProtectedNode(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_ProtectedNode_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_ProtectedNode_class->name = "ProtectedNode";
|
|
jsb_cocos2d_ProtectedNode_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_ProtectedNode_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_ProtectedNode_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_ProtectedNode_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_ProtectedNode_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_ProtectedNode_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_ProtectedNode_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_ProtectedNode_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("addProtectedChild", js_cocos2dx_ProtectedNode_addProtectedChild, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("disableCascadeColor", js_cocos2dx_ProtectedNode_disableCascadeColor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("removeProtectedChildByTag", js_cocos2dx_ProtectedNode_removeProtectedChildByTag, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("reorderProtectedChild", js_cocos2dx_ProtectedNode_reorderProtectedChild, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("removeAllProtectedChildrenWithCleanup", js_cocos2dx_ProtectedNode_removeAllProtectedChildrenWithCleanup, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("disableCascadeOpacity", js_cocos2dx_ProtectedNode_disableCascadeOpacity, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("sortAllProtectedChildren", js_cocos2dx_ProtectedNode_sortAllProtectedChildren, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getProtectedChildByTag", js_cocos2dx_ProtectedNode_getProtectedChildByTag, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("removeProtectedChild", js_cocos2dx_ProtectedNode_removeProtectedChild, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("removeAllProtectedChildren", js_cocos2dx_ProtectedNode_removeAllProtectedChildren, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_ProtectedNode_create, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_Node_prototype);
|
|
jsb_cocos2d_ProtectedNode_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_ProtectedNode_class,
|
|
js_cocos2dx_ProtectedNode_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_ProtectedNode_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "ProtectedNode"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::ProtectedNode>(cx, jsb_cocos2d_ProtectedNode_class, proto, parent_proto);
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_Sprite_class;
|
|
JSObject *jsb_cocos2d_Sprite_prototype;
|
|
|
|
bool js_cocos2dx_Sprite_setSpriteFrame(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::Sprite* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::Sprite *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Sprite_setSpriteFrame : Invalid Native Object");
|
|
do {
|
|
if (argc == 1) {
|
|
cocos2d::SpriteFrame* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::SpriteFrame*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
if (!ok) { ok = true; break; }
|
|
cobj->setSpriteFrame(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cobj->setSpriteFrame(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Sprite_setSpriteFrame : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Sprite_setTexture(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::Sprite* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::Sprite *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Sprite_setTexture : Invalid Native Object");
|
|
do {
|
|
if (argc == 1) {
|
|
cocos2d::Texture2D* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Texture2D*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
if (!ok) { ok = true; break; }
|
|
cobj->setTexture(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cobj->setTexture(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Sprite_setTexture : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Sprite_getTexture(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Sprite* cobj = (cocos2d::Sprite *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Sprite_getTexture : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::Texture2D* ret = cobj->getTexture();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Texture2D>(cx, (cocos2d::Texture2D*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Sprite_getTexture : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Sprite_setFlippedY(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Sprite* cobj = (cocos2d::Sprite *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Sprite_setFlippedY : Invalid Native Object");
|
|
if (argc == 1) {
|
|
bool arg0;
|
|
arg0 = JS::ToBoolean(args.get(0));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Sprite_setFlippedY : Error processing arguments");
|
|
cobj->setFlippedY(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Sprite_setFlippedY : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Sprite_setFlippedX(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Sprite* cobj = (cocos2d::Sprite *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Sprite_setFlippedX : Invalid Native Object");
|
|
if (argc == 1) {
|
|
bool arg0;
|
|
arg0 = JS::ToBoolean(args.get(0));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Sprite_setFlippedX : Error processing arguments");
|
|
cobj->setFlippedX(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Sprite_setFlippedX : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Sprite_setRotationSkewX(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Sprite* cobj = (cocos2d::Sprite *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Sprite_setRotationSkewX : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Sprite_setRotationSkewX : Error processing arguments");
|
|
cobj->setRotationSkewX(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Sprite_setRotationSkewX : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Sprite_setRotationSkewY(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Sprite* cobj = (cocos2d::Sprite *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Sprite_setRotationSkewY : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Sprite_setRotationSkewY : Error processing arguments");
|
|
cobj->setRotationSkewY(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Sprite_setRotationSkewY : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Sprite_getResourceType(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Sprite* cobj = (cocos2d::Sprite *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Sprite_getResourceType : Invalid Native Object");
|
|
if (argc == 0) {
|
|
int ret = cobj->getResourceType();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = int32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Sprite_getResourceType : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Sprite_setDisplayFrameWithAnimationName(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Sprite* cobj = (cocos2d::Sprite *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Sprite_setDisplayFrameWithAnimationName : Invalid Native Object");
|
|
if (argc == 2) {
|
|
std::string arg0;
|
|
ssize_t arg1 = 0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
ok &= jsval_to_ssize(cx, args.get(1), &arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Sprite_setDisplayFrameWithAnimationName : Error processing arguments");
|
|
cobj->setDisplayFrameWithAnimationName(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Sprite_setDisplayFrameWithAnimationName : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Sprite_getBatchNode(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Sprite* cobj = (cocos2d::Sprite *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Sprite_getBatchNode : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::SpriteBatchNode* ret = cobj->getBatchNode();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::SpriteBatchNode>(cx, (cocos2d::SpriteBatchNode*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Sprite_getBatchNode : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Sprite_getOffsetPosition(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Sprite* cobj = (cocos2d::Sprite *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Sprite_getOffsetPosition : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const cocos2d::Vec2& ret = cobj->getOffsetPosition();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = vector2_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Sprite_getOffsetPosition : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Sprite_getCenterRect(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Sprite* cobj = (cocos2d::Sprite *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Sprite_getCenterRect : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::Rect ret = cobj->getCenterRect();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ccrect_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Sprite_getCenterRect : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Sprite_removeAllChildrenWithCleanup(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Sprite* cobj = (cocos2d::Sprite *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Sprite_removeAllChildrenWithCleanup : Invalid Native Object");
|
|
if (argc == 1) {
|
|
bool arg0;
|
|
arg0 = JS::ToBoolean(args.get(0));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Sprite_removeAllChildrenWithCleanup : Error processing arguments");
|
|
cobj->removeAllChildrenWithCleanup(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Sprite_removeAllChildrenWithCleanup : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Sprite_setCenterRectNormalized(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Sprite* cobj = (cocos2d::Sprite *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Sprite_setCenterRectNormalized : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Rect arg0;
|
|
ok &= jsval_to_ccrect(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Sprite_setCenterRectNormalized : Error processing arguments");
|
|
cobj->setCenterRectNormalized(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Sprite_setCenterRectNormalized : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Sprite_setTextureRect(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::Sprite* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::Sprite *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Sprite_setTextureRect : Invalid Native Object");
|
|
do {
|
|
if (argc == 3) {
|
|
cocos2d::Rect arg0;
|
|
ok &= jsval_to_ccrect(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
bool arg1;
|
|
arg1 = JS::ToBoolean(args.get(1));
|
|
cocos2d::Size arg2;
|
|
ok &= jsval_to_ccsize(cx, args.get(2), &arg2);
|
|
if (!ok) { ok = true; break; }
|
|
cobj->setTextureRect(arg0, arg1, arg2);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 1) {
|
|
cocos2d::Rect arg0;
|
|
ok &= jsval_to_ccrect(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cobj->setTextureRect(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Sprite_setTextureRect : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Sprite_initWithSpriteFrameName(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Sprite* cobj = (cocos2d::Sprite *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Sprite_initWithSpriteFrameName : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Sprite_initWithSpriteFrameName : Error processing arguments");
|
|
bool ret = cobj->initWithSpriteFrameName(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Sprite_initWithSpriteFrameName : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Sprite_isFrameDisplayed(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Sprite* cobj = (cocos2d::Sprite *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Sprite_isFrameDisplayed : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::SpriteFrame* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::SpriteFrame*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Sprite_isFrameDisplayed : Error processing arguments");
|
|
bool ret = cobj->isFrameDisplayed(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Sprite_isFrameDisplayed : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Sprite_getAtlasIndex(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Sprite* cobj = (cocos2d::Sprite *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Sprite_getAtlasIndex : Invalid Native Object");
|
|
if (argc == 0) {
|
|
ssize_t ret = cobj->getAtlasIndex();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ssize_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Sprite_getAtlasIndex : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Sprite_setBatchNode(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Sprite* cobj = (cocos2d::Sprite *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Sprite_setBatchNode : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::SpriteBatchNode* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::SpriteBatchNode*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Sprite_setBatchNode : Error processing arguments");
|
|
cobj->setBatchNode(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Sprite_setBatchNode : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Sprite_getBlendFunc(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Sprite* cobj = (cocos2d::Sprite *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Sprite_getBlendFunc : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const cocos2d::BlendFunc& ret = cobj->getBlendFunc();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = blendfunc_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Sprite_getBlendFunc : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Sprite_setCenterRect(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Sprite* cobj = (cocos2d::Sprite *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Sprite_setCenterRect : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Rect arg0;
|
|
ok &= jsval_to_ccrect(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Sprite_setCenterRect : Error processing arguments");
|
|
cobj->setCenterRect(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Sprite_setCenterRect : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Sprite_setTextureAtlas(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Sprite* cobj = (cocos2d::Sprite *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Sprite_setTextureAtlas : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::TextureAtlas* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::TextureAtlas*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Sprite_setTextureAtlas : Error processing arguments");
|
|
cobj->setTextureAtlas(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Sprite_setTextureAtlas : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Sprite_getSpriteFrame(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Sprite* cobj = (cocos2d::Sprite *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Sprite_getSpriteFrame : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::SpriteFrame* ret = cobj->getSpriteFrame();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::SpriteFrame>(cx, (cocos2d::SpriteFrame*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Sprite_getSpriteFrame : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Sprite_getResourceName(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Sprite* cobj = (cocos2d::Sprite *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Sprite_getResourceName : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const std::string& ret = cobj->getResourceName();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = std_string_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Sprite_getResourceName : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Sprite_isDirty(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Sprite* cobj = (cocos2d::Sprite *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Sprite_isDirty : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->isDirty();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Sprite_isDirty : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Sprite_getCenterRectNormalized(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Sprite* cobj = (cocos2d::Sprite *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Sprite_getCenterRectNormalized : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::Rect ret = cobj->getCenterRectNormalized();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ccrect_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Sprite_getCenterRectNormalized : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Sprite_setAtlasIndex(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Sprite* cobj = (cocos2d::Sprite *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Sprite_setAtlasIndex : Invalid Native Object");
|
|
if (argc == 1) {
|
|
ssize_t arg0 = 0;
|
|
ok &= jsval_to_ssize(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Sprite_setAtlasIndex : Error processing arguments");
|
|
cobj->setAtlasIndex(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Sprite_setAtlasIndex : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Sprite_initWithTexture(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::Sprite* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::Sprite *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Sprite_initWithTexture : Invalid Native Object");
|
|
do {
|
|
if (argc == 2) {
|
|
cocos2d::Texture2D* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Texture2D*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Rect arg1;
|
|
ok &= jsval_to_ccrect(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
bool ret = cobj->initWithTexture(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 1) {
|
|
cocos2d::Texture2D* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Texture2D*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
if (!ok) { ok = true; break; }
|
|
bool ret = cobj->initWithTexture(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 3) {
|
|
cocos2d::Texture2D* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Texture2D*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Rect arg1;
|
|
ok &= jsval_to_ccrect(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
bool arg2;
|
|
arg2 = JS::ToBoolean(args.get(2));
|
|
bool ret = cobj->initWithTexture(arg0, arg1, arg2);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Sprite_initWithTexture : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Sprite_setDirty(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Sprite* cobj = (cocos2d::Sprite *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Sprite_setDirty : Invalid Native Object");
|
|
if (argc == 1) {
|
|
bool arg0;
|
|
arg0 = JS::ToBoolean(args.get(0));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Sprite_setDirty : Error processing arguments");
|
|
cobj->setDirty(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Sprite_setDirty : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Sprite_isTextureRectRotated(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Sprite* cobj = (cocos2d::Sprite *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Sprite_isTextureRectRotated : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->isTextureRectRotated();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Sprite_isTextureRectRotated : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Sprite_getTextureRect(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Sprite* cobj = (cocos2d::Sprite *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Sprite_getTextureRect : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const cocos2d::Rect& ret = cobj->getTextureRect();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ccrect_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Sprite_getTextureRect : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Sprite_initWithFile(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::Sprite* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::Sprite *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Sprite_initWithFile : Invalid Native Object");
|
|
do {
|
|
if (argc == 2) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Rect arg1;
|
|
ok &= jsval_to_ccrect(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
bool ret = cobj->initWithFile(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
bool ret = cobj->initWithFile(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Sprite_initWithFile : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Sprite_setBlendFunc(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Sprite* cobj = (cocos2d::Sprite *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Sprite_setBlendFunc : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::BlendFunc arg0;
|
|
ok &= jsval_to_blendfunc(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Sprite_setBlendFunc : Error processing arguments");
|
|
cobj->setBlendFunc(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Sprite_setBlendFunc : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Sprite_getTextureAtlas(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Sprite* cobj = (cocos2d::Sprite *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Sprite_getTextureAtlas : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::TextureAtlas* ret = cobj->getTextureAtlas();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::TextureAtlas>(cx, (cocos2d::TextureAtlas*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Sprite_getTextureAtlas : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Sprite_initWithSpriteFrame(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Sprite* cobj = (cocos2d::Sprite *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Sprite_initWithSpriteFrame : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::SpriteFrame* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::SpriteFrame*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Sprite_initWithSpriteFrame : Error processing arguments");
|
|
bool ret = cobj->initWithSpriteFrame(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Sprite_initWithSpriteFrame : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Sprite_isFlippedX(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Sprite* cobj = (cocos2d::Sprite *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Sprite_isFlippedX : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->isFlippedX();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Sprite_isFlippedX : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Sprite_isFlippedY(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Sprite* cobj = (cocos2d::Sprite *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Sprite_isFlippedY : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->isFlippedY();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Sprite_isFlippedY : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Sprite_setVertexRect(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Sprite* cobj = (cocos2d::Sprite *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Sprite_setVertexRect : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Rect arg0;
|
|
ok &= jsval_to_ccrect(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Sprite_setVertexRect : Error processing arguments");
|
|
cobj->setVertexRect(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Sprite_setVertexRect : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Sprite_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::Sprite* cobj = new (std::nothrow) cocos2d::Sprite();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::Sprite>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::Sprite"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_Sprite_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::Sprite *nobj = new (std::nothrow) cocos2d::Sprite();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::Sprite");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_Node_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_Sprite(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_Sprite_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_Sprite_class->name = "Sprite";
|
|
jsb_cocos2d_Sprite_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Sprite_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_Sprite_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Sprite_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_Sprite_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_Sprite_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_Sprite_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_Sprite_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("setSpriteFrame", js_cocos2dx_Sprite_setSpriteFrame, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setTexture", js_cocos2dx_Sprite_setTexture, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getTexture", js_cocos2dx_Sprite_getTexture, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setFlippedY", js_cocos2dx_Sprite_setFlippedY, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setFlippedX", js_cocos2dx_Sprite_setFlippedX, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setRotationSkewX", js_cocos2dx_Sprite_setRotationSkewX, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setRotationSkewY", js_cocos2dx_Sprite_setRotationSkewY, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getResourceType", js_cocos2dx_Sprite_getResourceType, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setDisplayFrameWithAnimationName", js_cocos2dx_Sprite_setDisplayFrameWithAnimationName, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getBatchNode", js_cocos2dx_Sprite_getBatchNode, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getOffsetPosition", js_cocos2dx_Sprite_getOffsetPosition, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getCenterRect", js_cocos2dx_Sprite_getCenterRect, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("removeAllChildrenWithCleanup", js_cocos2dx_Sprite_removeAllChildrenWithCleanup, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setCenterRectNormalized", js_cocos2dx_Sprite_setCenterRectNormalized, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setTextureRect", js_cocos2dx_Sprite_setTextureRect, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initWithSpriteFrameName", js_cocos2dx_Sprite_initWithSpriteFrameName, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("isFrameDisplayed", js_cocos2dx_Sprite_isFrameDisplayed, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getAtlasIndex", js_cocos2dx_Sprite_getAtlasIndex, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setBatchNode", js_cocos2dx_Sprite_setBatchNode, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getBlendFunc", js_cocos2dx_Sprite_getBlendFunc, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setCenterRect", js_cocos2dx_Sprite_setCenterRect, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setTextureAtlas", js_cocos2dx_Sprite_setTextureAtlas, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getSpriteFrame", js_cocos2dx_Sprite_getSpriteFrame, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getResourceName", js_cocos2dx_Sprite_getResourceName, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("isDirty", js_cocos2dx_Sprite_isDirty, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getCenterRectNormalized", js_cocos2dx_Sprite_getCenterRectNormalized, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setAtlasIndex", js_cocos2dx_Sprite_setAtlasIndex, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initWithTexture", js_cocos2dx_Sprite_initWithTexture, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setDirty", js_cocos2dx_Sprite_setDirty, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("isTextureRectRotated", js_cocos2dx_Sprite_isTextureRectRotated, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getTextureRect", js_cocos2dx_Sprite_getTextureRect, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initWithFile", js_cocos2dx_Sprite_initWithFile, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setBlendFunc", js_cocos2dx_Sprite_setBlendFunc, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getTextureAtlas", js_cocos2dx_Sprite_getTextureAtlas, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initWithSpriteFrame", js_cocos2dx_Sprite_initWithSpriteFrame, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("isFlippedX", js_cocos2dx_Sprite_isFlippedX, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("isFlippedY", js_cocos2dx_Sprite_isFlippedY, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setVertexRect", js_cocos2dx_Sprite_setVertexRect, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_Sprite_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JSFunctionSpec *st_funcs = NULL;
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_Node_prototype);
|
|
jsb_cocos2d_Sprite_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_Sprite_class,
|
|
js_cocos2dx_Sprite_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_Sprite_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "Sprite"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::Sprite>(cx, jsb_cocos2d_Sprite_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.Sprite.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_RenderTexture_class;
|
|
JSObject *jsb_cocos2d_RenderTexture_prototype;
|
|
|
|
bool js_cocos2dx_RenderTexture_setVirtualViewport(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::RenderTexture* cobj = (cocos2d::RenderTexture *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_RenderTexture_setVirtualViewport : Invalid Native Object");
|
|
if (argc == 3) {
|
|
cocos2d::Vec2 arg0;
|
|
cocos2d::Rect arg1;
|
|
cocos2d::Rect arg2;
|
|
ok &= jsval_to_vector2(cx, args.get(0), &arg0);
|
|
ok &= jsval_to_ccrect(cx, args.get(1), &arg1);
|
|
ok &= jsval_to_ccrect(cx, args.get(2), &arg2);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_RenderTexture_setVirtualViewport : Error processing arguments");
|
|
cobj->setVirtualViewport(arg0, arg1, arg2);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_RenderTexture_setVirtualViewport : wrong number of arguments: %d, was expecting %d", argc, 3);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_RenderTexture_clearStencil(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::RenderTexture* cobj = (cocos2d::RenderTexture *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_RenderTexture_clearStencil : Invalid Native Object");
|
|
if (argc == 1) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_RenderTexture_clearStencil : Error processing arguments");
|
|
cobj->clearStencil(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_RenderTexture_clearStencil : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_RenderTexture_getClearDepth(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::RenderTexture* cobj = (cocos2d::RenderTexture *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_RenderTexture_getClearDepth : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getClearDepth();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_RenderTexture_getClearDepth : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_RenderTexture_getClearStencil(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::RenderTexture* cobj = (cocos2d::RenderTexture *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_RenderTexture_getClearStencil : Invalid Native Object");
|
|
if (argc == 0) {
|
|
int ret = cobj->getClearStencil();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = int32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_RenderTexture_getClearStencil : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_RenderTexture_end(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::RenderTexture* cobj = (cocos2d::RenderTexture *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_RenderTexture_end : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->end();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_RenderTexture_end : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_RenderTexture_setClearStencil(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::RenderTexture* cobj = (cocos2d::RenderTexture *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_RenderTexture_setClearStencil : Invalid Native Object");
|
|
if (argc == 1) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_RenderTexture_setClearStencil : Error processing arguments");
|
|
cobj->setClearStencil(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_RenderTexture_setClearStencil : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_RenderTexture_setSprite(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::RenderTexture* cobj = (cocos2d::RenderTexture *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_RenderTexture_setSprite : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Sprite* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Sprite*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_RenderTexture_setSprite : Error processing arguments");
|
|
cobj->setSprite(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_RenderTexture_setSprite : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_RenderTexture_getSprite(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::RenderTexture* cobj = (cocos2d::RenderTexture *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_RenderTexture_getSprite : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::Sprite* ret = cobj->getSprite();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Sprite>(cx, (cocos2d::Sprite*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_RenderTexture_getSprite : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_RenderTexture_isAutoDraw(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::RenderTexture* cobj = (cocos2d::RenderTexture *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_RenderTexture_isAutoDraw : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->isAutoDraw();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_RenderTexture_isAutoDraw : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_RenderTexture_setKeepMatrix(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::RenderTexture* cobj = (cocos2d::RenderTexture *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_RenderTexture_setKeepMatrix : Invalid Native Object");
|
|
if (argc == 1) {
|
|
bool arg0;
|
|
arg0 = JS::ToBoolean(args.get(0));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_RenderTexture_setKeepMatrix : Error processing arguments");
|
|
cobj->setKeepMatrix(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_RenderTexture_setKeepMatrix : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_RenderTexture_setClearFlags(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::RenderTexture* cobj = (cocos2d::RenderTexture *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_RenderTexture_setClearFlags : Invalid Native Object");
|
|
if (argc == 1) {
|
|
unsigned int arg0 = 0;
|
|
ok &= jsval_to_uint32(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_RenderTexture_setClearFlags : Error processing arguments");
|
|
cobj->setClearFlags(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_RenderTexture_setClearFlags : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_RenderTexture_begin(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::RenderTexture* cobj = (cocos2d::RenderTexture *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_RenderTexture_begin : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->begin();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_RenderTexture_begin : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_RenderTexture_setAutoDraw(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::RenderTexture* cobj = (cocos2d::RenderTexture *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_RenderTexture_setAutoDraw : Invalid Native Object");
|
|
if (argc == 1) {
|
|
bool arg0;
|
|
arg0 = JS::ToBoolean(args.get(0));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_RenderTexture_setAutoDraw : Error processing arguments");
|
|
cobj->setAutoDraw(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_RenderTexture_setAutoDraw : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_RenderTexture_setClearColor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::RenderTexture* cobj = (cocos2d::RenderTexture *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_RenderTexture_setClearColor : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Color4F arg0;
|
|
ok &= jsval_to_cccolor4f(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_RenderTexture_setClearColor : Error processing arguments");
|
|
cobj->setClearColor(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_RenderTexture_setClearColor : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_RenderTexture_beginWithClear(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::RenderTexture* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::RenderTexture *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_RenderTexture_beginWithClear : Invalid Native Object");
|
|
do {
|
|
if (argc == 5) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
if (!ok) { ok = true; break; }
|
|
double arg1 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
if (!ok) { ok = true; break; }
|
|
double arg2 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
if (!ok) { ok = true; break; }
|
|
double arg3 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(3), &arg3) && !std::isnan(arg3);
|
|
if (!ok) { ok = true; break; }
|
|
double arg4 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(4), &arg4) && !std::isnan(arg4);
|
|
if (!ok) { ok = true; break; }
|
|
cobj->beginWithClear(arg0, arg1, arg2, arg3, arg4);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 4) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
if (!ok) { ok = true; break; }
|
|
double arg1 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
if (!ok) { ok = true; break; }
|
|
double arg2 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
if (!ok) { ok = true; break; }
|
|
double arg3 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(3), &arg3) && !std::isnan(arg3);
|
|
if (!ok) { ok = true; break; }
|
|
cobj->beginWithClear(arg0, arg1, arg2, arg3);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 6) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
if (!ok) { ok = true; break; }
|
|
double arg1 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
if (!ok) { ok = true; break; }
|
|
double arg2 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
if (!ok) { ok = true; break; }
|
|
double arg3 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(3), &arg3) && !std::isnan(arg3);
|
|
if (!ok) { ok = true; break; }
|
|
double arg4 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(4), &arg4) && !std::isnan(arg4);
|
|
if (!ok) { ok = true; break; }
|
|
int arg5 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(5), (int32_t *)&arg5);
|
|
if (!ok) { ok = true; break; }
|
|
cobj->beginWithClear(arg0, arg1, arg2, arg3, arg4, arg5);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_RenderTexture_beginWithClear : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_RenderTexture_clearDepth(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::RenderTexture* cobj = (cocos2d::RenderTexture *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_RenderTexture_clearDepth : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_RenderTexture_clearDepth : Error processing arguments");
|
|
cobj->clearDepth(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_RenderTexture_clearDepth : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_RenderTexture_getClearColor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::RenderTexture* cobj = (cocos2d::RenderTexture *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_RenderTexture_getClearColor : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const cocos2d::Color4F& ret = cobj->getClearColor();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = cccolor4f_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_RenderTexture_getClearColor : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_RenderTexture_clear(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::RenderTexture* cobj = (cocos2d::RenderTexture *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_RenderTexture_clear : Invalid Native Object");
|
|
if (argc == 4) {
|
|
double arg0 = 0;
|
|
double arg1 = 0;
|
|
double arg2 = 0;
|
|
double arg3 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
ok &= JS::ToNumber( cx, args.get(3), &arg3) && !std::isnan(arg3);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_RenderTexture_clear : Error processing arguments");
|
|
cobj->clear(arg0, arg1, arg2, arg3);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_RenderTexture_clear : wrong number of arguments: %d, was expecting %d", argc, 4);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_RenderTexture_getClearFlags(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::RenderTexture* cobj = (cocos2d::RenderTexture *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_RenderTexture_getClearFlags : Invalid Native Object");
|
|
if (argc == 0) {
|
|
unsigned int ret = cobj->getClearFlags();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = uint32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_RenderTexture_getClearFlags : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_RenderTexture_newImage(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::RenderTexture* cobj = (cocos2d::RenderTexture *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_RenderTexture_newImage : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::Image* ret = cobj->newImage();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Image>(cx, (cocos2d::Image*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
if (argc == 1) {
|
|
bool arg0;
|
|
arg0 = JS::ToBoolean(args.get(0));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_RenderTexture_newImage : Error processing arguments");
|
|
cocos2d::Image* ret = cobj->newImage(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Image>(cx, (cocos2d::Image*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_RenderTexture_newImage : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_RenderTexture_setClearDepth(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::RenderTexture* cobj = (cocos2d::RenderTexture *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_RenderTexture_setClearDepth : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_RenderTexture_setClearDepth : Error processing arguments");
|
|
cobj->setClearDepth(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_RenderTexture_setClearDepth : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_RenderTexture_initWithWidthAndHeight(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::RenderTexture* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::RenderTexture *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_RenderTexture_initWithWidthAndHeight : Invalid Native Object");
|
|
do {
|
|
if (argc == 4) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
if (!ok) { ok = true; break; }
|
|
int arg1 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Texture2D::PixelFormat arg2;
|
|
ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2);
|
|
if (!ok) { ok = true; break; }
|
|
unsigned int arg3 = 0;
|
|
ok &= jsval_to_uint32(cx, args.get(3), &arg3);
|
|
if (!ok) { ok = true; break; }
|
|
bool ret = cobj->initWithWidthAndHeight(arg0, arg1, arg2, arg3);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 3) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
if (!ok) { ok = true; break; }
|
|
int arg1 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Texture2D::PixelFormat arg2;
|
|
ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2);
|
|
if (!ok) { ok = true; break; }
|
|
bool ret = cobj->initWithWidthAndHeight(arg0, arg1, arg2);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_RenderTexture_initWithWidthAndHeight : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_RenderTexture_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
|
|
do {
|
|
if (argc == 3) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
if (!ok) { ok = true; break; }
|
|
int arg1 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Texture2D::PixelFormat arg2;
|
|
ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::RenderTexture* ret = cocos2d::RenderTexture::create(arg0, arg1, arg2);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::RenderTexture>(cx, (cocos2d::RenderTexture*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
|
|
do {
|
|
if (argc == 4) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
if (!ok) { ok = true; break; }
|
|
int arg1 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Texture2D::PixelFormat arg2;
|
|
ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2);
|
|
if (!ok) { ok = true; break; }
|
|
unsigned int arg3 = 0;
|
|
ok &= jsval_to_uint32(cx, args.get(3), &arg3);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::RenderTexture* ret = cocos2d::RenderTexture::create(arg0, arg1, arg2, arg3);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::RenderTexture>(cx, (cocos2d::RenderTexture*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
|
|
do {
|
|
if (argc == 2) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
if (!ok) { ok = true; break; }
|
|
int arg1 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::RenderTexture* ret = cocos2d::RenderTexture::create(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::RenderTexture>(cx, (cocos2d::RenderTexture*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
JS_ReportError(cx, "js_cocos2dx_RenderTexture_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_RenderTexture_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::RenderTexture* cobj = new (std::nothrow) cocos2d::RenderTexture();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::RenderTexture>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::RenderTexture"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_RenderTexture_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::RenderTexture *nobj = new (std::nothrow) cocos2d::RenderTexture();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::RenderTexture");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_Node_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_RenderTexture(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_RenderTexture_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_RenderTexture_class->name = "RenderTexture";
|
|
jsb_cocos2d_RenderTexture_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_RenderTexture_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_RenderTexture_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_RenderTexture_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_RenderTexture_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_RenderTexture_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_RenderTexture_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_RenderTexture_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("setVirtualViewport", js_cocos2dx_RenderTexture_setVirtualViewport, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("clearStencil", js_cocos2dx_RenderTexture_clearStencil, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getClearDepth", js_cocos2dx_RenderTexture_getClearDepth, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getClearStencil", js_cocos2dx_RenderTexture_getClearStencil, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("end", js_cocos2dx_RenderTexture_end, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setClearStencil", js_cocos2dx_RenderTexture_setClearStencil, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setSprite", js_cocos2dx_RenderTexture_setSprite, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getSprite", js_cocos2dx_RenderTexture_getSprite, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("isAutoDraw", js_cocos2dx_RenderTexture_isAutoDraw, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setKeepMatrix", js_cocos2dx_RenderTexture_setKeepMatrix, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setClearFlags", js_cocos2dx_RenderTexture_setClearFlags, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("begin", js_cocos2dx_RenderTexture_begin, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setAutoDraw", js_cocos2dx_RenderTexture_setAutoDraw, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setClearColor", js_cocos2dx_RenderTexture_setClearColor, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("beginWithClear", js_cocos2dx_RenderTexture_beginWithClear, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("clearDepth", js_cocos2dx_RenderTexture_clearDepth, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getClearColor", js_cocos2dx_RenderTexture_getClearColor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("clear", js_cocos2dx_RenderTexture_clear, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getClearFlags", js_cocos2dx_RenderTexture_getClearFlags, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("newImage", js_cocos2dx_RenderTexture_newImage, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setClearDepth", js_cocos2dx_RenderTexture_setClearDepth, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initWithWidthAndHeight", js_cocos2dx_RenderTexture_initWithWidthAndHeight, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_RenderTexture_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_RenderTexture_create, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_Node_prototype);
|
|
jsb_cocos2d_RenderTexture_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_RenderTexture_class,
|
|
js_cocos2dx_RenderTexture_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_RenderTexture_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "RenderTexture"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::RenderTexture>(cx, jsb_cocos2d_RenderTexture_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.RenderTexture.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_TransitionEaseScene_class;
|
|
JSObject *jsb_cocos2d_TransitionEaseScene_prototype;
|
|
|
|
bool js_cocos2dx_TransitionEaseScene_easeActionWithAction(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TransitionEaseScene* cobj = (cocos2d::TransitionEaseScene *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TransitionEaseScene_easeActionWithAction : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::ActionInterval* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TransitionEaseScene_easeActionWithAction : Error processing arguments");
|
|
cocos2d::ActionInterval* ret = cobj->easeActionWithAction(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::ActionInterval>(cx, (cocos2d::ActionInterval*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TransitionEaseScene_easeActionWithAction : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
|
|
void js_register_cocos2dx_TransitionEaseScene(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_TransitionEaseScene_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_TransitionEaseScene_class->name = "TransitionEaseScene";
|
|
jsb_cocos2d_TransitionEaseScene_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TransitionEaseScene_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_TransitionEaseScene_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TransitionEaseScene_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_TransitionEaseScene_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_TransitionEaseScene_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_TransitionEaseScene_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_TransitionEaseScene_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("easeActionWithAction", js_cocos2dx_TransitionEaseScene_easeActionWithAction, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JSFunctionSpec *st_funcs = NULL;
|
|
|
|
jsb_cocos2d_TransitionEaseScene_prototype = JS_InitClass(
|
|
cx, global,
|
|
JS::NullPtr(),
|
|
jsb_cocos2d_TransitionEaseScene_class,
|
|
empty_constructor, 0,
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_TransitionEaseScene_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "TransitionEaseScene"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::FalseHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::TransitionEaseScene>(cx, jsb_cocos2d_TransitionEaseScene_class, proto, JS::NullPtr());
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_TransitionScene_class;
|
|
JSObject *jsb_cocos2d_TransitionScene_prototype;
|
|
|
|
bool js_cocos2dx_TransitionScene_getInScene(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TransitionScene* cobj = (cocos2d::TransitionScene *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TransitionScene_getInScene : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::Scene* ret = cobj->getInScene();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Scene>(cx, (cocos2d::Scene*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TransitionScene_getInScene : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TransitionScene_finish(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TransitionScene* cobj = (cocos2d::TransitionScene *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TransitionScene_finish : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->finish();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TransitionScene_finish : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TransitionScene_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TransitionScene* cobj = (cocos2d::TransitionScene *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TransitionScene_initWithDuration : Invalid Native Object");
|
|
if (argc == 2) {
|
|
double arg0 = 0;
|
|
cocos2d::Scene* arg1 = nullptr;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::Scene*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TransitionScene_initWithDuration : Error processing arguments");
|
|
bool ret = cobj->initWithDuration(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TransitionScene_initWithDuration : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TransitionScene_getDuration(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TransitionScene* cobj = (cocos2d::TransitionScene *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TransitionScene_getDuration : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getDuration();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TransitionScene_getDuration : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TransitionScene_hideOutShowIn(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TransitionScene* cobj = (cocos2d::TransitionScene *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TransitionScene_hideOutShowIn : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->hideOutShowIn();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TransitionScene_hideOutShowIn : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TransitionScene_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 2) {
|
|
double arg0 = 0;
|
|
cocos2d::Scene* arg1 = nullptr;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::Scene*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TransitionScene_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::TransitionScene::create(arg0, arg1);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TransitionScene>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::TransitionScene"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_TransitionScene_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_TransitionScene_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::TransitionScene* cobj = new (std::nothrow) cocos2d::TransitionScene();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TransitionScene>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::TransitionScene"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_TransitionScene_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::TransitionScene *nobj = new (std::nothrow) cocos2d::TransitionScene();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::TransitionScene");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_Scene_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_TransitionScene(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_TransitionScene_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_TransitionScene_class->name = "TransitionScene";
|
|
jsb_cocos2d_TransitionScene_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TransitionScene_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_TransitionScene_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TransitionScene_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_TransitionScene_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_TransitionScene_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_TransitionScene_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_TransitionScene_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("getInScene", js_cocos2dx_TransitionScene_getInScene, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("finish", js_cocos2dx_TransitionScene_finish, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initWithDuration", js_cocos2dx_TransitionScene_initWithDuration, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getDuration", js_cocos2dx_TransitionScene_getDuration, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("hideOutShowIn", js_cocos2dx_TransitionScene_hideOutShowIn, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_TransitionScene_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_TransitionScene_create, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_Scene_prototype);
|
|
jsb_cocos2d_TransitionScene_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_TransitionScene_class,
|
|
js_cocos2dx_TransitionScene_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_TransitionScene_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "TransitionScene"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::TransitionScene>(cx, jsb_cocos2d_TransitionScene_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.TransitionScene.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_TransitionSceneOriented_class;
|
|
JSObject *jsb_cocos2d_TransitionSceneOriented_prototype;
|
|
|
|
bool js_cocos2dx_TransitionSceneOriented_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TransitionSceneOriented* cobj = (cocos2d::TransitionSceneOriented *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TransitionSceneOriented_initWithDuration : Invalid Native Object");
|
|
if (argc == 3) {
|
|
double arg0 = 0;
|
|
cocos2d::Scene* arg1 = nullptr;
|
|
cocos2d::TransitionScene::Orientation arg2;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::Scene*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TransitionSceneOriented_initWithDuration : Error processing arguments");
|
|
bool ret = cobj->initWithDuration(arg0, arg1, arg2);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TransitionSceneOriented_initWithDuration : wrong number of arguments: %d, was expecting %d", argc, 3);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TransitionSceneOriented_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 3) {
|
|
double arg0 = 0;
|
|
cocos2d::Scene* arg1 = nullptr;
|
|
cocos2d::TransitionScene::Orientation arg2;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::Scene*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TransitionSceneOriented_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::TransitionSceneOriented::create(arg0, arg1, arg2);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TransitionSceneOriented>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::TransitionSceneOriented"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_TransitionSceneOriented_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_TransitionSceneOriented_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::TransitionSceneOriented* cobj = new (std::nothrow) cocos2d::TransitionSceneOriented();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TransitionSceneOriented>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::TransitionSceneOriented"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_TransitionSceneOriented_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::TransitionSceneOriented *nobj = new (std::nothrow) cocos2d::TransitionSceneOriented();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::TransitionSceneOriented");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_TransitionScene_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_TransitionSceneOriented(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_TransitionSceneOriented_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_TransitionSceneOriented_class->name = "TransitionSceneOriented";
|
|
jsb_cocos2d_TransitionSceneOriented_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TransitionSceneOriented_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_TransitionSceneOriented_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TransitionSceneOriented_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_TransitionSceneOriented_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_TransitionSceneOriented_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_TransitionSceneOriented_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_TransitionSceneOriented_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("initWithDuration", js_cocos2dx_TransitionSceneOriented_initWithDuration, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_TransitionSceneOriented_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_TransitionSceneOriented_create, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_TransitionScene_prototype);
|
|
jsb_cocos2d_TransitionSceneOriented_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_TransitionSceneOriented_class,
|
|
js_cocos2dx_TransitionSceneOriented_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_TransitionSceneOriented_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "TransitionSceneOriented"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::TransitionSceneOriented>(cx, jsb_cocos2d_TransitionSceneOriented_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.TransitionSceneOriented.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_TransitionRotoZoom_class;
|
|
JSObject *jsb_cocos2d_TransitionRotoZoom_prototype;
|
|
|
|
bool js_cocos2dx_TransitionRotoZoom_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 2) {
|
|
double arg0 = 0;
|
|
cocos2d::Scene* arg1 = nullptr;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::Scene*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TransitionRotoZoom_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::TransitionRotoZoom::create(arg0, arg1);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TransitionRotoZoom>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::TransitionRotoZoom"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_TransitionRotoZoom_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_TransitionRotoZoom_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::TransitionRotoZoom* cobj = new (std::nothrow) cocos2d::TransitionRotoZoom();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TransitionRotoZoom>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::TransitionRotoZoom"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_TransitionRotoZoom_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::TransitionRotoZoom *nobj = new (std::nothrow) cocos2d::TransitionRotoZoom();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::TransitionRotoZoom");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_TransitionScene_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_TransitionRotoZoom(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_TransitionRotoZoom_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_TransitionRotoZoom_class->name = "TransitionRotoZoom";
|
|
jsb_cocos2d_TransitionRotoZoom_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TransitionRotoZoom_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_TransitionRotoZoom_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TransitionRotoZoom_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_TransitionRotoZoom_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_TransitionRotoZoom_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_TransitionRotoZoom_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_TransitionRotoZoom_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("ctor", js_cocos2dx_TransitionRotoZoom_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_TransitionRotoZoom_create, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_TransitionScene_prototype);
|
|
jsb_cocos2d_TransitionRotoZoom_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_TransitionRotoZoom_class,
|
|
js_cocos2dx_TransitionRotoZoom_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_TransitionRotoZoom_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "TransitionRotoZoom"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::TransitionRotoZoom>(cx, jsb_cocos2d_TransitionRotoZoom_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.TransitionRotoZoom.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_TransitionJumpZoom_class;
|
|
JSObject *jsb_cocos2d_TransitionJumpZoom_prototype;
|
|
|
|
bool js_cocos2dx_TransitionJumpZoom_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 2) {
|
|
double arg0 = 0;
|
|
cocos2d::Scene* arg1 = nullptr;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::Scene*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TransitionJumpZoom_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::TransitionJumpZoom::create(arg0, arg1);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TransitionJumpZoom>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::TransitionJumpZoom"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_TransitionJumpZoom_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_TransitionJumpZoom_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::TransitionJumpZoom* cobj = new (std::nothrow) cocos2d::TransitionJumpZoom();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TransitionJumpZoom>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::TransitionJumpZoom"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_TransitionJumpZoom_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::TransitionJumpZoom *nobj = new (std::nothrow) cocos2d::TransitionJumpZoom();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::TransitionJumpZoom");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_TransitionScene_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_TransitionJumpZoom(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_TransitionJumpZoom_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_TransitionJumpZoom_class->name = "TransitionJumpZoom";
|
|
jsb_cocos2d_TransitionJumpZoom_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TransitionJumpZoom_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_TransitionJumpZoom_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TransitionJumpZoom_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_TransitionJumpZoom_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_TransitionJumpZoom_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_TransitionJumpZoom_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_TransitionJumpZoom_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("ctor", js_cocos2dx_TransitionJumpZoom_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_TransitionJumpZoom_create, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_TransitionScene_prototype);
|
|
jsb_cocos2d_TransitionJumpZoom_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_TransitionJumpZoom_class,
|
|
js_cocos2dx_TransitionJumpZoom_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_TransitionJumpZoom_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "TransitionJumpZoom"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::TransitionJumpZoom>(cx, jsb_cocos2d_TransitionJumpZoom_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.TransitionJumpZoom.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_TransitionMoveInL_class;
|
|
JSObject *jsb_cocos2d_TransitionMoveInL_prototype;
|
|
|
|
bool js_cocos2dx_TransitionMoveInL_action(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TransitionMoveInL* cobj = (cocos2d::TransitionMoveInL *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TransitionMoveInL_action : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::ActionInterval* ret = cobj->action();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::ActionInterval>(cx, (cocos2d::ActionInterval*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TransitionMoveInL_action : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TransitionMoveInL_easeActionWithAction(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TransitionMoveInL* cobj = (cocos2d::TransitionMoveInL *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TransitionMoveInL_easeActionWithAction : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::ActionInterval* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TransitionMoveInL_easeActionWithAction : Error processing arguments");
|
|
cocos2d::ActionInterval* ret = cobj->easeActionWithAction(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::ActionInterval>(cx, (cocos2d::ActionInterval*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TransitionMoveInL_easeActionWithAction : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TransitionMoveInL_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 2) {
|
|
double arg0 = 0;
|
|
cocos2d::Scene* arg1 = nullptr;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::Scene*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TransitionMoveInL_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::TransitionMoveInL::create(arg0, arg1);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TransitionMoveInL>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::TransitionMoveInL"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_TransitionMoveInL_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_TransitionMoveInL_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::TransitionMoveInL* cobj = new (std::nothrow) cocos2d::TransitionMoveInL();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TransitionMoveInL>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::TransitionMoveInL"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_TransitionMoveInL_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::TransitionMoveInL *nobj = new (std::nothrow) cocos2d::TransitionMoveInL();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::TransitionMoveInL");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_TransitionScene_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_TransitionMoveInL(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_TransitionMoveInL_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_TransitionMoveInL_class->name = "TransitionMoveInL";
|
|
jsb_cocos2d_TransitionMoveInL_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TransitionMoveInL_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_TransitionMoveInL_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TransitionMoveInL_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_TransitionMoveInL_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_TransitionMoveInL_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_TransitionMoveInL_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_TransitionMoveInL_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("action", js_cocos2dx_TransitionMoveInL_action, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("easeActionWithAction", js_cocos2dx_TransitionMoveInL_easeActionWithAction, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_TransitionMoveInL_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_TransitionMoveInL_create, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_TransitionScene_prototype);
|
|
jsb_cocos2d_TransitionMoveInL_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_TransitionMoveInL_class,
|
|
js_cocos2dx_TransitionMoveInL_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_TransitionMoveInL_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "TransitionMoveInL"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::TransitionMoveInL>(cx, jsb_cocos2d_TransitionMoveInL_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.TransitionMoveInL.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_TransitionMoveInR_class;
|
|
JSObject *jsb_cocos2d_TransitionMoveInR_prototype;
|
|
|
|
bool js_cocos2dx_TransitionMoveInR_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 2) {
|
|
double arg0 = 0;
|
|
cocos2d::Scene* arg1 = nullptr;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::Scene*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TransitionMoveInR_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::TransitionMoveInR::create(arg0, arg1);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TransitionMoveInR>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::TransitionMoveInR"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_TransitionMoveInR_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_TransitionMoveInR_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::TransitionMoveInR* cobj = new (std::nothrow) cocos2d::TransitionMoveInR();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TransitionMoveInR>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::TransitionMoveInR"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_TransitionMoveInR_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::TransitionMoveInR *nobj = new (std::nothrow) cocos2d::TransitionMoveInR();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::TransitionMoveInR");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_TransitionMoveInL_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_TransitionMoveInR(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_TransitionMoveInR_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_TransitionMoveInR_class->name = "TransitionMoveInR";
|
|
jsb_cocos2d_TransitionMoveInR_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TransitionMoveInR_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_TransitionMoveInR_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TransitionMoveInR_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_TransitionMoveInR_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_TransitionMoveInR_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_TransitionMoveInR_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_TransitionMoveInR_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("ctor", js_cocos2dx_TransitionMoveInR_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_TransitionMoveInR_create, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_TransitionMoveInL_prototype);
|
|
jsb_cocos2d_TransitionMoveInR_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_TransitionMoveInR_class,
|
|
js_cocos2dx_TransitionMoveInR_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_TransitionMoveInR_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "TransitionMoveInR"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::TransitionMoveInR>(cx, jsb_cocos2d_TransitionMoveInR_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.TransitionMoveInR.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_TransitionMoveInT_class;
|
|
JSObject *jsb_cocos2d_TransitionMoveInT_prototype;
|
|
|
|
bool js_cocos2dx_TransitionMoveInT_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 2) {
|
|
double arg0 = 0;
|
|
cocos2d::Scene* arg1 = nullptr;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::Scene*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TransitionMoveInT_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::TransitionMoveInT::create(arg0, arg1);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TransitionMoveInT>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::TransitionMoveInT"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_TransitionMoveInT_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_TransitionMoveInT_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::TransitionMoveInT* cobj = new (std::nothrow) cocos2d::TransitionMoveInT();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TransitionMoveInT>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::TransitionMoveInT"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_TransitionMoveInT_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::TransitionMoveInT *nobj = new (std::nothrow) cocos2d::TransitionMoveInT();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::TransitionMoveInT");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_TransitionMoveInL_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_TransitionMoveInT(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_TransitionMoveInT_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_TransitionMoveInT_class->name = "TransitionMoveInT";
|
|
jsb_cocos2d_TransitionMoveInT_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TransitionMoveInT_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_TransitionMoveInT_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TransitionMoveInT_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_TransitionMoveInT_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_TransitionMoveInT_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_TransitionMoveInT_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_TransitionMoveInT_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("ctor", js_cocos2dx_TransitionMoveInT_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_TransitionMoveInT_create, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_TransitionMoveInL_prototype);
|
|
jsb_cocos2d_TransitionMoveInT_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_TransitionMoveInT_class,
|
|
js_cocos2dx_TransitionMoveInT_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_TransitionMoveInT_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "TransitionMoveInT"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::TransitionMoveInT>(cx, jsb_cocos2d_TransitionMoveInT_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.TransitionMoveInT.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_TransitionMoveInB_class;
|
|
JSObject *jsb_cocos2d_TransitionMoveInB_prototype;
|
|
|
|
bool js_cocos2dx_TransitionMoveInB_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 2) {
|
|
double arg0 = 0;
|
|
cocos2d::Scene* arg1 = nullptr;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::Scene*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TransitionMoveInB_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::TransitionMoveInB::create(arg0, arg1);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TransitionMoveInB>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::TransitionMoveInB"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_TransitionMoveInB_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_TransitionMoveInB_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::TransitionMoveInB* cobj = new (std::nothrow) cocos2d::TransitionMoveInB();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TransitionMoveInB>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::TransitionMoveInB"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_TransitionMoveInB_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::TransitionMoveInB *nobj = new (std::nothrow) cocos2d::TransitionMoveInB();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::TransitionMoveInB");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_TransitionMoveInL_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_TransitionMoveInB(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_TransitionMoveInB_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_TransitionMoveInB_class->name = "TransitionMoveInB";
|
|
jsb_cocos2d_TransitionMoveInB_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TransitionMoveInB_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_TransitionMoveInB_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TransitionMoveInB_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_TransitionMoveInB_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_TransitionMoveInB_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_TransitionMoveInB_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_TransitionMoveInB_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("ctor", js_cocos2dx_TransitionMoveInB_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_TransitionMoveInB_create, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_TransitionMoveInL_prototype);
|
|
jsb_cocos2d_TransitionMoveInB_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_TransitionMoveInB_class,
|
|
js_cocos2dx_TransitionMoveInB_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_TransitionMoveInB_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "TransitionMoveInB"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::TransitionMoveInB>(cx, jsb_cocos2d_TransitionMoveInB_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.TransitionMoveInB.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_TransitionSlideInL_class;
|
|
JSObject *jsb_cocos2d_TransitionSlideInL_prototype;
|
|
|
|
bool js_cocos2dx_TransitionSlideInL_action(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TransitionSlideInL* cobj = (cocos2d::TransitionSlideInL *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TransitionSlideInL_action : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::ActionInterval* ret = cobj->action();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::ActionInterval>(cx, (cocos2d::ActionInterval*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TransitionSlideInL_action : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TransitionSlideInL_easeActionWithAction(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TransitionSlideInL* cobj = (cocos2d::TransitionSlideInL *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TransitionSlideInL_easeActionWithAction : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::ActionInterval* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TransitionSlideInL_easeActionWithAction : Error processing arguments");
|
|
cocos2d::ActionInterval* ret = cobj->easeActionWithAction(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::ActionInterval>(cx, (cocos2d::ActionInterval*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TransitionSlideInL_easeActionWithAction : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TransitionSlideInL_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 2) {
|
|
double arg0 = 0;
|
|
cocos2d::Scene* arg1 = nullptr;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::Scene*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TransitionSlideInL_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::TransitionSlideInL::create(arg0, arg1);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TransitionSlideInL>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::TransitionSlideInL"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_TransitionSlideInL_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_TransitionSlideInL_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::TransitionSlideInL* cobj = new (std::nothrow) cocos2d::TransitionSlideInL();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TransitionSlideInL>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::TransitionSlideInL"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_TransitionSlideInL_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::TransitionSlideInL *nobj = new (std::nothrow) cocos2d::TransitionSlideInL();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::TransitionSlideInL");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_TransitionScene_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_TransitionSlideInL(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_TransitionSlideInL_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_TransitionSlideInL_class->name = "TransitionSlideInL";
|
|
jsb_cocos2d_TransitionSlideInL_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TransitionSlideInL_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_TransitionSlideInL_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TransitionSlideInL_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_TransitionSlideInL_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_TransitionSlideInL_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_TransitionSlideInL_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_TransitionSlideInL_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("action", js_cocos2dx_TransitionSlideInL_action, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("easeActionWithAction", js_cocos2dx_TransitionSlideInL_easeActionWithAction, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_TransitionSlideInL_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_TransitionSlideInL_create, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_TransitionScene_prototype);
|
|
jsb_cocos2d_TransitionSlideInL_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_TransitionSlideInL_class,
|
|
js_cocos2dx_TransitionSlideInL_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_TransitionSlideInL_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "TransitionSlideInL"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::TransitionSlideInL>(cx, jsb_cocos2d_TransitionSlideInL_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.TransitionSlideInL.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_TransitionSlideInR_class;
|
|
JSObject *jsb_cocos2d_TransitionSlideInR_prototype;
|
|
|
|
bool js_cocos2dx_TransitionSlideInR_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 2) {
|
|
double arg0 = 0;
|
|
cocos2d::Scene* arg1 = nullptr;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::Scene*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TransitionSlideInR_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::TransitionSlideInR::create(arg0, arg1);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TransitionSlideInR>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::TransitionSlideInR"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_TransitionSlideInR_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_TransitionSlideInR_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::TransitionSlideInR* cobj = new (std::nothrow) cocos2d::TransitionSlideInR();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TransitionSlideInR>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::TransitionSlideInR"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_TransitionSlideInR_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::TransitionSlideInR *nobj = new (std::nothrow) cocos2d::TransitionSlideInR();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::TransitionSlideInR");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_TransitionSlideInL_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_TransitionSlideInR(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_TransitionSlideInR_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_TransitionSlideInR_class->name = "TransitionSlideInR";
|
|
jsb_cocos2d_TransitionSlideInR_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TransitionSlideInR_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_TransitionSlideInR_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TransitionSlideInR_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_TransitionSlideInR_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_TransitionSlideInR_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_TransitionSlideInR_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_TransitionSlideInR_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("ctor", js_cocos2dx_TransitionSlideInR_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_TransitionSlideInR_create, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_TransitionSlideInL_prototype);
|
|
jsb_cocos2d_TransitionSlideInR_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_TransitionSlideInR_class,
|
|
js_cocos2dx_TransitionSlideInR_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_TransitionSlideInR_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "TransitionSlideInR"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::TransitionSlideInR>(cx, jsb_cocos2d_TransitionSlideInR_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.TransitionSlideInR.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_TransitionSlideInB_class;
|
|
JSObject *jsb_cocos2d_TransitionSlideInB_prototype;
|
|
|
|
bool js_cocos2dx_TransitionSlideInB_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 2) {
|
|
double arg0 = 0;
|
|
cocos2d::Scene* arg1 = nullptr;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::Scene*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TransitionSlideInB_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::TransitionSlideInB::create(arg0, arg1);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TransitionSlideInB>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::TransitionSlideInB"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_TransitionSlideInB_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_TransitionSlideInB_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::TransitionSlideInB* cobj = new (std::nothrow) cocos2d::TransitionSlideInB();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TransitionSlideInB>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::TransitionSlideInB"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_TransitionSlideInB_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::TransitionSlideInB *nobj = new (std::nothrow) cocos2d::TransitionSlideInB();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::TransitionSlideInB");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_TransitionSlideInL_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_TransitionSlideInB(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_TransitionSlideInB_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_TransitionSlideInB_class->name = "TransitionSlideInB";
|
|
jsb_cocos2d_TransitionSlideInB_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TransitionSlideInB_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_TransitionSlideInB_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TransitionSlideInB_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_TransitionSlideInB_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_TransitionSlideInB_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_TransitionSlideInB_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_TransitionSlideInB_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("ctor", js_cocos2dx_TransitionSlideInB_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_TransitionSlideInB_create, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_TransitionSlideInL_prototype);
|
|
jsb_cocos2d_TransitionSlideInB_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_TransitionSlideInB_class,
|
|
js_cocos2dx_TransitionSlideInB_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_TransitionSlideInB_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "TransitionSlideInB"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::TransitionSlideInB>(cx, jsb_cocos2d_TransitionSlideInB_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.TransitionSlideInB.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_TransitionSlideInT_class;
|
|
JSObject *jsb_cocos2d_TransitionSlideInT_prototype;
|
|
|
|
bool js_cocos2dx_TransitionSlideInT_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 2) {
|
|
double arg0 = 0;
|
|
cocos2d::Scene* arg1 = nullptr;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::Scene*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TransitionSlideInT_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::TransitionSlideInT::create(arg0, arg1);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TransitionSlideInT>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::TransitionSlideInT"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_TransitionSlideInT_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_TransitionSlideInT_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::TransitionSlideInT* cobj = new (std::nothrow) cocos2d::TransitionSlideInT();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TransitionSlideInT>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::TransitionSlideInT"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_TransitionSlideInT_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::TransitionSlideInT *nobj = new (std::nothrow) cocos2d::TransitionSlideInT();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::TransitionSlideInT");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_TransitionSlideInL_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_TransitionSlideInT(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_TransitionSlideInT_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_TransitionSlideInT_class->name = "TransitionSlideInT";
|
|
jsb_cocos2d_TransitionSlideInT_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TransitionSlideInT_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_TransitionSlideInT_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TransitionSlideInT_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_TransitionSlideInT_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_TransitionSlideInT_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_TransitionSlideInT_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_TransitionSlideInT_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("ctor", js_cocos2dx_TransitionSlideInT_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_TransitionSlideInT_create, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_TransitionSlideInL_prototype);
|
|
jsb_cocos2d_TransitionSlideInT_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_TransitionSlideInT_class,
|
|
js_cocos2dx_TransitionSlideInT_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_TransitionSlideInT_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "TransitionSlideInT"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::TransitionSlideInT>(cx, jsb_cocos2d_TransitionSlideInT_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.TransitionSlideInT.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_TransitionShrinkGrow_class;
|
|
JSObject *jsb_cocos2d_TransitionShrinkGrow_prototype;
|
|
|
|
bool js_cocos2dx_TransitionShrinkGrow_easeActionWithAction(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TransitionShrinkGrow* cobj = (cocos2d::TransitionShrinkGrow *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TransitionShrinkGrow_easeActionWithAction : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::ActionInterval* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TransitionShrinkGrow_easeActionWithAction : Error processing arguments");
|
|
cocos2d::ActionInterval* ret = cobj->easeActionWithAction(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::ActionInterval>(cx, (cocos2d::ActionInterval*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TransitionShrinkGrow_easeActionWithAction : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TransitionShrinkGrow_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 2) {
|
|
double arg0 = 0;
|
|
cocos2d::Scene* arg1 = nullptr;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::Scene*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TransitionShrinkGrow_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::TransitionShrinkGrow::create(arg0, arg1);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TransitionShrinkGrow>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::TransitionShrinkGrow"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_TransitionShrinkGrow_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_TransitionShrinkGrow_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::TransitionShrinkGrow* cobj = new (std::nothrow) cocos2d::TransitionShrinkGrow();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TransitionShrinkGrow>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::TransitionShrinkGrow"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_TransitionShrinkGrow_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::TransitionShrinkGrow *nobj = new (std::nothrow) cocos2d::TransitionShrinkGrow();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::TransitionShrinkGrow");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_TransitionScene_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_TransitionShrinkGrow(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_TransitionShrinkGrow_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_TransitionShrinkGrow_class->name = "TransitionShrinkGrow";
|
|
jsb_cocos2d_TransitionShrinkGrow_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TransitionShrinkGrow_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_TransitionShrinkGrow_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TransitionShrinkGrow_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_TransitionShrinkGrow_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_TransitionShrinkGrow_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_TransitionShrinkGrow_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_TransitionShrinkGrow_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("easeActionWithAction", js_cocos2dx_TransitionShrinkGrow_easeActionWithAction, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_TransitionShrinkGrow_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_TransitionShrinkGrow_create, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_TransitionScene_prototype);
|
|
jsb_cocos2d_TransitionShrinkGrow_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_TransitionShrinkGrow_class,
|
|
js_cocos2dx_TransitionShrinkGrow_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_TransitionShrinkGrow_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "TransitionShrinkGrow"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::TransitionShrinkGrow>(cx, jsb_cocos2d_TransitionShrinkGrow_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.TransitionShrinkGrow.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_TransitionFlipX_class;
|
|
JSObject *jsb_cocos2d_TransitionFlipX_prototype;
|
|
|
|
bool js_cocos2dx_TransitionFlipX_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
|
|
do {
|
|
if (argc == 2) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Scene* arg1 = nullptr;
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::Scene*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::TransitionFlipX* ret = cocos2d::TransitionFlipX::create(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::TransitionFlipX>(cx, (cocos2d::TransitionFlipX*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
|
|
do {
|
|
if (argc == 3) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Scene* arg1 = nullptr;
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::Scene*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::TransitionScene::Orientation arg2;
|
|
ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::TransitionFlipX* ret = cocos2d::TransitionFlipX::create(arg0, arg1, arg2);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::TransitionFlipX>(cx, (cocos2d::TransitionFlipX*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
JS_ReportError(cx, "js_cocos2dx_TransitionFlipX_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TransitionFlipX_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::TransitionFlipX* cobj = new (std::nothrow) cocos2d::TransitionFlipX();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TransitionFlipX>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::TransitionFlipX"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_TransitionFlipX_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::TransitionFlipX *nobj = new (std::nothrow) cocos2d::TransitionFlipX();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::TransitionFlipX");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_TransitionSceneOriented_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_TransitionFlipX(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_TransitionFlipX_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_TransitionFlipX_class->name = "TransitionFlipX";
|
|
jsb_cocos2d_TransitionFlipX_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TransitionFlipX_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_TransitionFlipX_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TransitionFlipX_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_TransitionFlipX_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_TransitionFlipX_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_TransitionFlipX_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_TransitionFlipX_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("ctor", js_cocos2dx_TransitionFlipX_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_TransitionFlipX_create, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_TransitionSceneOriented_prototype);
|
|
jsb_cocos2d_TransitionFlipX_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_TransitionFlipX_class,
|
|
js_cocos2dx_TransitionFlipX_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_TransitionFlipX_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "TransitionFlipX"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::TransitionFlipX>(cx, jsb_cocos2d_TransitionFlipX_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.TransitionFlipX.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_TransitionFlipY_class;
|
|
JSObject *jsb_cocos2d_TransitionFlipY_prototype;
|
|
|
|
bool js_cocos2dx_TransitionFlipY_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
|
|
do {
|
|
if (argc == 2) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Scene* arg1 = nullptr;
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::Scene*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::TransitionFlipY* ret = cocos2d::TransitionFlipY::create(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::TransitionFlipY>(cx, (cocos2d::TransitionFlipY*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
|
|
do {
|
|
if (argc == 3) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Scene* arg1 = nullptr;
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::Scene*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::TransitionScene::Orientation arg2;
|
|
ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::TransitionFlipY* ret = cocos2d::TransitionFlipY::create(arg0, arg1, arg2);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::TransitionFlipY>(cx, (cocos2d::TransitionFlipY*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
JS_ReportError(cx, "js_cocos2dx_TransitionFlipY_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TransitionFlipY_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::TransitionFlipY* cobj = new (std::nothrow) cocos2d::TransitionFlipY();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TransitionFlipY>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::TransitionFlipY"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_TransitionFlipY_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::TransitionFlipY *nobj = new (std::nothrow) cocos2d::TransitionFlipY();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::TransitionFlipY");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_TransitionSceneOriented_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_TransitionFlipY(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_TransitionFlipY_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_TransitionFlipY_class->name = "TransitionFlipY";
|
|
jsb_cocos2d_TransitionFlipY_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TransitionFlipY_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_TransitionFlipY_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TransitionFlipY_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_TransitionFlipY_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_TransitionFlipY_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_TransitionFlipY_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_TransitionFlipY_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("ctor", js_cocos2dx_TransitionFlipY_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_TransitionFlipY_create, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_TransitionSceneOriented_prototype);
|
|
jsb_cocos2d_TransitionFlipY_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_TransitionFlipY_class,
|
|
js_cocos2dx_TransitionFlipY_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_TransitionFlipY_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "TransitionFlipY"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::TransitionFlipY>(cx, jsb_cocos2d_TransitionFlipY_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.TransitionFlipY.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_TransitionFlipAngular_class;
|
|
JSObject *jsb_cocos2d_TransitionFlipAngular_prototype;
|
|
|
|
bool js_cocos2dx_TransitionFlipAngular_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
|
|
do {
|
|
if (argc == 2) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Scene* arg1 = nullptr;
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::Scene*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::TransitionFlipAngular* ret = cocos2d::TransitionFlipAngular::create(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::TransitionFlipAngular>(cx, (cocos2d::TransitionFlipAngular*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
|
|
do {
|
|
if (argc == 3) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Scene* arg1 = nullptr;
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::Scene*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::TransitionScene::Orientation arg2;
|
|
ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::TransitionFlipAngular* ret = cocos2d::TransitionFlipAngular::create(arg0, arg1, arg2);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::TransitionFlipAngular>(cx, (cocos2d::TransitionFlipAngular*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
JS_ReportError(cx, "js_cocos2dx_TransitionFlipAngular_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TransitionFlipAngular_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::TransitionFlipAngular* cobj = new (std::nothrow) cocos2d::TransitionFlipAngular();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TransitionFlipAngular>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::TransitionFlipAngular"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_TransitionFlipAngular_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::TransitionFlipAngular *nobj = new (std::nothrow) cocos2d::TransitionFlipAngular();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::TransitionFlipAngular");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_TransitionSceneOriented_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_TransitionFlipAngular(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_TransitionFlipAngular_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_TransitionFlipAngular_class->name = "TransitionFlipAngular";
|
|
jsb_cocos2d_TransitionFlipAngular_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TransitionFlipAngular_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_TransitionFlipAngular_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TransitionFlipAngular_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_TransitionFlipAngular_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_TransitionFlipAngular_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_TransitionFlipAngular_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_TransitionFlipAngular_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("ctor", js_cocos2dx_TransitionFlipAngular_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_TransitionFlipAngular_create, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_TransitionSceneOriented_prototype);
|
|
jsb_cocos2d_TransitionFlipAngular_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_TransitionFlipAngular_class,
|
|
js_cocos2dx_TransitionFlipAngular_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_TransitionFlipAngular_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "TransitionFlipAngular"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::TransitionFlipAngular>(cx, jsb_cocos2d_TransitionFlipAngular_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.TransitionFlipAngular.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_TransitionZoomFlipX_class;
|
|
JSObject *jsb_cocos2d_TransitionZoomFlipX_prototype;
|
|
|
|
bool js_cocos2dx_TransitionZoomFlipX_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
|
|
do {
|
|
if (argc == 2) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Scene* arg1 = nullptr;
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::Scene*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::TransitionZoomFlipX* ret = cocos2d::TransitionZoomFlipX::create(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::TransitionZoomFlipX>(cx, (cocos2d::TransitionZoomFlipX*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
|
|
do {
|
|
if (argc == 3) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Scene* arg1 = nullptr;
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::Scene*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::TransitionScene::Orientation arg2;
|
|
ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::TransitionZoomFlipX* ret = cocos2d::TransitionZoomFlipX::create(arg0, arg1, arg2);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::TransitionZoomFlipX>(cx, (cocos2d::TransitionZoomFlipX*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
JS_ReportError(cx, "js_cocos2dx_TransitionZoomFlipX_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TransitionZoomFlipX_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::TransitionZoomFlipX* cobj = new (std::nothrow) cocos2d::TransitionZoomFlipX();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TransitionZoomFlipX>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::TransitionZoomFlipX"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_TransitionZoomFlipX_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::TransitionZoomFlipX *nobj = new (std::nothrow) cocos2d::TransitionZoomFlipX();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::TransitionZoomFlipX");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_TransitionSceneOriented_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_TransitionZoomFlipX(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_TransitionZoomFlipX_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_TransitionZoomFlipX_class->name = "TransitionZoomFlipX";
|
|
jsb_cocos2d_TransitionZoomFlipX_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TransitionZoomFlipX_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_TransitionZoomFlipX_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TransitionZoomFlipX_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_TransitionZoomFlipX_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_TransitionZoomFlipX_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_TransitionZoomFlipX_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_TransitionZoomFlipX_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("ctor", js_cocos2dx_TransitionZoomFlipX_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_TransitionZoomFlipX_create, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_TransitionSceneOriented_prototype);
|
|
jsb_cocos2d_TransitionZoomFlipX_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_TransitionZoomFlipX_class,
|
|
js_cocos2dx_TransitionZoomFlipX_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_TransitionZoomFlipX_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "TransitionZoomFlipX"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::TransitionZoomFlipX>(cx, jsb_cocos2d_TransitionZoomFlipX_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.TransitionZoomFlipX.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_TransitionZoomFlipY_class;
|
|
JSObject *jsb_cocos2d_TransitionZoomFlipY_prototype;
|
|
|
|
bool js_cocos2dx_TransitionZoomFlipY_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
|
|
do {
|
|
if (argc == 2) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Scene* arg1 = nullptr;
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::Scene*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::TransitionZoomFlipY* ret = cocos2d::TransitionZoomFlipY::create(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::TransitionZoomFlipY>(cx, (cocos2d::TransitionZoomFlipY*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
|
|
do {
|
|
if (argc == 3) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Scene* arg1 = nullptr;
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::Scene*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::TransitionScene::Orientation arg2;
|
|
ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::TransitionZoomFlipY* ret = cocos2d::TransitionZoomFlipY::create(arg0, arg1, arg2);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::TransitionZoomFlipY>(cx, (cocos2d::TransitionZoomFlipY*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
JS_ReportError(cx, "js_cocos2dx_TransitionZoomFlipY_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TransitionZoomFlipY_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::TransitionZoomFlipY* cobj = new (std::nothrow) cocos2d::TransitionZoomFlipY();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TransitionZoomFlipY>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::TransitionZoomFlipY"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_TransitionZoomFlipY_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::TransitionZoomFlipY *nobj = new (std::nothrow) cocos2d::TransitionZoomFlipY();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::TransitionZoomFlipY");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_TransitionSceneOriented_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_TransitionZoomFlipY(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_TransitionZoomFlipY_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_TransitionZoomFlipY_class->name = "TransitionZoomFlipY";
|
|
jsb_cocos2d_TransitionZoomFlipY_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TransitionZoomFlipY_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_TransitionZoomFlipY_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TransitionZoomFlipY_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_TransitionZoomFlipY_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_TransitionZoomFlipY_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_TransitionZoomFlipY_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_TransitionZoomFlipY_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("ctor", js_cocos2dx_TransitionZoomFlipY_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_TransitionZoomFlipY_create, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_TransitionSceneOriented_prototype);
|
|
jsb_cocos2d_TransitionZoomFlipY_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_TransitionZoomFlipY_class,
|
|
js_cocos2dx_TransitionZoomFlipY_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_TransitionZoomFlipY_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "TransitionZoomFlipY"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::TransitionZoomFlipY>(cx, jsb_cocos2d_TransitionZoomFlipY_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.TransitionZoomFlipY.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_TransitionZoomFlipAngular_class;
|
|
JSObject *jsb_cocos2d_TransitionZoomFlipAngular_prototype;
|
|
|
|
bool js_cocos2dx_TransitionZoomFlipAngular_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
|
|
do {
|
|
if (argc == 2) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Scene* arg1 = nullptr;
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::Scene*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::TransitionZoomFlipAngular* ret = cocos2d::TransitionZoomFlipAngular::create(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::TransitionZoomFlipAngular>(cx, (cocos2d::TransitionZoomFlipAngular*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
|
|
do {
|
|
if (argc == 3) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Scene* arg1 = nullptr;
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::Scene*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::TransitionScene::Orientation arg2;
|
|
ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::TransitionZoomFlipAngular* ret = cocos2d::TransitionZoomFlipAngular::create(arg0, arg1, arg2);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::TransitionZoomFlipAngular>(cx, (cocos2d::TransitionZoomFlipAngular*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
JS_ReportError(cx, "js_cocos2dx_TransitionZoomFlipAngular_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TransitionZoomFlipAngular_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::TransitionZoomFlipAngular* cobj = new (std::nothrow) cocos2d::TransitionZoomFlipAngular();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TransitionZoomFlipAngular>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::TransitionZoomFlipAngular"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_TransitionZoomFlipAngular_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::TransitionZoomFlipAngular *nobj = new (std::nothrow) cocos2d::TransitionZoomFlipAngular();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::TransitionZoomFlipAngular");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_TransitionSceneOriented_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_TransitionZoomFlipAngular(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_TransitionZoomFlipAngular_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_TransitionZoomFlipAngular_class->name = "TransitionZoomFlipAngular";
|
|
jsb_cocos2d_TransitionZoomFlipAngular_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TransitionZoomFlipAngular_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_TransitionZoomFlipAngular_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TransitionZoomFlipAngular_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_TransitionZoomFlipAngular_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_TransitionZoomFlipAngular_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_TransitionZoomFlipAngular_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_TransitionZoomFlipAngular_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("ctor", js_cocos2dx_TransitionZoomFlipAngular_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_TransitionZoomFlipAngular_create, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_TransitionSceneOriented_prototype);
|
|
jsb_cocos2d_TransitionZoomFlipAngular_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_TransitionZoomFlipAngular_class,
|
|
js_cocos2dx_TransitionZoomFlipAngular_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_TransitionZoomFlipAngular_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "TransitionZoomFlipAngular"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::TransitionZoomFlipAngular>(cx, jsb_cocos2d_TransitionZoomFlipAngular_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.TransitionZoomFlipAngular.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_TransitionFade_class;
|
|
JSObject *jsb_cocos2d_TransitionFade_prototype;
|
|
|
|
bool js_cocos2dx_TransitionFade_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::TransitionFade* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::TransitionFade *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TransitionFade_initWithDuration : Invalid Native Object");
|
|
do {
|
|
if (argc == 2) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Scene* arg1 = nullptr;
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::Scene*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
if (!ok) { ok = true; break; }
|
|
bool ret = cobj->initWithDuration(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 3) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Scene* arg1 = nullptr;
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::Scene*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Color3B arg2;
|
|
ok &= jsval_to_cccolor3b(cx, args.get(2), &arg2);
|
|
if (!ok) { ok = true; break; }
|
|
bool ret = cobj->initWithDuration(arg0, arg1, arg2);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TransitionFade_initWithDuration : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TransitionFade_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
|
|
do {
|
|
if (argc == 2) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Scene* arg1 = nullptr;
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::Scene*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::TransitionFade* ret = cocos2d::TransitionFade::create(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::TransitionFade>(cx, (cocos2d::TransitionFade*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
|
|
do {
|
|
if (argc == 3) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Scene* arg1 = nullptr;
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::Scene*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Color3B arg2;
|
|
ok &= jsval_to_cccolor3b(cx, args.get(2), &arg2);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::TransitionFade* ret = cocos2d::TransitionFade::create(arg0, arg1, arg2);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::TransitionFade>(cx, (cocos2d::TransitionFade*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
JS_ReportError(cx, "js_cocos2dx_TransitionFade_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TransitionFade_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::TransitionFade* cobj = new (std::nothrow) cocos2d::TransitionFade();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TransitionFade>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::TransitionFade"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_TransitionFade_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::TransitionFade *nobj = new (std::nothrow) cocos2d::TransitionFade();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::TransitionFade");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_TransitionScene_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_TransitionFade(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_TransitionFade_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_TransitionFade_class->name = "TransitionFade";
|
|
jsb_cocos2d_TransitionFade_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TransitionFade_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_TransitionFade_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TransitionFade_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_TransitionFade_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_TransitionFade_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_TransitionFade_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_TransitionFade_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("initWithDuration", js_cocos2dx_TransitionFade_initWithDuration, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_TransitionFade_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_TransitionFade_create, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_TransitionScene_prototype);
|
|
jsb_cocos2d_TransitionFade_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_TransitionFade_class,
|
|
js_cocos2dx_TransitionFade_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_TransitionFade_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "TransitionFade"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::TransitionFade>(cx, jsb_cocos2d_TransitionFade_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.TransitionFade.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_TransitionCrossFade_class;
|
|
JSObject *jsb_cocos2d_TransitionCrossFade_prototype;
|
|
|
|
bool js_cocos2dx_TransitionCrossFade_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 2) {
|
|
double arg0 = 0;
|
|
cocos2d::Scene* arg1 = nullptr;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::Scene*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TransitionCrossFade_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::TransitionCrossFade::create(arg0, arg1);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TransitionCrossFade>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::TransitionCrossFade"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_TransitionCrossFade_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_TransitionCrossFade_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::TransitionCrossFade* cobj = new (std::nothrow) cocos2d::TransitionCrossFade();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TransitionCrossFade>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::TransitionCrossFade"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_TransitionCrossFade_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::TransitionCrossFade *nobj = new (std::nothrow) cocos2d::TransitionCrossFade();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::TransitionCrossFade");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_TransitionScene_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_TransitionCrossFade(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_TransitionCrossFade_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_TransitionCrossFade_class->name = "TransitionCrossFade";
|
|
jsb_cocos2d_TransitionCrossFade_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TransitionCrossFade_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_TransitionCrossFade_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TransitionCrossFade_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_TransitionCrossFade_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_TransitionCrossFade_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_TransitionCrossFade_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_TransitionCrossFade_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("ctor", js_cocos2dx_TransitionCrossFade_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_TransitionCrossFade_create, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_TransitionScene_prototype);
|
|
jsb_cocos2d_TransitionCrossFade_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_TransitionCrossFade_class,
|
|
js_cocos2dx_TransitionCrossFade_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_TransitionCrossFade_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "TransitionCrossFade"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::TransitionCrossFade>(cx, jsb_cocos2d_TransitionCrossFade_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.TransitionCrossFade.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_TransitionTurnOffTiles_class;
|
|
JSObject *jsb_cocos2d_TransitionTurnOffTiles_prototype;
|
|
|
|
bool js_cocos2dx_TransitionTurnOffTiles_easeActionWithAction(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TransitionTurnOffTiles* cobj = (cocos2d::TransitionTurnOffTiles *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TransitionTurnOffTiles_easeActionWithAction : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::ActionInterval* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TransitionTurnOffTiles_easeActionWithAction : Error processing arguments");
|
|
cocos2d::ActionInterval* ret = cobj->easeActionWithAction(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::ActionInterval>(cx, (cocos2d::ActionInterval*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TransitionTurnOffTiles_easeActionWithAction : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TransitionTurnOffTiles_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 2) {
|
|
double arg0 = 0;
|
|
cocos2d::Scene* arg1 = nullptr;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::Scene*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TransitionTurnOffTiles_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::TransitionTurnOffTiles::create(arg0, arg1);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TransitionTurnOffTiles>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::TransitionTurnOffTiles"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_TransitionTurnOffTiles_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_TransitionTurnOffTiles_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::TransitionTurnOffTiles* cobj = new (std::nothrow) cocos2d::TransitionTurnOffTiles();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TransitionTurnOffTiles>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::TransitionTurnOffTiles"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_TransitionTurnOffTiles_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::TransitionTurnOffTiles *nobj = new (std::nothrow) cocos2d::TransitionTurnOffTiles();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::TransitionTurnOffTiles");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_TransitionScene_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_TransitionTurnOffTiles(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_TransitionTurnOffTiles_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_TransitionTurnOffTiles_class->name = "TransitionTurnOffTiles";
|
|
jsb_cocos2d_TransitionTurnOffTiles_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TransitionTurnOffTiles_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_TransitionTurnOffTiles_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TransitionTurnOffTiles_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_TransitionTurnOffTiles_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_TransitionTurnOffTiles_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_TransitionTurnOffTiles_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_TransitionTurnOffTiles_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("easeActionWithAction", js_cocos2dx_TransitionTurnOffTiles_easeActionWithAction, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_TransitionTurnOffTiles_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_TransitionTurnOffTiles_create, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_TransitionScene_prototype);
|
|
jsb_cocos2d_TransitionTurnOffTiles_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_TransitionTurnOffTiles_class,
|
|
js_cocos2dx_TransitionTurnOffTiles_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_TransitionTurnOffTiles_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "TransitionTurnOffTiles"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::TransitionTurnOffTiles>(cx, jsb_cocos2d_TransitionTurnOffTiles_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.TransitionTurnOffTiles.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_TransitionSplitCols_class;
|
|
JSObject *jsb_cocos2d_TransitionSplitCols_prototype;
|
|
|
|
bool js_cocos2dx_TransitionSplitCols_action(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TransitionSplitCols* cobj = (cocos2d::TransitionSplitCols *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TransitionSplitCols_action : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::ActionInterval* ret = cobj->action();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::ActionInterval>(cx, (cocos2d::ActionInterval*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TransitionSplitCols_action : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TransitionSplitCols_easeActionWithAction(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TransitionSplitCols* cobj = (cocos2d::TransitionSplitCols *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TransitionSplitCols_easeActionWithAction : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::ActionInterval* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TransitionSplitCols_easeActionWithAction : Error processing arguments");
|
|
cocos2d::ActionInterval* ret = cobj->easeActionWithAction(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::ActionInterval>(cx, (cocos2d::ActionInterval*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TransitionSplitCols_easeActionWithAction : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TransitionSplitCols_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 2) {
|
|
double arg0 = 0;
|
|
cocos2d::Scene* arg1 = nullptr;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::Scene*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TransitionSplitCols_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::TransitionSplitCols::create(arg0, arg1);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TransitionSplitCols>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::TransitionSplitCols"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_TransitionSplitCols_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_TransitionSplitCols_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::TransitionSplitCols* cobj = new (std::nothrow) cocos2d::TransitionSplitCols();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TransitionSplitCols>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::TransitionSplitCols"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_TransitionSplitCols_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::TransitionSplitCols *nobj = new (std::nothrow) cocos2d::TransitionSplitCols();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::TransitionSplitCols");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_TransitionScene_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_TransitionSplitCols(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_TransitionSplitCols_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_TransitionSplitCols_class->name = "TransitionSplitCols";
|
|
jsb_cocos2d_TransitionSplitCols_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TransitionSplitCols_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_TransitionSplitCols_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TransitionSplitCols_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_TransitionSplitCols_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_TransitionSplitCols_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_TransitionSplitCols_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_TransitionSplitCols_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("action", js_cocos2dx_TransitionSplitCols_action, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("easeActionWithAction", js_cocos2dx_TransitionSplitCols_easeActionWithAction, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_TransitionSplitCols_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_TransitionSplitCols_create, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_TransitionScene_prototype);
|
|
jsb_cocos2d_TransitionSplitCols_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_TransitionSplitCols_class,
|
|
js_cocos2dx_TransitionSplitCols_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_TransitionSplitCols_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "TransitionSplitCols"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::TransitionSplitCols>(cx, jsb_cocos2d_TransitionSplitCols_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.TransitionSplitCols.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_TransitionSplitRows_class;
|
|
JSObject *jsb_cocos2d_TransitionSplitRows_prototype;
|
|
|
|
bool js_cocos2dx_TransitionSplitRows_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 2) {
|
|
double arg0 = 0;
|
|
cocos2d::Scene* arg1 = nullptr;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::Scene*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TransitionSplitRows_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::TransitionSplitRows::create(arg0, arg1);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TransitionSplitRows>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::TransitionSplitRows"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_TransitionSplitRows_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_TransitionSplitRows_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::TransitionSplitRows* cobj = new (std::nothrow) cocos2d::TransitionSplitRows();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TransitionSplitRows>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::TransitionSplitRows"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_TransitionSplitRows_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::TransitionSplitRows *nobj = new (std::nothrow) cocos2d::TransitionSplitRows();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::TransitionSplitRows");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_TransitionSplitCols_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_TransitionSplitRows(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_TransitionSplitRows_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_TransitionSplitRows_class->name = "TransitionSplitRows";
|
|
jsb_cocos2d_TransitionSplitRows_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TransitionSplitRows_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_TransitionSplitRows_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TransitionSplitRows_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_TransitionSplitRows_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_TransitionSplitRows_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_TransitionSplitRows_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_TransitionSplitRows_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("ctor", js_cocos2dx_TransitionSplitRows_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_TransitionSplitRows_create, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_TransitionSplitCols_prototype);
|
|
jsb_cocos2d_TransitionSplitRows_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_TransitionSplitRows_class,
|
|
js_cocos2dx_TransitionSplitRows_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_TransitionSplitRows_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "TransitionSplitRows"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::TransitionSplitRows>(cx, jsb_cocos2d_TransitionSplitRows_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.TransitionSplitRows.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_TransitionFadeTR_class;
|
|
JSObject *jsb_cocos2d_TransitionFadeTR_prototype;
|
|
|
|
bool js_cocos2dx_TransitionFadeTR_easeActionWithAction(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TransitionFadeTR* cobj = (cocos2d::TransitionFadeTR *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TransitionFadeTR_easeActionWithAction : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::ActionInterval* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::ActionInterval*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TransitionFadeTR_easeActionWithAction : Error processing arguments");
|
|
cocos2d::ActionInterval* ret = cobj->easeActionWithAction(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::ActionInterval>(cx, (cocos2d::ActionInterval*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TransitionFadeTR_easeActionWithAction : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TransitionFadeTR_actionWithSize(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TransitionFadeTR* cobj = (cocos2d::TransitionFadeTR *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TransitionFadeTR_actionWithSize : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Size arg0;
|
|
ok &= jsval_to_ccsize(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TransitionFadeTR_actionWithSize : Error processing arguments");
|
|
cocos2d::ActionInterval* ret = cobj->actionWithSize(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::ActionInterval>(cx, (cocos2d::ActionInterval*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TransitionFadeTR_actionWithSize : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TransitionFadeTR_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 2) {
|
|
double arg0 = 0;
|
|
cocos2d::Scene* arg1 = nullptr;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::Scene*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TransitionFadeTR_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::TransitionFadeTR::create(arg0, arg1);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TransitionFadeTR>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::TransitionFadeTR"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_TransitionFadeTR_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_TransitionFadeTR_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::TransitionFadeTR* cobj = new (std::nothrow) cocos2d::TransitionFadeTR();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TransitionFadeTR>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::TransitionFadeTR"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_TransitionFadeTR_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::TransitionFadeTR *nobj = new (std::nothrow) cocos2d::TransitionFadeTR();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::TransitionFadeTR");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_TransitionScene_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_TransitionFadeTR(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_TransitionFadeTR_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_TransitionFadeTR_class->name = "TransitionFadeTR";
|
|
jsb_cocos2d_TransitionFadeTR_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TransitionFadeTR_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_TransitionFadeTR_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TransitionFadeTR_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_TransitionFadeTR_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_TransitionFadeTR_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_TransitionFadeTR_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_TransitionFadeTR_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("easeActionWithAction", js_cocos2dx_TransitionFadeTR_easeActionWithAction, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("actionWithSize", js_cocos2dx_TransitionFadeTR_actionWithSize, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_TransitionFadeTR_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_TransitionFadeTR_create, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_TransitionScene_prototype);
|
|
jsb_cocos2d_TransitionFadeTR_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_TransitionFadeTR_class,
|
|
js_cocos2dx_TransitionFadeTR_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_TransitionFadeTR_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "TransitionFadeTR"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::TransitionFadeTR>(cx, jsb_cocos2d_TransitionFadeTR_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.TransitionFadeTR.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_TransitionFadeBL_class;
|
|
JSObject *jsb_cocos2d_TransitionFadeBL_prototype;
|
|
|
|
bool js_cocos2dx_TransitionFadeBL_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 2) {
|
|
double arg0 = 0;
|
|
cocos2d::Scene* arg1 = nullptr;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::Scene*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TransitionFadeBL_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::TransitionFadeBL::create(arg0, arg1);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TransitionFadeBL>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::TransitionFadeBL"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_TransitionFadeBL_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_TransitionFadeBL_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::TransitionFadeBL* cobj = new (std::nothrow) cocos2d::TransitionFadeBL();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TransitionFadeBL>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::TransitionFadeBL"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_TransitionFadeBL_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::TransitionFadeBL *nobj = new (std::nothrow) cocos2d::TransitionFadeBL();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::TransitionFadeBL");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_TransitionFadeTR_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_TransitionFadeBL(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_TransitionFadeBL_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_TransitionFadeBL_class->name = "TransitionFadeBL";
|
|
jsb_cocos2d_TransitionFadeBL_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TransitionFadeBL_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_TransitionFadeBL_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TransitionFadeBL_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_TransitionFadeBL_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_TransitionFadeBL_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_TransitionFadeBL_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_TransitionFadeBL_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("ctor", js_cocos2dx_TransitionFadeBL_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_TransitionFadeBL_create, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_TransitionFadeTR_prototype);
|
|
jsb_cocos2d_TransitionFadeBL_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_TransitionFadeBL_class,
|
|
js_cocos2dx_TransitionFadeBL_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_TransitionFadeBL_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "TransitionFadeBL"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::TransitionFadeBL>(cx, jsb_cocos2d_TransitionFadeBL_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.TransitionFadeBL.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_TransitionFadeUp_class;
|
|
JSObject *jsb_cocos2d_TransitionFadeUp_prototype;
|
|
|
|
bool js_cocos2dx_TransitionFadeUp_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 2) {
|
|
double arg0 = 0;
|
|
cocos2d::Scene* arg1 = nullptr;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::Scene*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TransitionFadeUp_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::TransitionFadeUp::create(arg0, arg1);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TransitionFadeUp>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::TransitionFadeUp"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_TransitionFadeUp_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_TransitionFadeUp_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::TransitionFadeUp* cobj = new (std::nothrow) cocos2d::TransitionFadeUp();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TransitionFadeUp>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::TransitionFadeUp"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_TransitionFadeUp_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::TransitionFadeUp *nobj = new (std::nothrow) cocos2d::TransitionFadeUp();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::TransitionFadeUp");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_TransitionFadeTR_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_TransitionFadeUp(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_TransitionFadeUp_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_TransitionFadeUp_class->name = "TransitionFadeUp";
|
|
jsb_cocos2d_TransitionFadeUp_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TransitionFadeUp_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_TransitionFadeUp_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TransitionFadeUp_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_TransitionFadeUp_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_TransitionFadeUp_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_TransitionFadeUp_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_TransitionFadeUp_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("ctor", js_cocos2dx_TransitionFadeUp_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_TransitionFadeUp_create, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_TransitionFadeTR_prototype);
|
|
jsb_cocos2d_TransitionFadeUp_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_TransitionFadeUp_class,
|
|
js_cocos2dx_TransitionFadeUp_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_TransitionFadeUp_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "TransitionFadeUp"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::TransitionFadeUp>(cx, jsb_cocos2d_TransitionFadeUp_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.TransitionFadeUp.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_TransitionFadeDown_class;
|
|
JSObject *jsb_cocos2d_TransitionFadeDown_prototype;
|
|
|
|
bool js_cocos2dx_TransitionFadeDown_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 2) {
|
|
double arg0 = 0;
|
|
cocos2d::Scene* arg1 = nullptr;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::Scene*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TransitionFadeDown_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::TransitionFadeDown::create(arg0, arg1);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TransitionFadeDown>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::TransitionFadeDown"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_TransitionFadeDown_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_TransitionFadeDown_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::TransitionFadeDown* cobj = new (std::nothrow) cocos2d::TransitionFadeDown();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TransitionFadeDown>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::TransitionFadeDown"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_TransitionFadeDown_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::TransitionFadeDown *nobj = new (std::nothrow) cocos2d::TransitionFadeDown();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::TransitionFadeDown");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_TransitionFadeTR_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_TransitionFadeDown(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_TransitionFadeDown_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_TransitionFadeDown_class->name = "TransitionFadeDown";
|
|
jsb_cocos2d_TransitionFadeDown_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TransitionFadeDown_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_TransitionFadeDown_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TransitionFadeDown_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_TransitionFadeDown_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_TransitionFadeDown_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_TransitionFadeDown_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_TransitionFadeDown_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("ctor", js_cocos2dx_TransitionFadeDown_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_TransitionFadeDown_create, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_TransitionFadeTR_prototype);
|
|
jsb_cocos2d_TransitionFadeDown_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_TransitionFadeDown_class,
|
|
js_cocos2dx_TransitionFadeDown_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_TransitionFadeDown_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "TransitionFadeDown"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::TransitionFadeDown>(cx, jsb_cocos2d_TransitionFadeDown_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.TransitionFadeDown.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_TransitionPageTurn_class;
|
|
JSObject *jsb_cocos2d_TransitionPageTurn_prototype;
|
|
|
|
bool js_cocos2dx_TransitionPageTurn_actionWithSize(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TransitionPageTurn* cobj = (cocos2d::TransitionPageTurn *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TransitionPageTurn_actionWithSize : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Size arg0;
|
|
ok &= jsval_to_ccsize(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TransitionPageTurn_actionWithSize : Error processing arguments");
|
|
cocos2d::ActionInterval* ret = cobj->actionWithSize(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::ActionInterval>(cx, (cocos2d::ActionInterval*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TransitionPageTurn_actionWithSize : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TransitionPageTurn_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TransitionPageTurn* cobj = (cocos2d::TransitionPageTurn *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TransitionPageTurn_initWithDuration : Invalid Native Object");
|
|
if (argc == 3) {
|
|
double arg0 = 0;
|
|
cocos2d::Scene* arg1 = nullptr;
|
|
bool arg2;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::Scene*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
arg2 = JS::ToBoolean(args.get(2));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TransitionPageTurn_initWithDuration : Error processing arguments");
|
|
bool ret = cobj->initWithDuration(arg0, arg1, arg2);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TransitionPageTurn_initWithDuration : wrong number of arguments: %d, was expecting %d", argc, 3);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TransitionPageTurn_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 3) {
|
|
double arg0 = 0;
|
|
cocos2d::Scene* arg1 = nullptr;
|
|
bool arg2;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::Scene*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
arg2 = JS::ToBoolean(args.get(2));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TransitionPageTurn_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::TransitionPageTurn::create(arg0, arg1, arg2);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TransitionPageTurn>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::TransitionPageTurn"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_TransitionPageTurn_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_TransitionPageTurn_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::TransitionPageTurn* cobj = new (std::nothrow) cocos2d::TransitionPageTurn();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TransitionPageTurn>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::TransitionPageTurn"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_TransitionPageTurn_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::TransitionPageTurn *nobj = new (std::nothrow) cocos2d::TransitionPageTurn();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::TransitionPageTurn");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_TransitionScene_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_TransitionPageTurn(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_TransitionPageTurn_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_TransitionPageTurn_class->name = "TransitionPageTurn";
|
|
jsb_cocos2d_TransitionPageTurn_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TransitionPageTurn_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_TransitionPageTurn_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TransitionPageTurn_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_TransitionPageTurn_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_TransitionPageTurn_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_TransitionPageTurn_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_TransitionPageTurn_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("actionWithSize", js_cocos2dx_TransitionPageTurn_actionWithSize, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initWithDuration", js_cocos2dx_TransitionPageTurn_initWithDuration, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_TransitionPageTurn_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_TransitionPageTurn_create, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_TransitionScene_prototype);
|
|
jsb_cocos2d_TransitionPageTurn_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_TransitionPageTurn_class,
|
|
js_cocos2dx_TransitionPageTurn_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_TransitionPageTurn_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "TransitionPageTurn"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::TransitionPageTurn>(cx, jsb_cocos2d_TransitionPageTurn_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.TransitionPageTurn.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_TransitionProgress_class;
|
|
JSObject *jsb_cocos2d_TransitionProgress_prototype;
|
|
|
|
bool js_cocos2dx_TransitionProgress_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 2) {
|
|
double arg0 = 0;
|
|
cocos2d::Scene* arg1 = nullptr;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::Scene*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TransitionProgress_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::TransitionProgress::create(arg0, arg1);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TransitionProgress>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::TransitionProgress"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_TransitionProgress_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_TransitionProgress_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::TransitionProgress* cobj = new (std::nothrow) cocos2d::TransitionProgress();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TransitionProgress>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::TransitionProgress"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_TransitionProgress_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::TransitionProgress *nobj = new (std::nothrow) cocos2d::TransitionProgress();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::TransitionProgress");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_TransitionScene_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_TransitionProgress(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_TransitionProgress_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_TransitionProgress_class->name = "TransitionProgress";
|
|
jsb_cocos2d_TransitionProgress_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TransitionProgress_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_TransitionProgress_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TransitionProgress_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_TransitionProgress_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_TransitionProgress_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_TransitionProgress_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_TransitionProgress_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("ctor", js_cocos2dx_TransitionProgress_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_TransitionProgress_create, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_TransitionScene_prototype);
|
|
jsb_cocos2d_TransitionProgress_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_TransitionProgress_class,
|
|
js_cocos2dx_TransitionProgress_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_TransitionProgress_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "TransitionProgress"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::TransitionProgress>(cx, jsb_cocos2d_TransitionProgress_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.TransitionProgress.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_TransitionProgressRadialCCW_class;
|
|
JSObject *jsb_cocos2d_TransitionProgressRadialCCW_prototype;
|
|
|
|
bool js_cocos2dx_TransitionProgressRadialCCW_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 2) {
|
|
double arg0 = 0;
|
|
cocos2d::Scene* arg1 = nullptr;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::Scene*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TransitionProgressRadialCCW_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::TransitionProgressRadialCCW::create(arg0, arg1);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TransitionProgressRadialCCW>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::TransitionProgressRadialCCW"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_TransitionProgressRadialCCW_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_TransitionProgressRadialCCW_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::TransitionProgressRadialCCW* cobj = new (std::nothrow) cocos2d::TransitionProgressRadialCCW();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TransitionProgressRadialCCW>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::TransitionProgressRadialCCW"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_TransitionProgressRadialCCW_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::TransitionProgressRadialCCW *nobj = new (std::nothrow) cocos2d::TransitionProgressRadialCCW();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::TransitionProgressRadialCCW");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_TransitionProgress_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_TransitionProgressRadialCCW(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_TransitionProgressRadialCCW_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_TransitionProgressRadialCCW_class->name = "TransitionProgressRadialCCW";
|
|
jsb_cocos2d_TransitionProgressRadialCCW_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TransitionProgressRadialCCW_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_TransitionProgressRadialCCW_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TransitionProgressRadialCCW_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_TransitionProgressRadialCCW_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_TransitionProgressRadialCCW_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_TransitionProgressRadialCCW_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_TransitionProgressRadialCCW_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("ctor", js_cocos2dx_TransitionProgressRadialCCW_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_TransitionProgressRadialCCW_create, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_TransitionProgress_prototype);
|
|
jsb_cocos2d_TransitionProgressRadialCCW_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_TransitionProgressRadialCCW_class,
|
|
js_cocos2dx_TransitionProgressRadialCCW_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_TransitionProgressRadialCCW_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "TransitionProgressRadialCCW"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::TransitionProgressRadialCCW>(cx, jsb_cocos2d_TransitionProgressRadialCCW_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.TransitionProgressRadialCCW.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_TransitionProgressRadialCW_class;
|
|
JSObject *jsb_cocos2d_TransitionProgressRadialCW_prototype;
|
|
|
|
bool js_cocos2dx_TransitionProgressRadialCW_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 2) {
|
|
double arg0 = 0;
|
|
cocos2d::Scene* arg1 = nullptr;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::Scene*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TransitionProgressRadialCW_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::TransitionProgressRadialCW::create(arg0, arg1);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TransitionProgressRadialCW>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::TransitionProgressRadialCW"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_TransitionProgressRadialCW_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_TransitionProgressRadialCW_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::TransitionProgressRadialCW* cobj = new (std::nothrow) cocos2d::TransitionProgressRadialCW();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TransitionProgressRadialCW>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::TransitionProgressRadialCW"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_TransitionProgressRadialCW_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::TransitionProgressRadialCW *nobj = new (std::nothrow) cocos2d::TransitionProgressRadialCW();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::TransitionProgressRadialCW");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_TransitionProgress_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_TransitionProgressRadialCW(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_TransitionProgressRadialCW_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_TransitionProgressRadialCW_class->name = "TransitionProgressRadialCW";
|
|
jsb_cocos2d_TransitionProgressRadialCW_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TransitionProgressRadialCW_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_TransitionProgressRadialCW_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TransitionProgressRadialCW_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_TransitionProgressRadialCW_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_TransitionProgressRadialCW_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_TransitionProgressRadialCW_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_TransitionProgressRadialCW_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("ctor", js_cocos2dx_TransitionProgressRadialCW_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_TransitionProgressRadialCW_create, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_TransitionProgress_prototype);
|
|
jsb_cocos2d_TransitionProgressRadialCW_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_TransitionProgressRadialCW_class,
|
|
js_cocos2dx_TransitionProgressRadialCW_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_TransitionProgressRadialCW_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "TransitionProgressRadialCW"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::TransitionProgressRadialCW>(cx, jsb_cocos2d_TransitionProgressRadialCW_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.TransitionProgressRadialCW.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_TransitionProgressHorizontal_class;
|
|
JSObject *jsb_cocos2d_TransitionProgressHorizontal_prototype;
|
|
|
|
bool js_cocos2dx_TransitionProgressHorizontal_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 2) {
|
|
double arg0 = 0;
|
|
cocos2d::Scene* arg1 = nullptr;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::Scene*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TransitionProgressHorizontal_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::TransitionProgressHorizontal::create(arg0, arg1);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TransitionProgressHorizontal>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::TransitionProgressHorizontal"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_TransitionProgressHorizontal_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_TransitionProgressHorizontal_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::TransitionProgressHorizontal* cobj = new (std::nothrow) cocos2d::TransitionProgressHorizontal();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TransitionProgressHorizontal>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::TransitionProgressHorizontal"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_TransitionProgressHorizontal_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::TransitionProgressHorizontal *nobj = new (std::nothrow) cocos2d::TransitionProgressHorizontal();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::TransitionProgressHorizontal");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_TransitionProgress_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_TransitionProgressHorizontal(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_TransitionProgressHorizontal_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_TransitionProgressHorizontal_class->name = "TransitionProgressHorizontal";
|
|
jsb_cocos2d_TransitionProgressHorizontal_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TransitionProgressHorizontal_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_TransitionProgressHorizontal_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TransitionProgressHorizontal_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_TransitionProgressHorizontal_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_TransitionProgressHorizontal_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_TransitionProgressHorizontal_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_TransitionProgressHorizontal_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("ctor", js_cocos2dx_TransitionProgressHorizontal_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_TransitionProgressHorizontal_create, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_TransitionProgress_prototype);
|
|
jsb_cocos2d_TransitionProgressHorizontal_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_TransitionProgressHorizontal_class,
|
|
js_cocos2dx_TransitionProgressHorizontal_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_TransitionProgressHorizontal_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "TransitionProgressHorizontal"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::TransitionProgressHorizontal>(cx, jsb_cocos2d_TransitionProgressHorizontal_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.TransitionProgressHorizontal.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_TransitionProgressVertical_class;
|
|
JSObject *jsb_cocos2d_TransitionProgressVertical_prototype;
|
|
|
|
bool js_cocos2dx_TransitionProgressVertical_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 2) {
|
|
double arg0 = 0;
|
|
cocos2d::Scene* arg1 = nullptr;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::Scene*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TransitionProgressVertical_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::TransitionProgressVertical::create(arg0, arg1);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TransitionProgressVertical>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::TransitionProgressVertical"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_TransitionProgressVertical_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_TransitionProgressVertical_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::TransitionProgressVertical* cobj = new (std::nothrow) cocos2d::TransitionProgressVertical();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TransitionProgressVertical>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::TransitionProgressVertical"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_TransitionProgressVertical_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::TransitionProgressVertical *nobj = new (std::nothrow) cocos2d::TransitionProgressVertical();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::TransitionProgressVertical");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_TransitionProgress_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_TransitionProgressVertical(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_TransitionProgressVertical_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_TransitionProgressVertical_class->name = "TransitionProgressVertical";
|
|
jsb_cocos2d_TransitionProgressVertical_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TransitionProgressVertical_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_TransitionProgressVertical_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TransitionProgressVertical_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_TransitionProgressVertical_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_TransitionProgressVertical_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_TransitionProgressVertical_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_TransitionProgressVertical_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("ctor", js_cocos2dx_TransitionProgressVertical_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_TransitionProgressVertical_create, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_TransitionProgress_prototype);
|
|
jsb_cocos2d_TransitionProgressVertical_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_TransitionProgressVertical_class,
|
|
js_cocos2dx_TransitionProgressVertical_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_TransitionProgressVertical_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "TransitionProgressVertical"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::TransitionProgressVertical>(cx, jsb_cocos2d_TransitionProgressVertical_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.TransitionProgressVertical.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_TransitionProgressInOut_class;
|
|
JSObject *jsb_cocos2d_TransitionProgressInOut_prototype;
|
|
|
|
bool js_cocos2dx_TransitionProgressInOut_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 2) {
|
|
double arg0 = 0;
|
|
cocos2d::Scene* arg1 = nullptr;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::Scene*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TransitionProgressInOut_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::TransitionProgressInOut::create(arg0, arg1);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TransitionProgressInOut>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::TransitionProgressInOut"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_TransitionProgressInOut_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_TransitionProgressInOut_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::TransitionProgressInOut* cobj = new (std::nothrow) cocos2d::TransitionProgressInOut();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TransitionProgressInOut>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::TransitionProgressInOut"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_TransitionProgressInOut_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::TransitionProgressInOut *nobj = new (std::nothrow) cocos2d::TransitionProgressInOut();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::TransitionProgressInOut");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_TransitionProgress_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_TransitionProgressInOut(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_TransitionProgressInOut_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_TransitionProgressInOut_class->name = "TransitionProgressInOut";
|
|
jsb_cocos2d_TransitionProgressInOut_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TransitionProgressInOut_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_TransitionProgressInOut_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TransitionProgressInOut_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_TransitionProgressInOut_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_TransitionProgressInOut_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_TransitionProgressInOut_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_TransitionProgressInOut_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("ctor", js_cocos2dx_TransitionProgressInOut_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_TransitionProgressInOut_create, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_TransitionProgress_prototype);
|
|
jsb_cocos2d_TransitionProgressInOut_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_TransitionProgressInOut_class,
|
|
js_cocos2dx_TransitionProgressInOut_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_TransitionProgressInOut_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "TransitionProgressInOut"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::TransitionProgressInOut>(cx, jsb_cocos2d_TransitionProgressInOut_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.TransitionProgressInOut.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_TransitionProgressOutIn_class;
|
|
JSObject *jsb_cocos2d_TransitionProgressOutIn_prototype;
|
|
|
|
bool js_cocos2dx_TransitionProgressOutIn_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 2) {
|
|
double arg0 = 0;
|
|
cocos2d::Scene* arg1 = nullptr;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::Scene*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TransitionProgressOutIn_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::TransitionProgressOutIn::create(arg0, arg1);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TransitionProgressOutIn>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::TransitionProgressOutIn"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_TransitionProgressOutIn_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_TransitionProgressOutIn_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::TransitionProgressOutIn* cobj = new (std::nothrow) cocos2d::TransitionProgressOutIn();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TransitionProgressOutIn>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::TransitionProgressOutIn"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_TransitionProgressOutIn_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::TransitionProgressOutIn *nobj = new (std::nothrow) cocos2d::TransitionProgressOutIn();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::TransitionProgressOutIn");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_TransitionProgress_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_TransitionProgressOutIn(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_TransitionProgressOutIn_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_TransitionProgressOutIn_class->name = "TransitionProgressOutIn";
|
|
jsb_cocos2d_TransitionProgressOutIn_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TransitionProgressOutIn_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_TransitionProgressOutIn_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TransitionProgressOutIn_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_TransitionProgressOutIn_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_TransitionProgressOutIn_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_TransitionProgressOutIn_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_TransitionProgressOutIn_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("ctor", js_cocos2dx_TransitionProgressOutIn_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_TransitionProgressOutIn_create, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_TransitionProgress_prototype);
|
|
jsb_cocos2d_TransitionProgressOutIn_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_TransitionProgressOutIn_class,
|
|
js_cocos2dx_TransitionProgressOutIn_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_TransitionProgressOutIn_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "TransitionProgressOutIn"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::TransitionProgressOutIn>(cx, jsb_cocos2d_TransitionProgressOutIn_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.TransitionProgressOutIn.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_Camera_class;
|
|
JSObject *jsb_cocos2d_Camera_prototype;
|
|
|
|
bool js_cocos2dx_Camera_restore(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Camera* cobj = (cocos2d::Camera *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Camera_restore : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->restore();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Camera_restore : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Camera_getDepth(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Camera* cobj = (cocos2d::Camera *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Camera_getDepth : Invalid Native Object");
|
|
if (argc == 0) {
|
|
int32_t ret = cobj->getDepth();
|
|
jsval jsret = JSVAL_NULL;
|
|
#pragma warning NO CONVERSION FROM NATIVE FOR char;
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Camera_getDepth : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Camera_getViewProjectionMatrix(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Camera* cobj = (cocos2d::Camera *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Camera_getViewProjectionMatrix : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const cocos2d::Mat4& ret = cobj->getViewProjectionMatrix();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = matrix_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Camera_getViewProjectionMatrix : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Camera_applyViewport(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Camera* cobj = (cocos2d::Camera *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Camera_applyViewport : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->applyViewport();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Camera_applyViewport : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Camera_setBackgroundBrush(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Camera* cobj = (cocos2d::Camera *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Camera_setBackgroundBrush : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::CameraBackgroundBrush* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::CameraBackgroundBrush*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Camera_setBackgroundBrush : Error processing arguments");
|
|
cobj->setBackgroundBrush(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Camera_setBackgroundBrush : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Camera_lookAt(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Camera* cobj = (cocos2d::Camera *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Camera_lookAt : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Vec3 arg0;
|
|
ok &= jsval_to_vector3(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Camera_lookAt : Error processing arguments");
|
|
cobj->lookAt(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
if (argc == 2) {
|
|
cocos2d::Vec3 arg0;
|
|
cocos2d::Vec3 arg1;
|
|
ok &= jsval_to_vector3(cx, args.get(0), &arg0);
|
|
ok &= jsval_to_vector3(cx, args.get(1), &arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Camera_lookAt : Error processing arguments");
|
|
cobj->lookAt(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Camera_lookAt : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Camera_apply(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Camera* cobj = (cocos2d::Camera *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Camera_apply : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->apply();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Camera_apply : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Camera_getBackgroundBrush(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Camera* cobj = (cocos2d::Camera *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Camera_getBackgroundBrush : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::CameraBackgroundBrush* ret = cobj->getBackgroundBrush();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::CameraBackgroundBrush>(cx, (cocos2d::CameraBackgroundBrush*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Camera_getBackgroundBrush : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Camera_getProjectionMatrix(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Camera* cobj = (cocos2d::Camera *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Camera_getProjectionMatrix : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const cocos2d::Mat4& ret = cobj->getProjectionMatrix();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = matrix_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Camera_getProjectionMatrix : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Camera_isBrushValid(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Camera* cobj = (cocos2d::Camera *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Camera_isBrushValid : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->isBrushValid();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Camera_isBrushValid : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Camera_getDepthInView(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Camera* cobj = (cocos2d::Camera *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Camera_getDepthInView : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Mat4 arg0;
|
|
ok &= jsval_to_matrix(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Camera_getDepthInView : Error processing arguments");
|
|
double ret = cobj->getDepthInView(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Camera_getDepthInView : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Camera_restoreViewport(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Camera* cobj = (cocos2d::Camera *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Camera_restoreViewport : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->restoreViewport();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Camera_restoreViewport : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Camera_clearBackground(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Camera* cobj = (cocos2d::Camera *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Camera_clearBackground : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->clearBackground();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Camera_clearBackground : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Camera_setAdditionalProjection(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Camera* cobj = (cocos2d::Camera *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Camera_setAdditionalProjection : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Mat4 arg0;
|
|
ok &= jsval_to_matrix(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Camera_setAdditionalProjection : Error processing arguments");
|
|
cobj->setAdditionalProjection(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Camera_setAdditionalProjection : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Camera_setViewport(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Camera* cobj = (cocos2d::Camera *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Camera_setViewport : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::experimental::Viewport arg0;
|
|
#pragma warning NO CONVERSION TO NATIVE FOR Viewport
|
|
ok = false;
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Camera_setViewport : Error processing arguments");
|
|
cobj->setViewport(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Camera_setViewport : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Camera_initDefault(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Camera* cobj = (cocos2d::Camera *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Camera_initDefault : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->initDefault();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Camera_initDefault : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Camera_getCameraFlag(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Camera* cobj = (cocos2d::Camera *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Camera_getCameraFlag : Invalid Native Object");
|
|
if (argc == 0) {
|
|
int ret = (int)cobj->getCameraFlag();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = int32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Camera_getCameraFlag : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Camera_getType(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Camera* cobj = (cocos2d::Camera *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Camera_getType : Invalid Native Object");
|
|
if (argc == 0) {
|
|
int ret = (int)cobj->getType();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = int32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Camera_getType : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Camera_initOrthographic(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Camera* cobj = (cocos2d::Camera *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Camera_initOrthographic : Invalid Native Object");
|
|
if (argc == 4) {
|
|
double arg0 = 0;
|
|
double arg1 = 0;
|
|
double arg2 = 0;
|
|
double arg3 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
ok &= JS::ToNumber( cx, args.get(3), &arg3) && !std::isnan(arg3);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Camera_initOrthographic : Error processing arguments");
|
|
bool ret = cobj->initOrthographic(arg0, arg1, arg2, arg3);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Camera_initOrthographic : wrong number of arguments: %d, was expecting %d", argc, 4);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Camera_getRenderOrder(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Camera* cobj = (cocos2d::Camera *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Camera_getRenderOrder : Invalid Native Object");
|
|
if (argc == 0) {
|
|
int ret = cobj->getRenderOrder();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = int32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Camera_getRenderOrder : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Camera_setDepth(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Camera* cobj = (cocos2d::Camera *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Camera_setDepth : Invalid Native Object");
|
|
if (argc == 1) {
|
|
int32_t arg0;
|
|
ok &= jsval_to_int32(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Camera_setDepth : Error processing arguments");
|
|
cobj->setDepth(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Camera_setDepth : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Camera_setScene(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Camera* cobj = (cocos2d::Camera *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Camera_setScene : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Scene* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Scene*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Camera_setScene : Error processing arguments");
|
|
cobj->setScene(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Camera_setScene : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Camera_projectGL(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Camera* cobj = (cocos2d::Camera *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Camera_projectGL : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Vec3 arg0;
|
|
ok &= jsval_to_vector3(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Camera_projectGL : Error processing arguments");
|
|
cocos2d::Vec2 ret = cobj->projectGL(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = vector2_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Camera_projectGL : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Camera_restoreFrameBufferObject(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Camera* cobj = (cocos2d::Camera *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Camera_restoreFrameBufferObject : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->restoreFrameBufferObject();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Camera_restoreFrameBufferObject : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Camera_getViewMatrix(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Camera* cobj = (cocos2d::Camera *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Camera_getViewMatrix : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const cocos2d::Mat4& ret = cobj->getViewMatrix();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = matrix_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Camera_getViewMatrix : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Camera_getNearPlane(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Camera* cobj = (cocos2d::Camera *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Camera_getNearPlane : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getNearPlane();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Camera_getNearPlane : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Camera_project(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Camera* cobj = (cocos2d::Camera *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Camera_project : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Vec3 arg0;
|
|
ok &= jsval_to_vector3(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Camera_project : Error processing arguments");
|
|
cocos2d::Vec2 ret = cobj->project(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = vector2_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Camera_project : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Camera_setCameraFlag(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Camera* cobj = (cocos2d::Camera *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Camera_setCameraFlag : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::CameraFlag arg0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Camera_setCameraFlag : Error processing arguments");
|
|
cobj->setCameraFlag(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Camera_setCameraFlag : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Camera_getFarPlane(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Camera* cobj = (cocos2d::Camera *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Camera_getFarPlane : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getFarPlane();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Camera_getFarPlane : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Camera_applyFrameBufferObject(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Camera* cobj = (cocos2d::Camera *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Camera_applyFrameBufferObject : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->applyFrameBufferObject();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Camera_applyFrameBufferObject : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Camera_setFrameBufferObject(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Camera* cobj = (cocos2d::Camera *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Camera_setFrameBufferObject : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::experimental::FrameBuffer* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::experimental::FrameBuffer*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Camera_setFrameBufferObject : Error processing arguments");
|
|
cobj->setFrameBufferObject(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Camera_setFrameBufferObject : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Camera_isViewProjectionUpdated(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Camera* cobj = (cocos2d::Camera *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Camera_isViewProjectionUpdated : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->isViewProjectionUpdated();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Camera_isViewProjectionUpdated : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Camera_initPerspective(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Camera* cobj = (cocos2d::Camera *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Camera_initPerspective : Invalid Native Object");
|
|
if (argc == 4) {
|
|
double arg0 = 0;
|
|
double arg1 = 0;
|
|
double arg2 = 0;
|
|
double arg3 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
ok &= JS::ToNumber( cx, args.get(3), &arg3) && !std::isnan(arg3);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Camera_initPerspective : Error processing arguments");
|
|
bool ret = cobj->initPerspective(arg0, arg1, arg2, arg3);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Camera_initPerspective : wrong number of arguments: %d, was expecting %d", argc, 4);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Camera_createOrthographic(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 4) {
|
|
double arg0 = 0;
|
|
double arg1 = 0;
|
|
double arg2 = 0;
|
|
double arg3 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
ok &= JS::ToNumber( cx, args.get(3), &arg3) && !std::isnan(arg3);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Camera_createOrthographic : Error processing arguments");
|
|
|
|
auto ret = cocos2d::Camera::createOrthographic(arg0, arg1, arg2, arg3);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::Camera>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::Camera"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_Camera_createOrthographic : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_Camera_getVisitingCamera(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
if (argc == 0) {
|
|
|
|
const cocos2d::Camera* ret = cocos2d::Camera::getVisitingCamera();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Camera>(cx, (cocos2d::Camera*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_Camera_getVisitingCamera : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_Camera_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
if (argc == 0) {
|
|
|
|
auto ret = cocos2d::Camera::create();
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::Camera>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::Camera"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_Camera_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_Camera_createPerspective(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 4) {
|
|
double arg0 = 0;
|
|
double arg1 = 0;
|
|
double arg2 = 0;
|
|
double arg3 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
ok &= JS::ToNumber( cx, args.get(3), &arg3) && !std::isnan(arg3);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Camera_createPerspective : Error processing arguments");
|
|
|
|
auto ret = cocos2d::Camera::createPerspective(arg0, arg1, arg2, arg3);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::Camera>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::Camera"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_Camera_createPerspective : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_Camera_getDefaultViewport(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
if (argc == 0) {
|
|
|
|
const cocos2d::experimental::Viewport& ret = cocos2d::Camera::getDefaultViewport();
|
|
jsval jsret = JSVAL_NULL;
|
|
#pragma warning NO CONVERSION FROM NATIVE FOR Viewport;
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_Camera_getDefaultViewport : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_Camera_setDefaultViewport(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
cocos2d::experimental::Viewport arg0;
|
|
#pragma warning NO CONVERSION TO NATIVE FOR Viewport
|
|
ok = false;
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Camera_setDefaultViewport : Error processing arguments");
|
|
cocos2d::Camera::setDefaultViewport(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_Camera_setDefaultViewport : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_Camera_getDefaultCamera(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
if (argc == 0) {
|
|
|
|
cocos2d::Camera* ret = cocos2d::Camera::getDefaultCamera();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Camera>(cx, (cocos2d::Camera*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_Camera_getDefaultCamera : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_Camera_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::Camera* cobj = new (std::nothrow) cocos2d::Camera();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::Camera>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::Camera"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_Node_prototype;
|
|
|
|
void js_register_cocos2dx_Camera(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_Camera_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_Camera_class->name = "Camera";
|
|
jsb_cocos2d_Camera_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Camera_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_Camera_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Camera_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_Camera_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_Camera_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_Camera_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_Camera_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("restore", js_cocos2dx_Camera_restore, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getDepth", js_cocos2dx_Camera_getDepth, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getViewProjectionMatrix", js_cocos2dx_Camera_getViewProjectionMatrix, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("applyViewport", js_cocos2dx_Camera_applyViewport, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setBackgroundBrush", js_cocos2dx_Camera_setBackgroundBrush, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("lookAt", js_cocos2dx_Camera_lookAt, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("apply", js_cocos2dx_Camera_apply, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getBackgroundBrush", js_cocos2dx_Camera_getBackgroundBrush, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getProjectionMatrix", js_cocos2dx_Camera_getProjectionMatrix, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("isBrushValid", js_cocos2dx_Camera_isBrushValid, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getDepthInView", js_cocos2dx_Camera_getDepthInView, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("restoreViewport", js_cocos2dx_Camera_restoreViewport, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("clearBackground", js_cocos2dx_Camera_clearBackground, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setAdditionalProjection", js_cocos2dx_Camera_setAdditionalProjection, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setViewport", js_cocos2dx_Camera_setViewport, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initDefault", js_cocos2dx_Camera_initDefault, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getCameraFlag", js_cocos2dx_Camera_getCameraFlag, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getType", js_cocos2dx_Camera_getType, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initOrthographic", js_cocos2dx_Camera_initOrthographic, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getRenderOrder", js_cocos2dx_Camera_getRenderOrder, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setDepth", js_cocos2dx_Camera_setDepth, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setScene", js_cocos2dx_Camera_setScene, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("projectGL", js_cocos2dx_Camera_projectGL, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("restoreFrameBufferObject", js_cocos2dx_Camera_restoreFrameBufferObject, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getViewMatrix", js_cocos2dx_Camera_getViewMatrix, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getNearPlane", js_cocos2dx_Camera_getNearPlane, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("project", js_cocos2dx_Camera_project, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setCameraFlag", js_cocos2dx_Camera_setCameraFlag, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getFarPlane", js_cocos2dx_Camera_getFarPlane, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("applyFrameBufferObject", js_cocos2dx_Camera_applyFrameBufferObject, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setFrameBufferObject", js_cocos2dx_Camera_setFrameBufferObject, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("isViewProjectionUpdated", js_cocos2dx_Camera_isViewProjectionUpdated, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initPerspective", js_cocos2dx_Camera_initPerspective, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("createOrthographic", js_cocos2dx_Camera_createOrthographic, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getVisitingCamera", js_cocos2dx_Camera_getVisitingCamera, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("create", js_cocos2dx_Camera_create, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("createPerspective", js_cocos2dx_Camera_createPerspective, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getDefaultViewport", js_cocos2dx_Camera_getDefaultViewport, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setDefaultViewport", js_cocos2dx_Camera_setDefaultViewport, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getDefaultCamera", js_cocos2dx_Camera_getDefaultCamera, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_Node_prototype);
|
|
jsb_cocos2d_Camera_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_Camera_class,
|
|
js_cocos2dx_Camera_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_Camera_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "Camera"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::Camera>(cx, jsb_cocos2d_Camera_class, proto, parent_proto);
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_CameraBackgroundBrush_class;
|
|
JSObject *jsb_cocos2d_CameraBackgroundBrush_prototype;
|
|
|
|
bool js_cocos2dx_CameraBackgroundBrush_getBrushType(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::CameraBackgroundBrush* cobj = (cocos2d::CameraBackgroundBrush *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_CameraBackgroundBrush_getBrushType : Invalid Native Object");
|
|
if (argc == 0) {
|
|
int ret = (int)cobj->getBrushType();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = int32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_CameraBackgroundBrush_getBrushType : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_CameraBackgroundBrush_drawBackground(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::CameraBackgroundBrush* cobj = (cocos2d::CameraBackgroundBrush *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_CameraBackgroundBrush_drawBackground : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Camera* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Camera*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_CameraBackgroundBrush_drawBackground : Error processing arguments");
|
|
cobj->drawBackground(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_CameraBackgroundBrush_drawBackground : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_CameraBackgroundBrush_init(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::CameraBackgroundBrush* cobj = (cocos2d::CameraBackgroundBrush *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_CameraBackgroundBrush_init : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->init();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_CameraBackgroundBrush_init : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_CameraBackgroundBrush_isValid(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::CameraBackgroundBrush* cobj = (cocos2d::CameraBackgroundBrush *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_CameraBackgroundBrush_isValid : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->isValid();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_CameraBackgroundBrush_isValid : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_CameraBackgroundBrush_createSkyboxBrush(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 6) {
|
|
std::string arg0;
|
|
std::string arg1;
|
|
std::string arg2;
|
|
std::string arg3;
|
|
std::string arg4;
|
|
std::string arg5;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
|
ok &= jsval_to_std_string(cx, args.get(2), &arg2);
|
|
ok &= jsval_to_std_string(cx, args.get(3), &arg3);
|
|
ok &= jsval_to_std_string(cx, args.get(4), &arg4);
|
|
ok &= jsval_to_std_string(cx, args.get(5), &arg5);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_CameraBackgroundBrush_createSkyboxBrush : Error processing arguments");
|
|
|
|
auto ret = cocos2d::CameraBackgroundBrush::createSkyboxBrush(arg0, arg1, arg2, arg3, arg4, arg5);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::CameraBackgroundBrush>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::CameraBackgroundBrush"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_CameraBackgroundBrush_createSkyboxBrush : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_CameraBackgroundBrush_createColorBrush(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 2) {
|
|
cocos2d::Color4F arg0;
|
|
double arg1 = 0;
|
|
ok &= jsval_to_cccolor4f(cx, args.get(0), &arg0);
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_CameraBackgroundBrush_createColorBrush : Error processing arguments");
|
|
|
|
auto ret = cocos2d::CameraBackgroundBrush::createColorBrush(arg0, arg1);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::CameraBackgroundBrush>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::CameraBackgroundBrush"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_CameraBackgroundBrush_createColorBrush : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_CameraBackgroundBrush_createNoneBrush(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
if (argc == 0) {
|
|
|
|
auto ret = cocos2d::CameraBackgroundBrush::createNoneBrush();
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::CameraBackgroundBrush>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::CameraBackgroundBrush"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_CameraBackgroundBrush_createNoneBrush : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_CameraBackgroundBrush_createDepthBrush(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 0) {
|
|
|
|
auto ret = cocos2d::CameraBackgroundBrush::createDepthBrush();
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::CameraBackgroundBrush>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::CameraBackgroundBrush"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_CameraBackgroundBrush_createDepthBrush : Error processing arguments");
|
|
|
|
auto ret = cocos2d::CameraBackgroundBrush::createDepthBrush(arg0);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::CameraBackgroundBrush>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::CameraBackgroundBrush"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_CameraBackgroundBrush_createDepthBrush : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_CameraBackgroundBrush_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::CameraBackgroundBrush* cobj = new (std::nothrow) cocos2d::CameraBackgroundBrush();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::CameraBackgroundBrush>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::CameraBackgroundBrush"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
|
|
|
|
void js_register_cocos2dx_CameraBackgroundBrush(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_CameraBackgroundBrush_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_CameraBackgroundBrush_class->name = "CameraBackgroundBrush";
|
|
jsb_cocos2d_CameraBackgroundBrush_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_CameraBackgroundBrush_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_CameraBackgroundBrush_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_CameraBackgroundBrush_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_CameraBackgroundBrush_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_CameraBackgroundBrush_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_CameraBackgroundBrush_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_CameraBackgroundBrush_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("getBrushType", js_cocos2dx_CameraBackgroundBrush_getBrushType, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("drawBackground", js_cocos2dx_CameraBackgroundBrush_drawBackground, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("init", js_cocos2dx_CameraBackgroundBrush_init, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("isValid", js_cocos2dx_CameraBackgroundBrush_isValid, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("createSkyboxBrush", js_cocos2dx_CameraBackgroundBrush_createSkyboxBrush, 6, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("createColorBrush", js_cocos2dx_CameraBackgroundBrush_createColorBrush, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("createNoneBrush", js_cocos2dx_CameraBackgroundBrush_createNoneBrush, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("createDepthBrush", js_cocos2dx_CameraBackgroundBrush_createDepthBrush, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
jsb_cocos2d_CameraBackgroundBrush_prototype = JS_InitClass(
|
|
cx, global,
|
|
JS::NullPtr(),
|
|
jsb_cocos2d_CameraBackgroundBrush_class,
|
|
js_cocos2dx_CameraBackgroundBrush_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_CameraBackgroundBrush_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "CameraBackgroundBrush"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::CameraBackgroundBrush>(cx, jsb_cocos2d_CameraBackgroundBrush_class, proto, JS::NullPtr());
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_CameraBackgroundDepthBrush_class;
|
|
JSObject *jsb_cocos2d_CameraBackgroundDepthBrush_prototype;
|
|
|
|
bool js_cocos2dx_CameraBackgroundDepthBrush_setDepth(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::CameraBackgroundDepthBrush* cobj = (cocos2d::CameraBackgroundDepthBrush *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_CameraBackgroundDepthBrush_setDepth : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_CameraBackgroundDepthBrush_setDepth : Error processing arguments");
|
|
cobj->setDepth(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_CameraBackgroundDepthBrush_setDepth : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_CameraBackgroundDepthBrush_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_CameraBackgroundDepthBrush_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::CameraBackgroundDepthBrush::create(arg0);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::CameraBackgroundDepthBrush>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::CameraBackgroundDepthBrush"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_CameraBackgroundDepthBrush_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_CameraBackgroundDepthBrush_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::CameraBackgroundDepthBrush* cobj = new (std::nothrow) cocos2d::CameraBackgroundDepthBrush();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::CameraBackgroundDepthBrush>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::CameraBackgroundDepthBrush"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_CameraBackgroundBrush_prototype;
|
|
|
|
void js_register_cocos2dx_CameraBackgroundDepthBrush(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_CameraBackgroundDepthBrush_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_CameraBackgroundDepthBrush_class->name = "CameraBackgroundDepthBrush";
|
|
jsb_cocos2d_CameraBackgroundDepthBrush_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_CameraBackgroundDepthBrush_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_CameraBackgroundDepthBrush_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_CameraBackgroundDepthBrush_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_CameraBackgroundDepthBrush_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_CameraBackgroundDepthBrush_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_CameraBackgroundDepthBrush_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_CameraBackgroundDepthBrush_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("setDepth", js_cocos2dx_CameraBackgroundDepthBrush_setDepth, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_CameraBackgroundDepthBrush_create, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_CameraBackgroundBrush_prototype);
|
|
jsb_cocos2d_CameraBackgroundDepthBrush_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_CameraBackgroundDepthBrush_class,
|
|
js_cocos2dx_CameraBackgroundDepthBrush_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_CameraBackgroundDepthBrush_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "CameraBackgroundDepthBrush"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::CameraBackgroundDepthBrush>(cx, jsb_cocos2d_CameraBackgroundDepthBrush_class, proto, parent_proto);
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_CameraBackgroundColorBrush_class;
|
|
JSObject *jsb_cocos2d_CameraBackgroundColorBrush_prototype;
|
|
|
|
bool js_cocos2dx_CameraBackgroundColorBrush_setColor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::CameraBackgroundColorBrush* cobj = (cocos2d::CameraBackgroundColorBrush *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_CameraBackgroundColorBrush_setColor : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Color4F arg0;
|
|
ok &= jsval_to_cccolor4f(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_CameraBackgroundColorBrush_setColor : Error processing arguments");
|
|
cobj->setColor(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_CameraBackgroundColorBrush_setColor : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_CameraBackgroundColorBrush_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 2) {
|
|
cocos2d::Color4F arg0;
|
|
double arg1 = 0;
|
|
ok &= jsval_to_cccolor4f(cx, args.get(0), &arg0);
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_CameraBackgroundColorBrush_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::CameraBackgroundColorBrush::create(arg0, arg1);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::CameraBackgroundColorBrush>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::CameraBackgroundColorBrush"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_CameraBackgroundColorBrush_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_CameraBackgroundColorBrush_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::CameraBackgroundColorBrush* cobj = new (std::nothrow) cocos2d::CameraBackgroundColorBrush();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::CameraBackgroundColorBrush>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::CameraBackgroundColorBrush"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_CameraBackgroundDepthBrush_prototype;
|
|
|
|
void js_register_cocos2dx_CameraBackgroundColorBrush(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_CameraBackgroundColorBrush_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_CameraBackgroundColorBrush_class->name = "CameraBackgroundColorBrush";
|
|
jsb_cocos2d_CameraBackgroundColorBrush_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_CameraBackgroundColorBrush_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_CameraBackgroundColorBrush_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_CameraBackgroundColorBrush_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_CameraBackgroundColorBrush_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_CameraBackgroundColorBrush_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_CameraBackgroundColorBrush_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_CameraBackgroundColorBrush_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("setColor", js_cocos2dx_CameraBackgroundColorBrush_setColor, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_CameraBackgroundColorBrush_create, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_CameraBackgroundDepthBrush_prototype);
|
|
jsb_cocos2d_CameraBackgroundColorBrush_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_CameraBackgroundColorBrush_class,
|
|
js_cocos2dx_CameraBackgroundColorBrush_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_CameraBackgroundColorBrush_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "CameraBackgroundColorBrush"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::CameraBackgroundColorBrush>(cx, jsb_cocos2d_CameraBackgroundColorBrush_class, proto, parent_proto);
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_CameraBackgroundSkyBoxBrush_class;
|
|
JSObject *jsb_cocos2d_CameraBackgroundSkyBoxBrush_prototype;
|
|
|
|
bool js_cocos2dx_CameraBackgroundSkyBoxBrush_setTextureValid(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::CameraBackgroundSkyBoxBrush* cobj = (cocos2d::CameraBackgroundSkyBoxBrush *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_CameraBackgroundSkyBoxBrush_setTextureValid : Invalid Native Object");
|
|
if (argc == 1) {
|
|
bool arg0;
|
|
arg0 = JS::ToBoolean(args.get(0));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_CameraBackgroundSkyBoxBrush_setTextureValid : Error processing arguments");
|
|
cobj->setTextureValid(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_CameraBackgroundSkyBoxBrush_setTextureValid : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_CameraBackgroundSkyBoxBrush_setTexture(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::CameraBackgroundSkyBoxBrush* cobj = (cocos2d::CameraBackgroundSkyBoxBrush *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_CameraBackgroundSkyBoxBrush_setTexture : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::TextureCube* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::TextureCube*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_CameraBackgroundSkyBoxBrush_setTexture : Error processing arguments");
|
|
cobj->setTexture(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_CameraBackgroundSkyBoxBrush_setTexture : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_CameraBackgroundSkyBoxBrush_setActived(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::CameraBackgroundSkyBoxBrush* cobj = (cocos2d::CameraBackgroundSkyBoxBrush *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_CameraBackgroundSkyBoxBrush_setActived : Invalid Native Object");
|
|
if (argc == 1) {
|
|
bool arg0;
|
|
arg0 = JS::ToBoolean(args.get(0));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_CameraBackgroundSkyBoxBrush_setActived : Error processing arguments");
|
|
cobj->setActived(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_CameraBackgroundSkyBoxBrush_setActived : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_CameraBackgroundSkyBoxBrush_isActived(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::CameraBackgroundSkyBoxBrush* cobj = (cocos2d::CameraBackgroundSkyBoxBrush *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_CameraBackgroundSkyBoxBrush_isActived : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->isActived();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_CameraBackgroundSkyBoxBrush_isActived : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_CameraBackgroundSkyBoxBrush_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
|
|
do {
|
|
if (argc == 0) {
|
|
cocos2d::CameraBackgroundSkyBoxBrush* ret = cocos2d::CameraBackgroundSkyBoxBrush::create();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::CameraBackgroundSkyBoxBrush>(cx, (cocos2d::CameraBackgroundSkyBoxBrush*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
|
|
do {
|
|
if (argc == 6) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
std::string arg1;
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
std::string arg2;
|
|
ok &= jsval_to_std_string(cx, args.get(2), &arg2);
|
|
if (!ok) { ok = true; break; }
|
|
std::string arg3;
|
|
ok &= jsval_to_std_string(cx, args.get(3), &arg3);
|
|
if (!ok) { ok = true; break; }
|
|
std::string arg4;
|
|
ok &= jsval_to_std_string(cx, args.get(4), &arg4);
|
|
if (!ok) { ok = true; break; }
|
|
std::string arg5;
|
|
ok &= jsval_to_std_string(cx, args.get(5), &arg5);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::CameraBackgroundSkyBoxBrush* ret = cocos2d::CameraBackgroundSkyBoxBrush::create(arg0, arg1, arg2, arg3, arg4, arg5);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::CameraBackgroundSkyBoxBrush>(cx, (cocos2d::CameraBackgroundSkyBoxBrush*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
JS_ReportError(cx, "js_cocos2dx_CameraBackgroundSkyBoxBrush_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_CameraBackgroundSkyBoxBrush_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::CameraBackgroundSkyBoxBrush* cobj = new (std::nothrow) cocos2d::CameraBackgroundSkyBoxBrush();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::CameraBackgroundSkyBoxBrush>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::CameraBackgroundSkyBoxBrush"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_CameraBackgroundBrush_prototype;
|
|
|
|
void js_register_cocos2dx_CameraBackgroundSkyBoxBrush(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_CameraBackgroundSkyBoxBrush_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_CameraBackgroundSkyBoxBrush_class->name = "CameraBackgroundSkyBoxBrush";
|
|
jsb_cocos2d_CameraBackgroundSkyBoxBrush_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_CameraBackgroundSkyBoxBrush_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_CameraBackgroundSkyBoxBrush_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_CameraBackgroundSkyBoxBrush_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_CameraBackgroundSkyBoxBrush_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_CameraBackgroundSkyBoxBrush_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_CameraBackgroundSkyBoxBrush_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_CameraBackgroundSkyBoxBrush_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("setTextureValid", js_cocos2dx_CameraBackgroundSkyBoxBrush_setTextureValid, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setTexture", js_cocos2dx_CameraBackgroundSkyBoxBrush_setTexture, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setActived", js_cocos2dx_CameraBackgroundSkyBoxBrush_setActived, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("isActived", js_cocos2dx_CameraBackgroundSkyBoxBrush_isActived, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_CameraBackgroundSkyBoxBrush_create, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_CameraBackgroundBrush_prototype);
|
|
jsb_cocos2d_CameraBackgroundSkyBoxBrush_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_CameraBackgroundSkyBoxBrush_class,
|
|
js_cocos2dx_CameraBackgroundSkyBoxBrush_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_CameraBackgroundSkyBoxBrush_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "CameraBackgroundSkyBoxBrush"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::CameraBackgroundSkyBoxBrush>(cx, jsb_cocos2d_CameraBackgroundSkyBoxBrush_class, proto, parent_proto);
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_GridBase_class;
|
|
JSObject *jsb_cocos2d_GridBase_prototype;
|
|
|
|
bool js_cocos2dx_GridBase_setGridSize(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GridBase* cobj = (cocos2d::GridBase *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GridBase_setGridSize : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Size arg0;
|
|
ok &= jsval_to_ccsize(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_GridBase_setGridSize : Error processing arguments");
|
|
cobj->setGridSize(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GridBase_setGridSize : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GridBase_setGridRect(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GridBase* cobj = (cocos2d::GridBase *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GridBase_setGridRect : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Rect arg0;
|
|
ok &= jsval_to_ccrect(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_GridBase_setGridRect : Error processing arguments");
|
|
cobj->setGridRect(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GridBase_setGridRect : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GridBase_afterBlit(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GridBase* cobj = (cocos2d::GridBase *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GridBase_afterBlit : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->afterBlit();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GridBase_afterBlit : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GridBase_getGridRect(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GridBase* cobj = (cocos2d::GridBase *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GridBase_getGridRect : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const cocos2d::Rect& ret = cobj->getGridRect();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ccrect_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GridBase_getGridRect : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GridBase_afterDraw(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GridBase* cobj = (cocos2d::GridBase *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GridBase_afterDraw : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Node* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_GridBase_afterDraw : Error processing arguments");
|
|
cobj->afterDraw(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GridBase_afterDraw : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GridBase_beforeDraw(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GridBase* cobj = (cocos2d::GridBase *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GridBase_beforeDraw : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->beforeDraw();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GridBase_beforeDraw : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GridBase_calculateVertexPoints(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GridBase* cobj = (cocos2d::GridBase *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GridBase_calculateVertexPoints : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->calculateVertexPoints();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GridBase_calculateVertexPoints : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GridBase_isTextureFlipped(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GridBase* cobj = (cocos2d::GridBase *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GridBase_isTextureFlipped : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->isTextureFlipped();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GridBase_isTextureFlipped : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GridBase_getGridSize(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GridBase* cobj = (cocos2d::GridBase *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GridBase_getGridSize : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const cocos2d::Size& ret = cobj->getGridSize();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ccsize_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GridBase_getGridSize : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GridBase_getStep(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GridBase* cobj = (cocos2d::GridBase *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GridBase_getStep : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const cocos2d::Vec2& ret = cobj->getStep();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = vector2_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GridBase_getStep : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GridBase_set2DProjection(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GridBase* cobj = (cocos2d::GridBase *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GridBase_set2DProjection : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->set2DProjection();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GridBase_set2DProjection : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GridBase_setStep(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GridBase* cobj = (cocos2d::GridBase *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GridBase_setStep : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Vec2 arg0;
|
|
ok &= jsval_to_vector2(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_GridBase_setStep : Error processing arguments");
|
|
cobj->setStep(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GridBase_setStep : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GridBase_setTextureFlipped(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GridBase* cobj = (cocos2d::GridBase *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GridBase_setTextureFlipped : Invalid Native Object");
|
|
if (argc == 1) {
|
|
bool arg0;
|
|
arg0 = JS::ToBoolean(args.get(0));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_GridBase_setTextureFlipped : Error processing arguments");
|
|
cobj->setTextureFlipped(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GridBase_setTextureFlipped : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GridBase_blit(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GridBase* cobj = (cocos2d::GridBase *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GridBase_blit : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->blit();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GridBase_blit : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GridBase_setActive(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GridBase* cobj = (cocos2d::GridBase *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GridBase_setActive : Invalid Native Object");
|
|
if (argc == 1) {
|
|
bool arg0;
|
|
arg0 = JS::ToBoolean(args.get(0));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_GridBase_setActive : Error processing arguments");
|
|
cobj->setActive(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GridBase_setActive : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GridBase_getReuseGrid(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GridBase* cobj = (cocos2d::GridBase *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GridBase_getReuseGrid : Invalid Native Object");
|
|
if (argc == 0) {
|
|
int ret = cobj->getReuseGrid();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = int32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GridBase_getReuseGrid : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GridBase_initWithSize(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::GridBase* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::GridBase *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GridBase_initWithSize : Invalid Native Object");
|
|
do {
|
|
if (argc == 2) {
|
|
cocos2d::Size arg0;
|
|
ok &= jsval_to_ccsize(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Rect arg1;
|
|
ok &= jsval_to_ccrect(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
bool ret = cobj->initWithSize(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 1) {
|
|
cocos2d::Size arg0;
|
|
ok &= jsval_to_ccsize(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
bool ret = cobj->initWithSize(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 3) {
|
|
cocos2d::Size arg0;
|
|
ok &= jsval_to_ccsize(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Texture2D* arg1 = nullptr;
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::Texture2D*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
if (!ok) { ok = true; break; }
|
|
bool arg2;
|
|
arg2 = JS::ToBoolean(args.get(2));
|
|
bool ret = cobj->initWithSize(arg0, arg1, arg2);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 4) {
|
|
cocos2d::Size arg0;
|
|
ok &= jsval_to_ccsize(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Texture2D* arg1 = nullptr;
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::Texture2D*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
if (!ok) { ok = true; break; }
|
|
bool arg2;
|
|
arg2 = JS::ToBoolean(args.get(2));
|
|
cocos2d::Rect arg3;
|
|
ok &= jsval_to_ccrect(cx, args.get(3), &arg3);
|
|
if (!ok) { ok = true; break; }
|
|
bool ret = cobj->initWithSize(arg0, arg1, arg2, arg3);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GridBase_initWithSize : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GridBase_beforeBlit(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GridBase* cobj = (cocos2d::GridBase *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GridBase_beforeBlit : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->beforeBlit();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GridBase_beforeBlit : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GridBase_setReuseGrid(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GridBase* cobj = (cocos2d::GridBase *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GridBase_setReuseGrid : Invalid Native Object");
|
|
if (argc == 1) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_GridBase_setReuseGrid : Error processing arguments");
|
|
cobj->setReuseGrid(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GridBase_setReuseGrid : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GridBase_isActive(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GridBase* cobj = (cocos2d::GridBase *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GridBase_isActive : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->isActive();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GridBase_isActive : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GridBase_reuse(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GridBase* cobj = (cocos2d::GridBase *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GridBase_reuse : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->reuse();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GridBase_reuse : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GridBase_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
|
|
do {
|
|
if (argc == 1) {
|
|
cocos2d::Size arg0;
|
|
ok &= jsval_to_ccsize(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::GridBase* ret = cocos2d::GridBase::create(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::GridBase>(cx, (cocos2d::GridBase*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
|
|
do {
|
|
if (argc == 3) {
|
|
cocos2d::Size arg0;
|
|
ok &= jsval_to_ccsize(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Texture2D* arg1 = nullptr;
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::Texture2D*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
if (!ok) { ok = true; break; }
|
|
bool arg2;
|
|
arg2 = JS::ToBoolean(args.get(2));
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::GridBase* ret = cocos2d::GridBase::create(arg0, arg1, arg2);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::GridBase>(cx, (cocos2d::GridBase*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
JS_ReportError(cx, "js_cocos2dx_GridBase_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
void js_register_cocos2dx_GridBase(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_GridBase_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_GridBase_class->name = "GridBase";
|
|
jsb_cocos2d_GridBase_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_GridBase_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_GridBase_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_GridBase_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_GridBase_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_GridBase_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_GridBase_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_GridBase_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("setGridSize", js_cocos2dx_GridBase_setGridSize, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setGridRect", js_cocos2dx_GridBase_setGridRect, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("afterBlit", js_cocos2dx_GridBase_afterBlit, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getGridRect", js_cocos2dx_GridBase_getGridRect, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("afterDraw", js_cocos2dx_GridBase_afterDraw, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("beforeDraw", js_cocos2dx_GridBase_beforeDraw, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("calculateVertexPoints", js_cocos2dx_GridBase_calculateVertexPoints, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("isTextureFlipped", js_cocos2dx_GridBase_isTextureFlipped, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getGridSize", js_cocos2dx_GridBase_getGridSize, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getStep", js_cocos2dx_GridBase_getStep, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("set2DProjection", js_cocos2dx_GridBase_set2DProjection, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setStep", js_cocos2dx_GridBase_setStep, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setTextureFlipped", js_cocos2dx_GridBase_setTextureFlipped, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("blit", js_cocos2dx_GridBase_blit, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setActive", js_cocos2dx_GridBase_setActive, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getReuseGrid", js_cocos2dx_GridBase_getReuseGrid, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initWithSize", js_cocos2dx_GridBase_initWithSize, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("beforeBlit", js_cocos2dx_GridBase_beforeBlit, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setReuseGrid", js_cocos2dx_GridBase_setReuseGrid, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("isActive", js_cocos2dx_GridBase_isActive, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("reuse", js_cocos2dx_GridBase_reuse, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_GridBase_create, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
jsb_cocos2d_GridBase_prototype = JS_InitClass(
|
|
cx, global,
|
|
JS::NullPtr(),
|
|
jsb_cocos2d_GridBase_class,
|
|
dummy_constructor<cocos2d::GridBase>, 0, // no constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_GridBase_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "GridBase"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::GridBase>(cx, jsb_cocos2d_GridBase_class, proto, JS::NullPtr());
|
|
anonEvaluate(cx, global, "(function () { cc.GridBase.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_Grid3D_class;
|
|
JSObject *jsb_cocos2d_Grid3D_prototype;
|
|
|
|
bool js_cocos2dx_Grid3D_getNeedDepthTestForBlit(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Grid3D* cobj = (cocos2d::Grid3D *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Grid3D_getNeedDepthTestForBlit : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->getNeedDepthTestForBlit();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Grid3D_getNeedDepthTestForBlit : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Grid3D_setNeedDepthTestForBlit(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Grid3D* cobj = (cocos2d::Grid3D *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Grid3D_setNeedDepthTestForBlit : Invalid Native Object");
|
|
if (argc == 1) {
|
|
bool arg0;
|
|
arg0 = JS::ToBoolean(args.get(0));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Grid3D_setNeedDepthTestForBlit : Error processing arguments");
|
|
cobj->setNeedDepthTestForBlit(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Grid3D_setNeedDepthTestForBlit : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Grid3D_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
|
|
do {
|
|
if (argc == 2) {
|
|
cocos2d::Size arg0;
|
|
ok &= jsval_to_ccsize(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Rect arg1;
|
|
ok &= jsval_to_ccrect(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Grid3D* ret = cocos2d::Grid3D::create(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Grid3D>(cx, (cocos2d::Grid3D*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
|
|
do {
|
|
if (argc == 1) {
|
|
cocos2d::Size arg0;
|
|
ok &= jsval_to_ccsize(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Grid3D* ret = cocos2d::Grid3D::create(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Grid3D>(cx, (cocos2d::Grid3D*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
|
|
do {
|
|
if (argc == 3) {
|
|
cocos2d::Size arg0;
|
|
ok &= jsval_to_ccsize(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Texture2D* arg1 = nullptr;
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::Texture2D*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
if (!ok) { ok = true; break; }
|
|
bool arg2;
|
|
arg2 = JS::ToBoolean(args.get(2));
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Grid3D* ret = cocos2d::Grid3D::create(arg0, arg1, arg2);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Grid3D>(cx, (cocos2d::Grid3D*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
|
|
do {
|
|
if (argc == 4) {
|
|
cocos2d::Size arg0;
|
|
ok &= jsval_to_ccsize(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Texture2D* arg1 = nullptr;
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::Texture2D*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
if (!ok) { ok = true; break; }
|
|
bool arg2;
|
|
arg2 = JS::ToBoolean(args.get(2));
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Rect arg3;
|
|
ok &= jsval_to_ccrect(cx, args.get(3), &arg3);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Grid3D* ret = cocos2d::Grid3D::create(arg0, arg1, arg2, arg3);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Grid3D>(cx, (cocos2d::Grid3D*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
JS_ReportError(cx, "js_cocos2dx_Grid3D_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Grid3D_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::Grid3D* cobj = new (std::nothrow) cocos2d::Grid3D();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::Grid3D>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::Grid3D"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_Grid3D_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::Grid3D *nobj = new (std::nothrow) cocos2d::Grid3D();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::Grid3D");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_GridBase_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_Grid3D(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_Grid3D_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_Grid3D_class->name = "Grid3D";
|
|
jsb_cocos2d_Grid3D_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Grid3D_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_Grid3D_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Grid3D_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_Grid3D_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_Grid3D_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_Grid3D_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_Grid3D_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("getNeedDepthTestForBlit", js_cocos2dx_Grid3D_getNeedDepthTestForBlit, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setNeedDepthTestForBlit", js_cocos2dx_Grid3D_setNeedDepthTestForBlit, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_Grid3D_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_Grid3D_create, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_GridBase_prototype);
|
|
jsb_cocos2d_Grid3D_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_Grid3D_class,
|
|
js_cocos2dx_Grid3D_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_Grid3D_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "Grid3D"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::Grid3D>(cx, jsb_cocos2d_Grid3D_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.Grid3D.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_TiledGrid3D_class;
|
|
JSObject *jsb_cocos2d_TiledGrid3D_prototype;
|
|
|
|
bool js_cocos2dx_TiledGrid3D_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
|
|
do {
|
|
if (argc == 2) {
|
|
cocos2d::Size arg0;
|
|
ok &= jsval_to_ccsize(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Rect arg1;
|
|
ok &= jsval_to_ccrect(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::TiledGrid3D* ret = cocos2d::TiledGrid3D::create(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::TiledGrid3D>(cx, (cocos2d::TiledGrid3D*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
|
|
do {
|
|
if (argc == 1) {
|
|
cocos2d::Size arg0;
|
|
ok &= jsval_to_ccsize(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::TiledGrid3D* ret = cocos2d::TiledGrid3D::create(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::TiledGrid3D>(cx, (cocos2d::TiledGrid3D*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
|
|
do {
|
|
if (argc == 3) {
|
|
cocos2d::Size arg0;
|
|
ok &= jsval_to_ccsize(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Texture2D* arg1 = nullptr;
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::Texture2D*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
if (!ok) { ok = true; break; }
|
|
bool arg2;
|
|
arg2 = JS::ToBoolean(args.get(2));
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::TiledGrid3D* ret = cocos2d::TiledGrid3D::create(arg0, arg1, arg2);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::TiledGrid3D>(cx, (cocos2d::TiledGrid3D*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
|
|
do {
|
|
if (argc == 4) {
|
|
cocos2d::Size arg0;
|
|
ok &= jsval_to_ccsize(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Texture2D* arg1 = nullptr;
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::Texture2D*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
if (!ok) { ok = true; break; }
|
|
bool arg2;
|
|
arg2 = JS::ToBoolean(args.get(2));
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Rect arg3;
|
|
ok &= jsval_to_ccrect(cx, args.get(3), &arg3);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::TiledGrid3D* ret = cocos2d::TiledGrid3D::create(arg0, arg1, arg2, arg3);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::TiledGrid3D>(cx, (cocos2d::TiledGrid3D*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
JS_ReportError(cx, "js_cocos2dx_TiledGrid3D_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TiledGrid3D_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::TiledGrid3D* cobj = new (std::nothrow) cocos2d::TiledGrid3D();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TiledGrid3D>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::TiledGrid3D"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_TiledGrid3D_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::TiledGrid3D *nobj = new (std::nothrow) cocos2d::TiledGrid3D();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::TiledGrid3D");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_GridBase_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_TiledGrid3D(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_TiledGrid3D_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_TiledGrid3D_class->name = "TiledGrid3D";
|
|
jsb_cocos2d_TiledGrid3D_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TiledGrid3D_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_TiledGrid3D_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TiledGrid3D_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_TiledGrid3D_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_TiledGrid3D_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_TiledGrid3D_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_TiledGrid3D_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("ctor", js_cocos2dx_TiledGrid3D_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_TiledGrid3D_create, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_GridBase_prototype);
|
|
jsb_cocos2d_TiledGrid3D_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_TiledGrid3D_class,
|
|
js_cocos2dx_TiledGrid3D_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_TiledGrid3D_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "TiledGrid3D"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::TiledGrid3D>(cx, jsb_cocos2d_TiledGrid3D_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.TiledGrid3D.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_BaseLight_class;
|
|
JSObject *jsb_cocos2d_BaseLight_prototype;
|
|
|
|
bool js_cocos2dx_BaseLight_setEnabled(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::BaseLight* cobj = (cocos2d::BaseLight *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_BaseLight_setEnabled : Invalid Native Object");
|
|
if (argc == 1) {
|
|
bool arg0;
|
|
arg0 = JS::ToBoolean(args.get(0));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_BaseLight_setEnabled : Error processing arguments");
|
|
cobj->setEnabled(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_BaseLight_setEnabled : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_BaseLight_getIntensity(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::BaseLight* cobj = (cocos2d::BaseLight *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_BaseLight_getIntensity : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getIntensity();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_BaseLight_getIntensity : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_BaseLight_isEnabled(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::BaseLight* cobj = (cocos2d::BaseLight *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_BaseLight_isEnabled : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->isEnabled();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_BaseLight_isEnabled : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_BaseLight_getLightType(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::BaseLight* cobj = (cocos2d::BaseLight *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_BaseLight_getLightType : Invalid Native Object");
|
|
if (argc == 0) {
|
|
int ret = (int)cobj->getLightType();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = int32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_BaseLight_getLightType : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_BaseLight_setLightFlag(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::BaseLight* cobj = (cocos2d::BaseLight *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_BaseLight_setLightFlag : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::LightFlag arg0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_BaseLight_setLightFlag : Error processing arguments");
|
|
cobj->setLightFlag(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_BaseLight_setLightFlag : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_BaseLight_setIntensity(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::BaseLight* cobj = (cocos2d::BaseLight *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_BaseLight_setIntensity : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_BaseLight_setIntensity : Error processing arguments");
|
|
cobj->setIntensity(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_BaseLight_setIntensity : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_BaseLight_getLightFlag(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::BaseLight* cobj = (cocos2d::BaseLight *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_BaseLight_getLightFlag : Invalid Native Object");
|
|
if (argc == 0) {
|
|
int ret = (int)cobj->getLightFlag();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = int32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_BaseLight_getLightFlag : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
|
|
extern JSObject *jsb_cocos2d_Node_prototype;
|
|
|
|
void js_register_cocos2dx_BaseLight(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_BaseLight_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_BaseLight_class->name = "BaseLight";
|
|
jsb_cocos2d_BaseLight_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_BaseLight_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_BaseLight_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_BaseLight_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_BaseLight_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_BaseLight_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_BaseLight_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_BaseLight_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("setEnabled", js_cocos2dx_BaseLight_setEnabled, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getIntensity", js_cocos2dx_BaseLight_getIntensity, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("isEnabled", js_cocos2dx_BaseLight_isEnabled, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getLightType", js_cocos2dx_BaseLight_getLightType, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setLightFlag", js_cocos2dx_BaseLight_setLightFlag, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setIntensity", js_cocos2dx_BaseLight_setIntensity, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getLightFlag", js_cocos2dx_BaseLight_getLightFlag, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JSFunctionSpec *st_funcs = NULL;
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_Node_prototype);
|
|
jsb_cocos2d_BaseLight_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_BaseLight_class,
|
|
empty_constructor, 0,
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_BaseLight_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "BaseLight"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::BaseLight>(cx, jsb_cocos2d_BaseLight_class, proto, parent_proto);
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_DirectionLight_class;
|
|
JSObject *jsb_cocos2d_DirectionLight_prototype;
|
|
|
|
bool js_cocos2dx_DirectionLight_getDirection(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::DirectionLight* cobj = (cocos2d::DirectionLight *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_DirectionLight_getDirection : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::Vec3 ret = cobj->getDirection();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = vector3_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_DirectionLight_getDirection : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_DirectionLight_getDirectionInWorld(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::DirectionLight* cobj = (cocos2d::DirectionLight *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_DirectionLight_getDirectionInWorld : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::Vec3 ret = cobj->getDirectionInWorld();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = vector3_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_DirectionLight_getDirectionInWorld : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_DirectionLight_setDirection(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::DirectionLight* cobj = (cocos2d::DirectionLight *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_DirectionLight_setDirection : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Vec3 arg0;
|
|
ok &= jsval_to_vector3(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_DirectionLight_setDirection : Error processing arguments");
|
|
cobj->setDirection(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_DirectionLight_setDirection : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_DirectionLight_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 2) {
|
|
cocos2d::Vec3 arg0;
|
|
cocos2d::Color3B arg1;
|
|
ok &= jsval_to_vector3(cx, args.get(0), &arg0);
|
|
ok &= jsval_to_cccolor3b(cx, args.get(1), &arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_DirectionLight_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::DirectionLight::create(arg0, arg1);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::DirectionLight>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::DirectionLight"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_DirectionLight_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_DirectionLight_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::DirectionLight* cobj = new (std::nothrow) cocos2d::DirectionLight();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::DirectionLight>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::DirectionLight"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_BaseLight_prototype;
|
|
|
|
void js_register_cocos2dx_DirectionLight(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_DirectionLight_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_DirectionLight_class->name = "DirectionLight";
|
|
jsb_cocos2d_DirectionLight_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_DirectionLight_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_DirectionLight_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_DirectionLight_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_DirectionLight_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_DirectionLight_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_DirectionLight_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_DirectionLight_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("getDirection", js_cocos2dx_DirectionLight_getDirection, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getDirectionInWorld", js_cocos2dx_DirectionLight_getDirectionInWorld, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setDirection", js_cocos2dx_DirectionLight_setDirection, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_DirectionLight_create, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_BaseLight_prototype);
|
|
jsb_cocos2d_DirectionLight_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_DirectionLight_class,
|
|
js_cocos2dx_DirectionLight_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_DirectionLight_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "DirectionLight"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::DirectionLight>(cx, jsb_cocos2d_DirectionLight_class, proto, parent_proto);
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_PointLight_class;
|
|
JSObject *jsb_cocos2d_PointLight_prototype;
|
|
|
|
bool js_cocos2dx_PointLight_getRange(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::PointLight* cobj = (cocos2d::PointLight *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_PointLight_getRange : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getRange();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_PointLight_getRange : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_PointLight_setRange(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::PointLight* cobj = (cocos2d::PointLight *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_PointLight_setRange : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_PointLight_setRange : Error processing arguments");
|
|
cobj->setRange(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_PointLight_setRange : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_PointLight_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 3) {
|
|
cocos2d::Vec3 arg0;
|
|
cocos2d::Color3B arg1;
|
|
double arg2 = 0;
|
|
ok &= jsval_to_vector3(cx, args.get(0), &arg0);
|
|
ok &= jsval_to_cccolor3b(cx, args.get(1), &arg1);
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_PointLight_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::PointLight::create(arg0, arg1, arg2);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::PointLight>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::PointLight"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_PointLight_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_PointLight_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::PointLight* cobj = new (std::nothrow) cocos2d::PointLight();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::PointLight>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::PointLight"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_BaseLight_prototype;
|
|
|
|
void js_register_cocos2dx_PointLight(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_PointLight_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_PointLight_class->name = "PointLight";
|
|
jsb_cocos2d_PointLight_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_PointLight_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_PointLight_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_PointLight_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_PointLight_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_PointLight_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_PointLight_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_PointLight_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("getRange", js_cocos2dx_PointLight_getRange, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setRange", js_cocos2dx_PointLight_setRange, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_PointLight_create, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_BaseLight_prototype);
|
|
jsb_cocos2d_PointLight_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_PointLight_class,
|
|
js_cocos2dx_PointLight_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_PointLight_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "PointLight"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::PointLight>(cx, jsb_cocos2d_PointLight_class, proto, parent_proto);
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_SpotLight_class;
|
|
JSObject *jsb_cocos2d_SpotLight_prototype;
|
|
|
|
bool js_cocos2dx_SpotLight_getRange(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::SpotLight* cobj = (cocos2d::SpotLight *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpotLight_getRange : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getRange();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SpotLight_getRange : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SpotLight_setDirection(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::SpotLight* cobj = (cocos2d::SpotLight *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpotLight_setDirection : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Vec3 arg0;
|
|
ok &= jsval_to_vector3(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SpotLight_setDirection : Error processing arguments");
|
|
cobj->setDirection(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SpotLight_setDirection : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SpotLight_getCosInnerAngle(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::SpotLight* cobj = (cocos2d::SpotLight *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpotLight_getCosInnerAngle : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getCosInnerAngle();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SpotLight_getCosInnerAngle : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SpotLight_getOuterAngle(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::SpotLight* cobj = (cocos2d::SpotLight *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpotLight_getOuterAngle : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getOuterAngle();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SpotLight_getOuterAngle : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SpotLight_getInnerAngle(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::SpotLight* cobj = (cocos2d::SpotLight *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpotLight_getInnerAngle : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getInnerAngle();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SpotLight_getInnerAngle : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SpotLight_getDirection(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::SpotLight* cobj = (cocos2d::SpotLight *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpotLight_getDirection : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::Vec3 ret = cobj->getDirection();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = vector3_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SpotLight_getDirection : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SpotLight_getCosOuterAngle(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::SpotLight* cobj = (cocos2d::SpotLight *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpotLight_getCosOuterAngle : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getCosOuterAngle();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SpotLight_getCosOuterAngle : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SpotLight_setOuterAngle(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::SpotLight* cobj = (cocos2d::SpotLight *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpotLight_setOuterAngle : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SpotLight_setOuterAngle : Error processing arguments");
|
|
cobj->setOuterAngle(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SpotLight_setOuterAngle : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SpotLight_setInnerAngle(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::SpotLight* cobj = (cocos2d::SpotLight *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpotLight_setInnerAngle : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SpotLight_setInnerAngle : Error processing arguments");
|
|
cobj->setInnerAngle(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SpotLight_setInnerAngle : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SpotLight_getDirectionInWorld(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::SpotLight* cobj = (cocos2d::SpotLight *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpotLight_getDirectionInWorld : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::Vec3 ret = cobj->getDirectionInWorld();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = vector3_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SpotLight_getDirectionInWorld : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SpotLight_setRange(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::SpotLight* cobj = (cocos2d::SpotLight *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpotLight_setRange : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SpotLight_setRange : Error processing arguments");
|
|
cobj->setRange(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SpotLight_setRange : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SpotLight_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 6) {
|
|
cocos2d::Vec3 arg0;
|
|
cocos2d::Vec3 arg1;
|
|
cocos2d::Color3B arg2;
|
|
double arg3 = 0;
|
|
double arg4 = 0;
|
|
double arg5 = 0;
|
|
ok &= jsval_to_vector3(cx, args.get(0), &arg0);
|
|
ok &= jsval_to_vector3(cx, args.get(1), &arg1);
|
|
ok &= jsval_to_cccolor3b(cx, args.get(2), &arg2);
|
|
ok &= JS::ToNumber( cx, args.get(3), &arg3) && !std::isnan(arg3);
|
|
ok &= JS::ToNumber( cx, args.get(4), &arg4) && !std::isnan(arg4);
|
|
ok &= JS::ToNumber( cx, args.get(5), &arg5) && !std::isnan(arg5);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SpotLight_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::SpotLight::create(arg0, arg1, arg2, arg3, arg4, arg5);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::SpotLight>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::SpotLight"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_SpotLight_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_SpotLight_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::SpotLight* cobj = new (std::nothrow) cocos2d::SpotLight();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::SpotLight>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::SpotLight"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_BaseLight_prototype;
|
|
|
|
void js_register_cocos2dx_SpotLight(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_SpotLight_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_SpotLight_class->name = "SpotLight";
|
|
jsb_cocos2d_SpotLight_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_SpotLight_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_SpotLight_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_SpotLight_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_SpotLight_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_SpotLight_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_SpotLight_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_SpotLight_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("getRange", js_cocos2dx_SpotLight_getRange, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setDirection", js_cocos2dx_SpotLight_setDirection, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getCosInnerAngle", js_cocos2dx_SpotLight_getCosInnerAngle, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getOuterAngle", js_cocos2dx_SpotLight_getOuterAngle, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getInnerAngle", js_cocos2dx_SpotLight_getInnerAngle, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getDirection", js_cocos2dx_SpotLight_getDirection, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getCosOuterAngle", js_cocos2dx_SpotLight_getCosOuterAngle, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setOuterAngle", js_cocos2dx_SpotLight_setOuterAngle, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setInnerAngle", js_cocos2dx_SpotLight_setInnerAngle, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getDirectionInWorld", js_cocos2dx_SpotLight_getDirectionInWorld, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setRange", js_cocos2dx_SpotLight_setRange, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_SpotLight_create, 6, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_BaseLight_prototype);
|
|
jsb_cocos2d_SpotLight_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_SpotLight_class,
|
|
js_cocos2dx_SpotLight_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_SpotLight_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "SpotLight"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::SpotLight>(cx, jsb_cocos2d_SpotLight_class, proto, parent_proto);
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_AmbientLight_class;
|
|
JSObject *jsb_cocos2d_AmbientLight_prototype;
|
|
|
|
bool js_cocos2dx_AmbientLight_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
cocos2d::Color3B arg0;
|
|
ok &= jsval_to_cccolor3b(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_AmbientLight_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::AmbientLight::create(arg0);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::AmbientLight>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::AmbientLight"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_AmbientLight_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_AmbientLight_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::AmbientLight* cobj = new (std::nothrow) cocos2d::AmbientLight();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::AmbientLight>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::AmbientLight"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_BaseLight_prototype;
|
|
|
|
void js_register_cocos2dx_AmbientLight(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_AmbientLight_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_AmbientLight_class->name = "AmbientLight";
|
|
jsb_cocos2d_AmbientLight_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_AmbientLight_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_AmbientLight_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_AmbientLight_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_AmbientLight_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_AmbientLight_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_AmbientLight_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_AmbientLight_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_AmbientLight_create, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_BaseLight_prototype);
|
|
jsb_cocos2d_AmbientLight_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_AmbientLight_class,
|
|
js_cocos2dx_AmbientLight_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_AmbientLight_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "AmbientLight"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::AmbientLight>(cx, jsb_cocos2d_AmbientLight_class, proto, parent_proto);
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_GLProgram_class;
|
|
JSObject *jsb_cocos2d_GLProgram_prototype;
|
|
|
|
bool js_cocos2dx_GLProgram_getFragmentShaderLog(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GLProgram* cobj = (cocos2d::GLProgram *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgram_getFragmentShaderLog : Invalid Native Object");
|
|
if (argc == 0) {
|
|
std::string ret = cobj->getFragmentShaderLog();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = std_string_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLProgram_getFragmentShaderLog : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLProgram_bindAttribLocation(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GLProgram* cobj = (cocos2d::GLProgram *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgram_bindAttribLocation : Invalid Native Object");
|
|
if (argc == 2) {
|
|
std::string arg0;
|
|
unsigned int arg1 = 0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
ok &= jsval_to_uint32(cx, args.get(1), &arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_GLProgram_bindAttribLocation : Error processing arguments");
|
|
cobj->bindAttribLocation(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLProgram_bindAttribLocation : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLProgram_getUniformFlags(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GLProgram* cobj = (cocos2d::GLProgram *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgram_getUniformFlags : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const cocos2d::GLProgram::UniformFlags& ret = cobj->getUniformFlags();
|
|
jsval jsret = JSVAL_NULL;
|
|
#pragma warning NO CONVERSION FROM NATIVE FOR UniformFlags;
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLProgram_getUniformFlags : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLProgram_getUniformLocationForName(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GLProgram* cobj = (cocos2d::GLProgram *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgram_getUniformLocationForName : Invalid Native Object");
|
|
if (argc == 1) {
|
|
const char* arg0 = nullptr;
|
|
std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str();
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_GLProgram_getUniformLocationForName : Error processing arguments");
|
|
int ret = cobj->getUniformLocationForName(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = int32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLProgram_getUniformLocationForName : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLProgram_use(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GLProgram* cobj = (cocos2d::GLProgram *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgram_use : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->use();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLProgram_use : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLProgram_getVertexShaderLog(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GLProgram* cobj = (cocos2d::GLProgram *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgram_getVertexShaderLog : Invalid Native Object");
|
|
if (argc == 0) {
|
|
std::string ret = cobj->getVertexShaderLog();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = std_string_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLProgram_getVertexShaderLog : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLProgram_getUniform(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GLProgram* cobj = (cocos2d::GLProgram *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgram_getUniform : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_GLProgram_getUniform : Error processing arguments");
|
|
cocos2d::Uniform* ret = cobj->getUniform(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = uniform_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLProgram_getUniform : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLProgram_initWithByteArrays(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::GLProgram* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::GLProgram *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgram_initWithByteArrays : Invalid Native Object");
|
|
do {
|
|
if (argc == 3) {
|
|
const char* arg0 = nullptr;
|
|
std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str();
|
|
if (!ok) { ok = true; break; }
|
|
const char* arg1 = nullptr;
|
|
std::string arg1_tmp; ok &= jsval_to_std_string(cx, args.get(1), &arg1_tmp); arg1 = arg1_tmp.c_str();
|
|
if (!ok) { ok = true; break; }
|
|
std::string arg2;
|
|
ok &= jsval_to_std_string(cx, args.get(2), &arg2);
|
|
if (!ok) { ok = true; break; }
|
|
bool ret = cobj->initWithByteArrays(arg0, arg1, arg2);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 2) {
|
|
const char* arg0 = nullptr;
|
|
std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str();
|
|
if (!ok) { ok = true; break; }
|
|
const char* arg1 = nullptr;
|
|
std::string arg1_tmp; ok &= jsval_to_std_string(cx, args.get(1), &arg1_tmp); arg1 = arg1_tmp.c_str();
|
|
if (!ok) { ok = true; break; }
|
|
bool ret = cobj->initWithByteArrays(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 4) {
|
|
const char* arg0 = nullptr;
|
|
std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str();
|
|
if (!ok) { ok = true; break; }
|
|
const char* arg1 = nullptr;
|
|
std::string arg1_tmp; ok &= jsval_to_std_string(cx, args.get(1), &arg1_tmp); arg1 = arg1_tmp.c_str();
|
|
if (!ok) { ok = true; break; }
|
|
std::string arg2;
|
|
ok &= jsval_to_std_string(cx, args.get(2), &arg2);
|
|
if (!ok) { ok = true; break; }
|
|
std::string arg3;
|
|
ok &= jsval_to_std_string(cx, args.get(3), &arg3);
|
|
if (!ok) { ok = true; break; }
|
|
bool ret = cobj->initWithByteArrays(arg0, arg1, arg2, arg3);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLProgram_initWithByteArrays : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLProgram_setUniformLocationWith1f(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GLProgram* cobj = (cocos2d::GLProgram *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgram_setUniformLocationWith1f : Invalid Native Object");
|
|
if (argc == 2) {
|
|
int arg0 = 0;
|
|
double arg1 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_GLProgram_setUniformLocationWith1f : Error processing arguments");
|
|
cobj->setUniformLocationWith1f(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLProgram_setUniformLocationWith1f : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLProgram_initWithFilenames(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::GLProgram* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::GLProgram *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgram_initWithFilenames : Invalid Native Object");
|
|
do {
|
|
if (argc == 3) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
std::string arg1;
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
std::string arg2;
|
|
ok &= jsval_to_std_string(cx, args.get(2), &arg2);
|
|
if (!ok) { ok = true; break; }
|
|
bool ret = cobj->initWithFilenames(arg0, arg1, arg2);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 2) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
std::string arg1;
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
bool ret = cobj->initWithFilenames(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 4) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
std::string arg1;
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
std::string arg2;
|
|
ok &= jsval_to_std_string(cx, args.get(2), &arg2);
|
|
if (!ok) { ok = true; break; }
|
|
std::string arg3;
|
|
ok &= jsval_to_std_string(cx, args.get(3), &arg3);
|
|
if (!ok) { ok = true; break; }
|
|
bool ret = cobj->initWithFilenames(arg0, arg1, arg2, arg3);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLProgram_initWithFilenames : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLProgram_setUniformLocationWith3f(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GLProgram* cobj = (cocos2d::GLProgram *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgram_setUniformLocationWith3f : Invalid Native Object");
|
|
if (argc == 4) {
|
|
int arg0 = 0;
|
|
double arg1 = 0;
|
|
double arg2 = 0;
|
|
double arg3 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
ok &= JS::ToNumber( cx, args.get(3), &arg3) && !std::isnan(arg3);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_GLProgram_setUniformLocationWith3f : Error processing arguments");
|
|
cobj->setUniformLocationWith3f(arg0, arg1, arg2, arg3);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLProgram_setUniformLocationWith3f : wrong number of arguments: %d, was expecting %d", argc, 4);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLProgram_setUniformsForBuiltins(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::GLProgram* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::GLProgram *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgram_setUniformsForBuiltins : Invalid Native Object");
|
|
do {
|
|
if (argc == 0) {
|
|
cobj->setUniformsForBuiltins();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 1) {
|
|
cocos2d::Mat4 arg0;
|
|
ok &= jsval_to_matrix(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cobj->setUniformsForBuiltins(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLProgram_setUniformsForBuiltins : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLProgram_setUniformLocationWith3i(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GLProgram* cobj = (cocos2d::GLProgram *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgram_setUniformLocationWith3i : Invalid Native Object");
|
|
if (argc == 4) {
|
|
int arg0 = 0;
|
|
int arg1 = 0;
|
|
int arg2 = 0;
|
|
int arg3 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1);
|
|
ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2);
|
|
ok &= jsval_to_int32(cx, args.get(3), (int32_t *)&arg3);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_GLProgram_setUniformLocationWith3i : Error processing arguments");
|
|
cobj->setUniformLocationWith3i(arg0, arg1, arg2, arg3);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLProgram_setUniformLocationWith3i : wrong number of arguments: %d, was expecting %d", argc, 4);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLProgram_setUniformLocationWith4f(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GLProgram* cobj = (cocos2d::GLProgram *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgram_setUniformLocationWith4f : Invalid Native Object");
|
|
if (argc == 5) {
|
|
int arg0 = 0;
|
|
double arg1 = 0;
|
|
double arg2 = 0;
|
|
double arg3 = 0;
|
|
double arg4 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
ok &= JS::ToNumber( cx, args.get(3), &arg3) && !std::isnan(arg3);
|
|
ok &= JS::ToNumber( cx, args.get(4), &arg4) && !std::isnan(arg4);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_GLProgram_setUniformLocationWith4f : Error processing arguments");
|
|
cobj->setUniformLocationWith4f(arg0, arg1, arg2, arg3, arg4);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLProgram_setUniformLocationWith4f : wrong number of arguments: %d, was expecting %d", argc, 5);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLProgram_updateUniforms(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GLProgram* cobj = (cocos2d::GLProgram *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgram_updateUniforms : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->updateUniforms();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLProgram_updateUniforms : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLProgram_getUniformLocation(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GLProgram* cobj = (cocos2d::GLProgram *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgram_getUniformLocation : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_GLProgram_getUniformLocation : Error processing arguments");
|
|
int ret = cobj->getUniformLocation(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = int32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLProgram_getUniformLocation : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLProgram_link(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GLProgram* cobj = (cocos2d::GLProgram *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgram_link : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->link();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLProgram_link : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLProgram_reset(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GLProgram* cobj = (cocos2d::GLProgram *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgram_reset : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->reset();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLProgram_reset : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLProgram_getAttribLocation(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GLProgram* cobj = (cocos2d::GLProgram *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgram_getAttribLocation : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_GLProgram_getAttribLocation : Error processing arguments");
|
|
int ret = cobj->getAttribLocation(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = int32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLProgram_getAttribLocation : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLProgram_getVertexAttrib(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GLProgram* cobj = (cocos2d::GLProgram *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgram_getVertexAttrib : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_GLProgram_getVertexAttrib : Error processing arguments");
|
|
cocos2d::VertexAttrib* ret = cobj->getVertexAttrib(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
#pragma warning NO CONVERSION FROM NATIVE FOR VertexAttrib*;
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLProgram_getVertexAttrib : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLProgram_setUniformLocationWith2f(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GLProgram* cobj = (cocos2d::GLProgram *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgram_setUniformLocationWith2f : Invalid Native Object");
|
|
if (argc == 3) {
|
|
int arg0 = 0;
|
|
double arg1 = 0;
|
|
double arg2 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1);
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_GLProgram_setUniformLocationWith2f : Error processing arguments");
|
|
cobj->setUniformLocationWith2f(arg0, arg1, arg2);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLProgram_setUniformLocationWith2f : wrong number of arguments: %d, was expecting %d", argc, 3);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLProgram_setUniformLocationWith4i(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GLProgram* cobj = (cocos2d::GLProgram *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgram_setUniformLocationWith4i : Invalid Native Object");
|
|
if (argc == 5) {
|
|
int arg0 = 0;
|
|
int arg1 = 0;
|
|
int arg2 = 0;
|
|
int arg3 = 0;
|
|
int arg4 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1);
|
|
ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2);
|
|
ok &= jsval_to_int32(cx, args.get(3), (int32_t *)&arg3);
|
|
ok &= jsval_to_int32(cx, args.get(4), (int32_t *)&arg4);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_GLProgram_setUniformLocationWith4i : Error processing arguments");
|
|
cobj->setUniformLocationWith4i(arg0, arg1, arg2, arg3, arg4);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLProgram_setUniformLocationWith4i : wrong number of arguments: %d, was expecting %d", argc, 5);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLProgram_setUniformLocationWith1i(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GLProgram* cobj = (cocos2d::GLProgram *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgram_setUniformLocationWith1i : Invalid Native Object");
|
|
if (argc == 2) {
|
|
int arg0 = 0;
|
|
int arg1 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_GLProgram_setUniformLocationWith1i : Error processing arguments");
|
|
cobj->setUniformLocationWith1i(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLProgram_setUniformLocationWith1i : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLProgram_setUniformLocationWith2i(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GLProgram* cobj = (cocos2d::GLProgram *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgram_setUniformLocationWith2i : Invalid Native Object");
|
|
if (argc == 3) {
|
|
int arg0 = 0;
|
|
int arg1 = 0;
|
|
int arg2 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1);
|
|
ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_GLProgram_setUniformLocationWith2i : Error processing arguments");
|
|
cobj->setUniformLocationWith2i(arg0, arg1, arg2);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLProgram_setUniformLocationWith2i : wrong number of arguments: %d, was expecting %d", argc, 3);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLProgram_createWithByteArrays(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
|
|
do {
|
|
if (argc == 3) {
|
|
const char* arg0 = nullptr;
|
|
std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str();
|
|
if (!ok) { ok = true; break; }
|
|
const char* arg1 = nullptr;
|
|
std::string arg1_tmp; ok &= jsval_to_std_string(cx, args.get(1), &arg1_tmp); arg1 = arg1_tmp.c_str();
|
|
if (!ok) { ok = true; break; }
|
|
std::string arg2;
|
|
ok &= jsval_to_std_string(cx, args.get(2), &arg2);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::GLProgram* ret = cocos2d::GLProgram::createWithByteArrays(arg0, arg1, arg2);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::GLProgram>(cx, (cocos2d::GLProgram*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
|
|
do {
|
|
if (argc == 2) {
|
|
const char* arg0 = nullptr;
|
|
std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str();
|
|
if (!ok) { ok = true; break; }
|
|
const char* arg1 = nullptr;
|
|
std::string arg1_tmp; ok &= jsval_to_std_string(cx, args.get(1), &arg1_tmp); arg1 = arg1_tmp.c_str();
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::GLProgram* ret = cocos2d::GLProgram::createWithByteArrays(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::GLProgram>(cx, (cocos2d::GLProgram*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
|
|
do {
|
|
if (argc == 4) {
|
|
const char* arg0 = nullptr;
|
|
std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str();
|
|
if (!ok) { ok = true; break; }
|
|
const char* arg1 = nullptr;
|
|
std::string arg1_tmp; ok &= jsval_to_std_string(cx, args.get(1), &arg1_tmp); arg1 = arg1_tmp.c_str();
|
|
if (!ok) { ok = true; break; }
|
|
std::string arg2;
|
|
ok &= jsval_to_std_string(cx, args.get(2), &arg2);
|
|
if (!ok) { ok = true; break; }
|
|
std::string arg3;
|
|
ok &= jsval_to_std_string(cx, args.get(3), &arg3);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::GLProgram* ret = cocos2d::GLProgram::createWithByteArrays(arg0, arg1, arg2, arg3);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::GLProgram>(cx, (cocos2d::GLProgram*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
JS_ReportError(cx, "js_cocos2dx_GLProgram_createWithByteArrays : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLProgram_createWithFilenames(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
|
|
do {
|
|
if (argc == 3) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
std::string arg1;
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
std::string arg2;
|
|
ok &= jsval_to_std_string(cx, args.get(2), &arg2);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::GLProgram* ret = cocos2d::GLProgram::createWithFilenames(arg0, arg1, arg2);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::GLProgram>(cx, (cocos2d::GLProgram*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
|
|
do {
|
|
if (argc == 2) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
std::string arg1;
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::GLProgram* ret = cocos2d::GLProgram::createWithFilenames(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::GLProgram>(cx, (cocos2d::GLProgram*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
|
|
do {
|
|
if (argc == 4) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
std::string arg1;
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
std::string arg2;
|
|
ok &= jsval_to_std_string(cx, args.get(2), &arg2);
|
|
if (!ok) { ok = true; break; }
|
|
std::string arg3;
|
|
ok &= jsval_to_std_string(cx, args.get(3), &arg3);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::GLProgram* ret = cocos2d::GLProgram::createWithFilenames(arg0, arg1, arg2, arg3);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::GLProgram>(cx, (cocos2d::GLProgram*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
JS_ReportError(cx, "js_cocos2dx_GLProgram_createWithFilenames : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLProgram_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::GLProgram* cobj = new (std::nothrow) cocos2d::GLProgram();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::GLProgram>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::GLProgram"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_GLProgram_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::GLProgram *nobj = new (std::nothrow) cocos2d::GLProgram();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::GLProgram");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
|
|
void js_register_cocos2dx_GLProgram(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_GLProgram_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_GLProgram_class->name = "GLProgram";
|
|
jsb_cocos2d_GLProgram_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_GLProgram_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_GLProgram_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_GLProgram_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_GLProgram_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_GLProgram_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_GLProgram_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_GLProgram_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("getFragmentShaderLog", js_cocos2dx_GLProgram_getFragmentShaderLog, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("addAttribute", js_cocos2dx_GLProgram_bindAttribLocation, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getUniformFlags", js_cocos2dx_GLProgram_getUniformFlags, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getUniformLocationForName", js_cocos2dx_GLProgram_getUniformLocationForName, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("use", js_cocos2dx_GLProgram_use, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getVertexShaderLog", js_cocos2dx_GLProgram_getVertexShaderLog, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getUniform", js_cocos2dx_GLProgram_getUniform, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initWithString", js_cocos2dx_GLProgram_initWithByteArrays, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setUniformLocationWith1f", js_cocos2dx_GLProgram_setUniformLocationWith1f, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("init", js_cocos2dx_GLProgram_initWithFilenames, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setUniformLocationWith3f", js_cocos2dx_GLProgram_setUniformLocationWith3f, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setUniformsForBuiltins", js_cocos2dx_GLProgram_setUniformsForBuiltins, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setUniformLocationWith3i", js_cocos2dx_GLProgram_setUniformLocationWith3i, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setUniformLocationWith4f", js_cocos2dx_GLProgram_setUniformLocationWith4f, 5, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("updateUniforms", js_cocos2dx_GLProgram_updateUniforms, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getUniformLocation", js_cocos2dx_GLProgram_getUniformLocation, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("link", js_cocos2dx_GLProgram_link, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("reset", js_cocos2dx_GLProgram_reset, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getAttribLocation", js_cocos2dx_GLProgram_getAttribLocation, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getVertexAttrib", js_cocos2dx_GLProgram_getVertexAttrib, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setUniformLocationWith2f", js_cocos2dx_GLProgram_setUniformLocationWith2f, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setUniformLocationWith4i", js_cocos2dx_GLProgram_setUniformLocationWith4i, 5, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setUniformLocationI32", js_cocos2dx_GLProgram_setUniformLocationWith1i, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setUniformLocationWith2i", js_cocos2dx_GLProgram_setUniformLocationWith2i, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_GLProgram_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("createWithByteArrays", js_cocos2dx_GLProgram_createWithByteArrays, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("createWithFilenames", js_cocos2dx_GLProgram_createWithFilenames, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
jsb_cocos2d_GLProgram_prototype = JS_InitClass(
|
|
cx, global,
|
|
JS::NullPtr(),
|
|
jsb_cocos2d_GLProgram_class,
|
|
js_cocos2dx_GLProgram_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_GLProgram_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "GLProgram"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::GLProgram>(cx, jsb_cocos2d_GLProgram_class, proto, JS::NullPtr());
|
|
anonEvaluate(cx, global, "(function () { cc.GLProgram.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_GLProgramCache_class;
|
|
JSObject *jsb_cocos2d_GLProgramCache_prototype;
|
|
|
|
bool js_cocos2dx_GLProgramCache_loadDefaultGLPrograms(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GLProgramCache* cobj = (cocos2d::GLProgramCache *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgramCache_loadDefaultGLPrograms : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->loadDefaultGLPrograms();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLProgramCache_loadDefaultGLPrograms : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLProgramCache_reloadDefaultGLProgramsRelativeToLights(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GLProgramCache* cobj = (cocos2d::GLProgramCache *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgramCache_reloadDefaultGLProgramsRelativeToLights : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->reloadDefaultGLProgramsRelativeToLights();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLProgramCache_reloadDefaultGLProgramsRelativeToLights : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLProgramCache_addGLProgram(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GLProgramCache* cobj = (cocos2d::GLProgramCache *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgramCache_addGLProgram : Invalid Native Object");
|
|
if (argc == 2) {
|
|
cocos2d::GLProgram* arg0 = nullptr;
|
|
std::string arg1;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::GLProgram*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_GLProgramCache_addGLProgram : Error processing arguments");
|
|
cobj->addGLProgram(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLProgramCache_addGLProgram : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLProgramCache_reloadDefaultGLPrograms(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GLProgramCache* cobj = (cocos2d::GLProgramCache *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgramCache_reloadDefaultGLPrograms : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->reloadDefaultGLPrograms();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLProgramCache_reloadDefaultGLPrograms : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLProgramCache_getGLProgram(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::GLProgramCache* cobj = (cocos2d::GLProgramCache *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLProgramCache_getGLProgram : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_GLProgramCache_getGLProgram : Error processing arguments");
|
|
cocos2d::GLProgram* ret = cobj->getGLProgram(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::GLProgram>(cx, (cocos2d::GLProgram*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_GLProgramCache_getGLProgram : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_GLProgramCache_destroyInstance(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
if (argc == 0) {
|
|
cocos2d::GLProgramCache::destroyInstance();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_GLProgramCache_destroyInstance : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_GLProgramCache_getInstance(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
if (argc == 0) {
|
|
|
|
auto ret = cocos2d::GLProgramCache::getInstance();
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::GLProgramCache>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_get_or_create_jsobject(cx, ret, typeClass, "cocos2d::GLProgramCache"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_GLProgramCache_getInstance : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_GLProgramCache_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::GLProgramCache* cobj = new (std::nothrow) cocos2d::GLProgramCache();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::GLProgramCache>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::GLProgramCache"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
|
|
|
|
void js_register_cocos2dx_GLProgramCache(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_GLProgramCache_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_GLProgramCache_class->name = "ShaderCache";
|
|
jsb_cocos2d_GLProgramCache_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_GLProgramCache_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_GLProgramCache_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_GLProgramCache_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_GLProgramCache_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_GLProgramCache_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_GLProgramCache_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_GLProgramCache_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("loadDefaultShaders", js_cocos2dx_GLProgramCache_loadDefaultGLPrograms, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("reloadDefaultGLProgramsRelativeToLights", js_cocos2dx_GLProgramCache_reloadDefaultGLProgramsRelativeToLights, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("addProgram", js_cocos2dx_GLProgramCache_addGLProgram, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("reloadDefaultShaders", js_cocos2dx_GLProgramCache_reloadDefaultGLPrograms, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getProgram", js_cocos2dx_GLProgramCache_getGLProgram, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("destroyInstance", js_cocos2dx_GLProgramCache_destroyInstance, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getInstance", js_cocos2dx_GLProgramCache_getInstance, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
jsb_cocos2d_GLProgramCache_prototype = JS_InitClass(
|
|
cx, global,
|
|
JS::NullPtr(),
|
|
jsb_cocos2d_GLProgramCache_class,
|
|
js_cocos2dx_GLProgramCache_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_GLProgramCache_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "GLProgramCache"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::GLProgramCache>(cx, jsb_cocos2d_GLProgramCache_class, proto, JS::NullPtr());
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_RenderState_class;
|
|
JSObject *jsb_cocos2d_RenderState_prototype;
|
|
|
|
bool js_cocos2dx_RenderState_setTexture(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::RenderState* cobj = (cocos2d::RenderState *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_RenderState_setTexture : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Texture2D* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Texture2D*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_RenderState_setTexture : Error processing arguments");
|
|
cobj->setTexture(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_RenderState_setTexture : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_RenderState_getTopmost(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::RenderState* cobj = (cocos2d::RenderState *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_RenderState_getTopmost : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::RenderState* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::RenderState*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_RenderState_getTopmost : Error processing arguments");
|
|
cocos2d::RenderState* ret = cobj->getTopmost(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::RenderState>(cx, (cocos2d::RenderState*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_RenderState_getTopmost : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_RenderState_getTexture(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::RenderState* cobj = (cocos2d::RenderState *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_RenderState_getTexture : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::Texture2D* ret = cobj->getTexture();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Texture2D>(cx, (cocos2d::Texture2D*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_RenderState_getTexture : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_RenderState_bind(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::RenderState* cobj = (cocos2d::RenderState *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_RenderState_bind : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Pass* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Pass*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_RenderState_bind : Error processing arguments");
|
|
cobj->bind(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_RenderState_bind : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_RenderState_getName(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::RenderState* cobj = (cocos2d::RenderState *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_RenderState_getName : Invalid Native Object");
|
|
if (argc == 0) {
|
|
std::string ret = cobj->getName();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = std_string_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_RenderState_getName : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_RenderState_getStateBlock(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::RenderState* cobj = (cocos2d::RenderState *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_RenderState_getStateBlock : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::RenderState::StateBlock* ret = cobj->getStateBlock();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::RenderState::StateBlock>(cx, (cocos2d::RenderState::StateBlock*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_RenderState_getStateBlock : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_RenderState_setParent(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::RenderState* cobj = (cocos2d::RenderState *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_RenderState_setParent : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::RenderState* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::RenderState*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_RenderState_setParent : Error processing arguments");
|
|
cobj->setParent(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_RenderState_setParent : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_RenderState_initialize(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
if (argc == 0) {
|
|
cocos2d::RenderState::initialize();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_RenderState_initialize : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_RenderState_finalize(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
if (argc == 0) {
|
|
cocos2d::RenderState::finalize();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_RenderState_finalize : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
|
|
void js_register_cocos2dx_RenderState(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_RenderState_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_RenderState_class->name = "RenderState";
|
|
jsb_cocos2d_RenderState_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_RenderState_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_RenderState_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_RenderState_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_RenderState_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_RenderState_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_RenderState_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_RenderState_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("setTexture", js_cocos2dx_RenderState_setTexture, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getTopmost", js_cocos2dx_RenderState_getTopmost, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getTexture", js_cocos2dx_RenderState_getTexture, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("bind", js_cocos2dx_RenderState_bind, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getName", js_cocos2dx_RenderState_getName, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getStateBlock", js_cocos2dx_RenderState_getStateBlock, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setParent", js_cocos2dx_RenderState_setParent, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("initialize", js_cocos2dx_RenderState_initialize, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("finalize", js_cocos2dx_RenderState_finalize, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
jsb_cocos2d_RenderState_prototype = JS_InitClass(
|
|
cx, global,
|
|
JS::NullPtr(),
|
|
jsb_cocos2d_RenderState_class,
|
|
dummy_constructor<cocos2d::RenderState>, 0, // no constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_RenderState_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "RenderState"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::RenderState>(cx, jsb_cocos2d_RenderState_class, proto, JS::NullPtr());
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_Pass_class;
|
|
JSObject *jsb_cocos2d_Pass_prototype;
|
|
|
|
bool js_cocos2dx_Pass_unbind(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Pass* cobj = (cocos2d::Pass *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Pass_unbind : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->unbind();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Pass_unbind : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Pass_bind(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::Pass* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::Pass *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Pass_bind : Invalid Native Object");
|
|
do {
|
|
if (argc == 2) {
|
|
cocos2d::Mat4 arg0;
|
|
ok &= jsval_to_matrix(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
bool arg1;
|
|
arg1 = JS::ToBoolean(args.get(1));
|
|
cobj->bind(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 1) {
|
|
cocos2d::Mat4 arg0;
|
|
ok &= jsval_to_matrix(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cobj->bind(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Pass_bind : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Pass_clone(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Pass* cobj = (cocos2d::Pass *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Pass_clone : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::Pass* ret = cobj->clone();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Pass>(cx, (cocos2d::Pass*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Pass_clone : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Pass_getGLProgramState(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Pass* cobj = (cocos2d::Pass *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Pass_getGLProgramState : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::GLProgramState* ret = cobj->getGLProgramState();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::GLProgramState>(cx, (cocos2d::GLProgramState*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Pass_getGLProgramState : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Pass_getVertexAttributeBinding(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Pass* cobj = (cocos2d::Pass *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Pass_getVertexAttributeBinding : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::VertexAttribBinding* ret = cobj->getVertexAttributeBinding();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::VertexAttribBinding>(cx, (cocos2d::VertexAttribBinding*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Pass_getVertexAttributeBinding : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Pass_getHash(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Pass* cobj = (cocos2d::Pass *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Pass_getHash : Invalid Native Object");
|
|
if (argc == 0) {
|
|
unsigned int ret = cobj->getHash();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = uint32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Pass_getHash : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Pass_setVertexAttribBinding(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Pass* cobj = (cocos2d::Pass *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Pass_setVertexAttribBinding : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::VertexAttribBinding* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::VertexAttribBinding*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Pass_setVertexAttribBinding : Error processing arguments");
|
|
cobj->setVertexAttribBinding(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Pass_setVertexAttribBinding : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Pass_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
cocos2d::Technique* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Technique*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Pass_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::Pass::create(arg0);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::Pass>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::Pass"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_Pass_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_Pass_createWithGLProgramState(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 2) {
|
|
cocos2d::Technique* arg0 = nullptr;
|
|
cocos2d::GLProgramState* arg1 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Technique*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::GLProgramState*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Pass_createWithGLProgramState : Error processing arguments");
|
|
|
|
auto ret = cocos2d::Pass::createWithGLProgramState(arg0, arg1);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::Pass>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::Pass"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_Pass_createWithGLProgramState : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_RenderState_prototype;
|
|
|
|
void js_register_cocos2dx_Pass(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_Pass_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_Pass_class->name = "Pass";
|
|
jsb_cocos2d_Pass_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Pass_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_Pass_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Pass_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_Pass_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_Pass_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_Pass_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_Pass_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("unbind", js_cocos2dx_Pass_unbind, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("bind", js_cocos2dx_Pass_bind, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("clone", js_cocos2dx_Pass_clone, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getGLProgramState", js_cocos2dx_Pass_getGLProgramState, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getVertexAttributeBinding", js_cocos2dx_Pass_getVertexAttributeBinding, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getHash", js_cocos2dx_Pass_getHash, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setVertexAttribBinding", js_cocos2dx_Pass_setVertexAttribBinding, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_Pass_create, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("createWithGLProgramState", js_cocos2dx_Pass_createWithGLProgramState, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_RenderState_prototype);
|
|
jsb_cocos2d_Pass_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_Pass_class,
|
|
dummy_constructor<cocos2d::Pass>, 0, // no constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_Pass_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "Pass"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::Pass>(cx, jsb_cocos2d_Pass_class, proto, parent_proto);
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_Technique_class;
|
|
JSObject *jsb_cocos2d_Technique_prototype;
|
|
|
|
bool js_cocos2dx_Technique_getPassCount(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Technique* cobj = (cocos2d::Technique *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Technique_getPassCount : Invalid Native Object");
|
|
if (argc == 0) {
|
|
ssize_t ret = cobj->getPassCount();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ssize_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Technique_getPassCount : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Technique_clone(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Technique* cobj = (cocos2d::Technique *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Technique_clone : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::Technique* ret = cobj->clone();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Technique>(cx, (cocos2d::Technique*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Technique_clone : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Technique_addPass(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Technique* cobj = (cocos2d::Technique *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Technique_addPass : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Pass* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Pass*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Technique_addPass : Error processing arguments");
|
|
cobj->addPass(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Technique_addPass : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Technique_getPasses(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Technique* cobj = (cocos2d::Technique *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Technique_getPasses : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const cocos2d::Vector<cocos2d::Pass *>& ret = cobj->getPasses();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ccvector_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Technique_getPasses : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Technique_getName(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Technique* cobj = (cocos2d::Technique *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Technique_getName : Invalid Native Object");
|
|
if (argc == 0) {
|
|
std::string ret = cobj->getName();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = std_string_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Technique_getName : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Technique_getPassByIndex(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Technique* cobj = (cocos2d::Technique *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Technique_getPassByIndex : Invalid Native Object");
|
|
if (argc == 1) {
|
|
ssize_t arg0 = 0;
|
|
ok &= jsval_to_ssize(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Technique_getPassByIndex : Error processing arguments");
|
|
cocos2d::Pass* ret = cobj->getPassByIndex(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Pass>(cx, (cocos2d::Pass*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Technique_getPassByIndex : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Technique_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
cocos2d::Material* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Material*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Technique_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::Technique::create(arg0);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::Technique>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::Technique"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_Technique_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_Technique_createWithGLProgramState(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 2) {
|
|
cocos2d::Material* arg0 = nullptr;
|
|
cocos2d::GLProgramState* arg1 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Material*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::GLProgramState*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Technique_createWithGLProgramState : Error processing arguments");
|
|
|
|
auto ret = cocos2d::Technique::createWithGLProgramState(arg0, arg1);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::Technique>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::Technique"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_Technique_createWithGLProgramState : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_RenderState_prototype;
|
|
|
|
void js_register_cocos2dx_Technique(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_Technique_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_Technique_class->name = "Technique";
|
|
jsb_cocos2d_Technique_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Technique_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_Technique_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Technique_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_Technique_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_Technique_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_Technique_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_Technique_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("getPassCount", js_cocos2dx_Technique_getPassCount, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("clone", js_cocos2dx_Technique_clone, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("addPass", js_cocos2dx_Technique_addPass, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getPasses", js_cocos2dx_Technique_getPasses, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getName", js_cocos2dx_Technique_getName, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getPassByIndex", js_cocos2dx_Technique_getPassByIndex, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_Technique_create, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("createWithGLProgramState", js_cocos2dx_Technique_createWithGLProgramState, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_RenderState_prototype);
|
|
jsb_cocos2d_Technique_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_Technique_class,
|
|
dummy_constructor<cocos2d::Technique>, 0, // no constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_Technique_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "Technique"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::Technique>(cx, jsb_cocos2d_Technique_class, proto, parent_proto);
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_Material_class;
|
|
JSObject *jsb_cocos2d_Material_prototype;
|
|
|
|
bool js_cocos2dx_Material_clone(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Material* cobj = (cocos2d::Material *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Material_clone : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::Material* ret = cobj->clone();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Material>(cx, (cocos2d::Material*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Material_clone : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Material_getTechniqueCount(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Material* cobj = (cocos2d::Material *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Material_getTechniqueCount : Invalid Native Object");
|
|
if (argc == 0) {
|
|
ssize_t ret = cobj->getTechniqueCount();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ssize_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Material_getTechniqueCount : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Material_setName(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Material* cobj = (cocos2d::Material *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Material_setName : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Material_setName : Error processing arguments");
|
|
cobj->setName(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Material_setName : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Material_getTechniqueByIndex(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Material* cobj = (cocos2d::Material *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Material_getTechniqueByIndex : Invalid Native Object");
|
|
if (argc == 1) {
|
|
ssize_t arg0 = 0;
|
|
ok &= jsval_to_ssize(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Material_getTechniqueByIndex : Error processing arguments");
|
|
cocos2d::Technique* ret = cobj->getTechniqueByIndex(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Technique>(cx, (cocos2d::Technique*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Material_getTechniqueByIndex : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Material_getName(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Material* cobj = (cocos2d::Material *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Material_getName : Invalid Native Object");
|
|
if (argc == 0) {
|
|
std::string ret = cobj->getName();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = std_string_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Material_getName : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Material_getTechniques(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Material* cobj = (cocos2d::Material *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Material_getTechniques : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const cocos2d::Vector<cocos2d::Technique *>& ret = cobj->getTechniques();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ccvector_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Material_getTechniques : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Material_setTechnique(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Material* cobj = (cocos2d::Material *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Material_setTechnique : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Material_setTechnique : Error processing arguments");
|
|
cobj->setTechnique(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Material_setTechnique : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Material_getTechniqueByName(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Material* cobj = (cocos2d::Material *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Material_getTechniqueByName : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Material_getTechniqueByName : Error processing arguments");
|
|
cocos2d::Technique* ret = cobj->getTechniqueByName(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Technique>(cx, (cocos2d::Technique*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Material_getTechniqueByName : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Material_addTechnique(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Material* cobj = (cocos2d::Material *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Material_addTechnique : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Technique* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Technique*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Material_addTechnique : Error processing arguments");
|
|
cobj->addTechnique(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Material_addTechnique : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Material_getTechnique(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Material* cobj = (cocos2d::Material *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Material_getTechnique : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::Technique* ret = cobj->getTechnique();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Technique>(cx, (cocos2d::Technique*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Material_getTechnique : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Material_createWithFilename(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Material_createWithFilename : Error processing arguments");
|
|
|
|
auto ret = cocos2d::Material::createWithFilename(arg0);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::Material>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::Material"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_Material_createWithFilename : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_Material_createWithGLStateProgram(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
cocos2d::GLProgramState* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::GLProgramState*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Material_createWithGLStateProgram : Error processing arguments");
|
|
|
|
auto ret = cocos2d::Material::createWithGLStateProgram(arg0);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::Material>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::Material"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_Material_createWithGLStateProgram : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_Material_createWithProperties(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
cocos2d::Properties* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Properties*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Material_createWithProperties : Error processing arguments");
|
|
|
|
auto ret = cocos2d::Material::createWithProperties(arg0);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::Material>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::Material"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_Material_createWithProperties : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_RenderState_prototype;
|
|
|
|
void js_register_cocos2dx_Material(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_Material_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_Material_class->name = "Material";
|
|
jsb_cocos2d_Material_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Material_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_Material_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Material_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_Material_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_Material_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_Material_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_Material_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("clone", js_cocos2dx_Material_clone, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getTechniqueCount", js_cocos2dx_Material_getTechniqueCount, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setName", js_cocos2dx_Material_setName, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getTechniqueByIndex", js_cocos2dx_Material_getTechniqueByIndex, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getName", js_cocos2dx_Material_getName, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getTechniques", js_cocos2dx_Material_getTechniques, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setTechnique", js_cocos2dx_Material_setTechnique, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getTechniqueByName", js_cocos2dx_Material_getTechniqueByName, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("addTechnique", js_cocos2dx_Material_addTechnique, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getTechnique", js_cocos2dx_Material_getTechnique, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("createWithFilename", js_cocos2dx_Material_createWithFilename, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("createWithGLStateProgram", js_cocos2dx_Material_createWithGLStateProgram, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("createWithProperties", js_cocos2dx_Material_createWithProperties, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_RenderState_prototype);
|
|
jsb_cocos2d_Material_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_Material_class,
|
|
dummy_constructor<cocos2d::Material>, 0, // no constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_Material_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "Material"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::Material>(cx, jsb_cocos2d_Material_class, proto, parent_proto);
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_TextureCache_class;
|
|
JSObject *jsb_cocos2d_TextureCache_prototype;
|
|
|
|
bool js_cocos2dx_TextureCache_reloadTexture(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TextureCache* cobj = (cocos2d::TextureCache *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TextureCache_reloadTexture : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TextureCache_reloadTexture : Error processing arguments");
|
|
bool ret = cobj->reloadTexture(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TextureCache_reloadTexture : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TextureCache_unbindAllImageAsync(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TextureCache* cobj = (cocos2d::TextureCache *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TextureCache_unbindAllImageAsync : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->unbindAllImageAsync();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TextureCache_unbindAllImageAsync : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TextureCache_removeTextureForKey(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TextureCache* cobj = (cocos2d::TextureCache *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TextureCache_removeTextureForKey : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TextureCache_removeTextureForKey : Error processing arguments");
|
|
cobj->removeTextureForKey(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TextureCache_removeTextureForKey : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TextureCache_removeAllTextures(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TextureCache* cobj = (cocos2d::TextureCache *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TextureCache_removeAllTextures : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->removeAllTextures();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TextureCache_removeAllTextures : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TextureCache_addImageAsync(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TextureCache* cobj = (cocos2d::TextureCache *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TextureCache_addImageAsync : Invalid Native Object");
|
|
if (argc == 2) {
|
|
std::string arg0;
|
|
std::function<void (cocos2d::Texture2D *)> arg1;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
do {
|
|
if(JS_TypeOfValue(cx, args.get(1)) == JSTYPE_FUNCTION)
|
|
{
|
|
JS::RootedObject jstarget(cx, args.thisv().toObjectOrNull());
|
|
std::shared_ptr<JSFunctionWrapper> func(new JSFunctionWrapper(cx, jstarget, args.get(1), args.thisv()));
|
|
auto lambda = [=](cocos2d::Texture2D* larg0) -> void {
|
|
JSB_AUTOCOMPARTMENT_WITH_GLOBAL_OBJCET
|
|
jsval largv[1];
|
|
if (larg0) {
|
|
largv[0] = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Texture2D>(cx, (cocos2d::Texture2D*)larg0));
|
|
} else {
|
|
largv[0] = JSVAL_NULL;
|
|
};
|
|
JS::RootedValue rval(cx);
|
|
bool succeed = func->invoke(1, &largv[0], &rval);
|
|
if (!succeed && JS_IsExceptionPending(cx)) {
|
|
JS_ReportPendingException(cx);
|
|
}
|
|
};
|
|
arg1 = lambda;
|
|
}
|
|
else
|
|
{
|
|
arg1 = nullptr;
|
|
}
|
|
} while(0)
|
|
;
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TextureCache_addImageAsync : Error processing arguments");
|
|
cobj->addImageAsync(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TextureCache_addImageAsync : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TextureCache_getDescription(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TextureCache* cobj = (cocos2d::TextureCache *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TextureCache_getDescription : Invalid Native Object");
|
|
if (argc == 0) {
|
|
std::string ret = cobj->getDescription();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = std_string_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TextureCache_getDescription : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TextureCache_getCachedTextureInfo(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TextureCache* cobj = (cocos2d::TextureCache *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TextureCache_getCachedTextureInfo : Invalid Native Object");
|
|
if (argc == 0) {
|
|
std::string ret = cobj->getCachedTextureInfo();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = std_string_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TextureCache_getCachedTextureInfo : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TextureCache_addImage(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::TextureCache* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::TextureCache *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TextureCache_addImage : Invalid Native Object");
|
|
do {
|
|
if (argc == 2) {
|
|
cocos2d::Image* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Image*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
if (!ok) { ok = true; break; }
|
|
std::string arg1;
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Texture2D* ret = cobj->addImage(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Texture2D>(cx, (cocos2d::Texture2D*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Texture2D* ret = cobj->addImage(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Texture2D>(cx, (cocos2d::Texture2D*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TextureCache_addImage : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TextureCache_unbindImageAsync(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TextureCache* cobj = (cocos2d::TextureCache *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TextureCache_unbindImageAsync : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TextureCache_unbindImageAsync : Error processing arguments");
|
|
cobj->unbindImageAsync(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TextureCache_unbindImageAsync : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TextureCache_getTextureForKey(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TextureCache* cobj = (cocos2d::TextureCache *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TextureCache_getTextureForKey : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TextureCache_getTextureForKey : Error processing arguments");
|
|
cocos2d::Texture2D* ret = cobj->getTextureForKey(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Texture2D>(cx, (cocos2d::Texture2D*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TextureCache_getTextureForKey : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TextureCache_getTextureFilePath(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TextureCache* cobj = (cocos2d::TextureCache *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TextureCache_getTextureFilePath : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Texture2D* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Texture2D*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TextureCache_getTextureFilePath : Error processing arguments");
|
|
std::string ret = cobj->getTextureFilePath(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = std_string_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TextureCache_getTextureFilePath : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TextureCache_renameTextureWithKey(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TextureCache* cobj = (cocos2d::TextureCache *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TextureCache_renameTextureWithKey : Invalid Native Object");
|
|
if (argc == 2) {
|
|
std::string arg0;
|
|
std::string arg1;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TextureCache_renameTextureWithKey : Error processing arguments");
|
|
cobj->renameTextureWithKey(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TextureCache_renameTextureWithKey : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TextureCache_removeUnusedTextures(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TextureCache* cobj = (cocos2d::TextureCache *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TextureCache_removeUnusedTextures : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->removeUnusedTextures();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TextureCache_removeUnusedTextures : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TextureCache_removeTexture(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TextureCache* cobj = (cocos2d::TextureCache *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TextureCache_removeTexture : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Texture2D* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Texture2D*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TextureCache_removeTexture : Error processing arguments");
|
|
cobj->removeTexture(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TextureCache_removeTexture : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TextureCache_waitForQuit(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TextureCache* cobj = (cocos2d::TextureCache *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TextureCache_waitForQuit : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->waitForQuit();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TextureCache_waitForQuit : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TextureCache_setETC1AlphaFileSuffix(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TextureCache_setETC1AlphaFileSuffix : Error processing arguments");
|
|
cocos2d::TextureCache::setETC1AlphaFileSuffix(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_TextureCache_setETC1AlphaFileSuffix : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_TextureCache_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::TextureCache* cobj = new (std::nothrow) cocos2d::TextureCache();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TextureCache>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::TextureCache"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
|
|
|
|
void js_register_cocos2dx_TextureCache(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_TextureCache_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_TextureCache_class->name = "TextureCache";
|
|
jsb_cocos2d_TextureCache_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TextureCache_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_TextureCache_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TextureCache_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_TextureCache_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_TextureCache_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_TextureCache_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_TextureCache_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("reloadTexture", js_cocos2dx_TextureCache_reloadTexture, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("unbindAllImageAsync", js_cocos2dx_TextureCache_unbindAllImageAsync, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("removeTextureForKey", js_cocos2dx_TextureCache_removeTextureForKey, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("removeAllTextures", js_cocos2dx_TextureCache_removeAllTextures, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("addImageAsync", js_cocos2dx_TextureCache_addImageAsync, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getDescription", js_cocos2dx_TextureCache_getDescription, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getCachedTextureInfo", js_cocos2dx_TextureCache_getCachedTextureInfo, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("addImage", js_cocos2dx_TextureCache_addImage, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("unbindImageAsync", js_cocos2dx_TextureCache_unbindImageAsync, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getTextureForKey", js_cocos2dx_TextureCache_getTextureForKey, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getTextureFilePath", js_cocos2dx_TextureCache_getTextureFilePath, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("renameTextureWithKey", js_cocos2dx_TextureCache_renameTextureWithKey, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("removeUnusedTextures", js_cocos2dx_TextureCache_removeUnusedTextures, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("removeTexture", js_cocos2dx_TextureCache_removeTexture, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("waitForQuit", js_cocos2dx_TextureCache_waitForQuit, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("setETC1AlphaFileSuffix", js_cocos2dx_TextureCache_setETC1AlphaFileSuffix, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
jsb_cocos2d_TextureCache_prototype = JS_InitClass(
|
|
cx, global,
|
|
JS::NullPtr(),
|
|
jsb_cocos2d_TextureCache_class,
|
|
js_cocos2dx_TextureCache_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_TextureCache_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "TextureCache"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::TextureCache>(cx, jsb_cocos2d_TextureCache_class, proto, JS::NullPtr());
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_Device_class;
|
|
JSObject *jsb_cocos2d_Device_prototype;
|
|
|
|
bool js_cocos2dx_Device_setAccelerometerEnabled(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
bool arg0;
|
|
arg0 = JS::ToBoolean(args.get(0));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Device_setAccelerometerEnabled : Error processing arguments");
|
|
cocos2d::Device::setAccelerometerEnabled(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_Device_setAccelerometerEnabled : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_Device_setAccelerometerInterval(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Device_setAccelerometerInterval : Error processing arguments");
|
|
cocos2d::Device::setAccelerometerInterval(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_Device_setAccelerometerInterval : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_Device_setKeepScreenOn(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
bool arg0;
|
|
arg0 = JS::ToBoolean(args.get(0));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Device_setKeepScreenOn : Error processing arguments");
|
|
cocos2d::Device::setKeepScreenOn(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_Device_setKeepScreenOn : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_Device_vibrate(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Device_vibrate : Error processing arguments");
|
|
cocos2d::Device::vibrate(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_Device_vibrate : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_Device_getDPI(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
if (argc == 0) {
|
|
|
|
int ret = cocos2d::Device::getDPI();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = int32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_Device_getDPI : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
|
|
void js_register_cocos2dx_Device(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_Device_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_Device_class->name = "Device";
|
|
jsb_cocos2d_Device_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Device_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_Device_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Device_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_Device_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_Device_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_Device_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_Device_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("setAccelerometerEnabled", js_cocos2dx_Device_setAccelerometerEnabled, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setAccelerometerInterval", js_cocos2dx_Device_setAccelerometerInterval, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setKeepScreenOn", js_cocos2dx_Device_setKeepScreenOn, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("vibrate", js_cocos2dx_Device_vibrate, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getDPI", js_cocos2dx_Device_getDPI, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
jsb_cocos2d_Device_prototype = JS_InitClass(
|
|
cx, global,
|
|
JS::NullPtr(),
|
|
jsb_cocos2d_Device_class,
|
|
dummy_constructor<cocos2d::Device>, 0, // no constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_Device_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "Device"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::FalseHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::Device>(cx, jsb_cocos2d_Device_class, proto, JS::NullPtr());
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_SAXParser_class;
|
|
JSObject *jsb_cocos2d_SAXParser_prototype;
|
|
|
|
bool js_cocos2dx_SAXParser_init(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::SAXParser* cobj = (cocos2d::SAXParser *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SAXParser_init : Invalid Native Object");
|
|
if (argc == 1) {
|
|
const char* arg0 = nullptr;
|
|
std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str();
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SAXParser_init : Error processing arguments");
|
|
bool ret = cobj->init(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SAXParser_init : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
|
|
void js_register_cocos2dx_SAXParser(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_SAXParser_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_SAXParser_class->name = "PlistParser";
|
|
jsb_cocos2d_SAXParser_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_SAXParser_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_SAXParser_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_SAXParser_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_SAXParser_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_SAXParser_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_SAXParser_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_SAXParser_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("init", js_cocos2dx_SAXParser_init, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JSFunctionSpec *st_funcs = NULL;
|
|
|
|
jsb_cocos2d_SAXParser_prototype = JS_InitClass(
|
|
cx, global,
|
|
JS::NullPtr(),
|
|
jsb_cocos2d_SAXParser_class,
|
|
empty_constructor, 0,
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_SAXParser_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "SAXParser"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::FalseHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::SAXParser>(cx, jsb_cocos2d_SAXParser_class, proto, JS::NullPtr());
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_Application_class;
|
|
JSObject *jsb_cocos2d_Application_prototype;
|
|
|
|
bool js_cocos2dx_Application_getTargetPlatform(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Application* cobj = (cocos2d::Application *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Application_getTargetPlatform : Invalid Native Object");
|
|
if (argc == 0) {
|
|
int ret = (int)cobj->getTargetPlatform();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = int32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Application_getTargetPlatform : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Application_getCurrentLanguage(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Application* cobj = (cocos2d::Application *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Application_getCurrentLanguage : Invalid Native Object");
|
|
if (argc == 0) {
|
|
int ret = (int)cobj->getCurrentLanguage();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = int32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Application_getCurrentLanguage : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Application_openURL(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Application* cobj = (cocos2d::Application *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Application_openURL : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Application_openURL : Error processing arguments");
|
|
bool ret = cobj->openURL(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Application_openURL : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Application_getVersion(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::Application* cobj = (cocos2d::Application *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Application_getVersion : Invalid Native Object");
|
|
if (argc == 0) {
|
|
std::string ret = cobj->getVersion();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = std_string_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_Application_getVersion : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_Application_getInstance(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
if (argc == 0) {
|
|
|
|
cocos2d::Application* ret = cocos2d::Application::getInstance();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Application>(cx, (cocos2d::Application*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_Application_getInstance : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
|
|
void js_register_cocos2dx_Application(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_Application_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_Application_class->name = "Application";
|
|
jsb_cocos2d_Application_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Application_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_Application_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_Application_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_Application_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_Application_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_Application_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_Application_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("getTargetPlatform", js_cocos2dx_Application_getTargetPlatform, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getCurrentLanguage", js_cocos2dx_Application_getCurrentLanguage, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("openURL", js_cocos2dx_Application_openURL, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getVersion", js_cocos2dx_Application_getVersion, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("getInstance", js_cocos2dx_Application_getInstance, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
jsb_cocos2d_Application_prototype = JS_InitClass(
|
|
cx, global,
|
|
JS::NullPtr(),
|
|
jsb_cocos2d_Application_class,
|
|
empty_constructor, 0,
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_Application_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "Application"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::FalseHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::Application>(cx, jsb_cocos2d_Application_class, proto, JS::NullPtr());
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_AnimationCache_class;
|
|
JSObject *jsb_cocos2d_AnimationCache_prototype;
|
|
|
|
bool js_cocos2dx_AnimationCache_getAnimation(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::AnimationCache* cobj = (cocos2d::AnimationCache *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_AnimationCache_getAnimation : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_AnimationCache_getAnimation : Error processing arguments");
|
|
cocos2d::Animation* ret = cobj->getAnimation(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Animation>(cx, (cocos2d::Animation*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_AnimationCache_getAnimation : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_AnimationCache_addAnimation(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::AnimationCache* cobj = (cocos2d::AnimationCache *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_AnimationCache_addAnimation : Invalid Native Object");
|
|
if (argc == 2) {
|
|
cocos2d::Animation* arg0 = nullptr;
|
|
std::string arg1;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Animation*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_AnimationCache_addAnimation : Error processing arguments");
|
|
cobj->addAnimation(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_AnimationCache_addAnimation : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_AnimationCache_init(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::AnimationCache* cobj = (cocos2d::AnimationCache *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_AnimationCache_init : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->init();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_AnimationCache_init : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_AnimationCache_addAnimationsWithDictionary(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::AnimationCache* cobj = (cocos2d::AnimationCache *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_AnimationCache_addAnimationsWithDictionary : Invalid Native Object");
|
|
if (argc == 2) {
|
|
cocos2d::ValueMap arg0;
|
|
std::string arg1;
|
|
ok &= jsval_to_ccvaluemap(cx, args.get(0), &arg0);
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_AnimationCache_addAnimationsWithDictionary : Error processing arguments");
|
|
cobj->addAnimationsWithDictionary(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_AnimationCache_addAnimationsWithDictionary : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_AnimationCache_removeAnimation(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::AnimationCache* cobj = (cocos2d::AnimationCache *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_AnimationCache_removeAnimation : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_AnimationCache_removeAnimation : Error processing arguments");
|
|
cobj->removeAnimation(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_AnimationCache_removeAnimation : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_AnimationCache_addAnimationsWithFile(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::AnimationCache* cobj = (cocos2d::AnimationCache *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_AnimationCache_addAnimationsWithFile : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_AnimationCache_addAnimationsWithFile : Error processing arguments");
|
|
cobj->addAnimationsWithFile(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_AnimationCache_addAnimationsWithFile : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_AnimationCache_destroyInstance(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
if (argc == 0) {
|
|
cocos2d::AnimationCache::destroyInstance();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_AnimationCache_destroyInstance : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_AnimationCache_getInstance(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
if (argc == 0) {
|
|
|
|
auto ret = cocos2d::AnimationCache::getInstance();
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::AnimationCache>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_get_or_create_jsobject(cx, ret, typeClass, "cocos2d::AnimationCache"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_AnimationCache_getInstance : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_AnimationCache_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::AnimationCache* cobj = new (std::nothrow) cocos2d::AnimationCache();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::AnimationCache>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::AnimationCache"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_AnimationCache_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::AnimationCache *nobj = new (std::nothrow) cocos2d::AnimationCache();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::AnimationCache");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
|
|
void js_register_cocos2dx_AnimationCache(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_AnimationCache_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_AnimationCache_class->name = "AnimationCache";
|
|
jsb_cocos2d_AnimationCache_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_AnimationCache_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_AnimationCache_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_AnimationCache_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_AnimationCache_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_AnimationCache_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_AnimationCache_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_AnimationCache_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("getAnimation", js_cocos2dx_AnimationCache_getAnimation, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("addAnimation", js_cocos2dx_AnimationCache_addAnimation, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("init", js_cocos2dx_AnimationCache_init, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("addAnimationsWithDictionary", js_cocos2dx_AnimationCache_addAnimationsWithDictionary, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("removeAnimation", js_cocos2dx_AnimationCache_removeAnimation, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("addAnimations", js_cocos2dx_AnimationCache_addAnimationsWithFile, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_AnimationCache_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("destroyInstance", js_cocos2dx_AnimationCache_destroyInstance, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getInstance", js_cocos2dx_AnimationCache_getInstance, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
jsb_cocos2d_AnimationCache_prototype = JS_InitClass(
|
|
cx, global,
|
|
JS::NullPtr(),
|
|
jsb_cocos2d_AnimationCache_class,
|
|
js_cocos2dx_AnimationCache_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_AnimationCache_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "AnimationCache"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::AnimationCache>(cx, jsb_cocos2d_AnimationCache_class, proto, JS::NullPtr());
|
|
anonEvaluate(cx, global, "(function () { cc.AnimationCache.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_SpriteBatchNode_class;
|
|
JSObject *jsb_cocos2d_SpriteBatchNode_prototype;
|
|
|
|
bool js_cocos2dx_SpriteBatchNode_appendChild(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::SpriteBatchNode* cobj = (cocos2d::SpriteBatchNode *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteBatchNode_appendChild : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Sprite* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Sprite*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SpriteBatchNode_appendChild : Error processing arguments");
|
|
cobj->appendChild(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SpriteBatchNode_appendChild : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SpriteBatchNode_reorderBatch(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::SpriteBatchNode* cobj = (cocos2d::SpriteBatchNode *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteBatchNode_reorderBatch : Invalid Native Object");
|
|
if (argc == 1) {
|
|
bool arg0;
|
|
arg0 = JS::ToBoolean(args.get(0));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SpriteBatchNode_reorderBatch : Error processing arguments");
|
|
cobj->reorderBatch(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SpriteBatchNode_reorderBatch : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SpriteBatchNode_getTexture(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::SpriteBatchNode* cobj = (cocos2d::SpriteBatchNode *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteBatchNode_getTexture : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::Texture2D* ret = cobj->getTexture();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Texture2D>(cx, (cocos2d::Texture2D*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SpriteBatchNode_getTexture : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SpriteBatchNode_setTexture(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::SpriteBatchNode* cobj = (cocos2d::SpriteBatchNode *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteBatchNode_setTexture : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Texture2D* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Texture2D*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SpriteBatchNode_setTexture : Error processing arguments");
|
|
cobj->setTexture(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SpriteBatchNode_setTexture : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SpriteBatchNode_removeChildAtIndex(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::SpriteBatchNode* cobj = (cocos2d::SpriteBatchNode *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteBatchNode_removeChildAtIndex : Invalid Native Object");
|
|
if (argc == 2) {
|
|
ssize_t arg0 = 0;
|
|
bool arg1;
|
|
ok &= jsval_to_ssize(cx, args.get(0), &arg0);
|
|
arg1 = JS::ToBoolean(args.get(1));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SpriteBatchNode_removeChildAtIndex : Error processing arguments");
|
|
cobj->removeChildAtIndex(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SpriteBatchNode_removeChildAtIndex : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SpriteBatchNode_removeSpriteFromAtlas(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::SpriteBatchNode* cobj = (cocos2d::SpriteBatchNode *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteBatchNode_removeSpriteFromAtlas : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Sprite* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Sprite*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SpriteBatchNode_removeSpriteFromAtlas : Error processing arguments");
|
|
cobj->removeSpriteFromAtlas(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SpriteBatchNode_removeSpriteFromAtlas : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SpriteBatchNode_addSpriteWithoutQuad(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::SpriteBatchNode* cobj = (cocos2d::SpriteBatchNode *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteBatchNode_addSpriteWithoutQuad : Invalid Native Object");
|
|
if (argc == 3) {
|
|
cocos2d::Sprite* arg0 = nullptr;
|
|
int arg1 = 0;
|
|
int arg2 = 0;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Sprite*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1);
|
|
ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SpriteBatchNode_addSpriteWithoutQuad : Error processing arguments");
|
|
cocos2d::SpriteBatchNode* ret = cobj->addSpriteWithoutQuad(arg0, arg1, arg2);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::SpriteBatchNode>(cx, (cocos2d::SpriteBatchNode*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SpriteBatchNode_addSpriteWithoutQuad : wrong number of arguments: %d, was expecting %d", argc, 3);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SpriteBatchNode_atlasIndexForChild(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::SpriteBatchNode* cobj = (cocos2d::SpriteBatchNode *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteBatchNode_atlasIndexForChild : Invalid Native Object");
|
|
if (argc == 2) {
|
|
cocos2d::Sprite* arg0 = nullptr;
|
|
int arg1 = 0;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Sprite*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SpriteBatchNode_atlasIndexForChild : Error processing arguments");
|
|
ssize_t ret = cobj->atlasIndexForChild(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ssize_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SpriteBatchNode_atlasIndexForChild : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SpriteBatchNode_increaseAtlasCapacity(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::SpriteBatchNode* cobj = (cocos2d::SpriteBatchNode *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteBatchNode_increaseAtlasCapacity : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->increaseAtlasCapacity();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SpriteBatchNode_increaseAtlasCapacity : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SpriteBatchNode_lowestAtlasIndexInChild(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::SpriteBatchNode* cobj = (cocos2d::SpriteBatchNode *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteBatchNode_lowestAtlasIndexInChild : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Sprite* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Sprite*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SpriteBatchNode_lowestAtlasIndexInChild : Error processing arguments");
|
|
ssize_t ret = cobj->lowestAtlasIndexInChild(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ssize_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SpriteBatchNode_lowestAtlasIndexInChild : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SpriteBatchNode_getBlendFunc(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::SpriteBatchNode* cobj = (cocos2d::SpriteBatchNode *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteBatchNode_getBlendFunc : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const cocos2d::BlendFunc& ret = cobj->getBlendFunc();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = blendfunc_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SpriteBatchNode_getBlendFunc : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SpriteBatchNode_initWithTexture(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::SpriteBatchNode* cobj = (cocos2d::SpriteBatchNode *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteBatchNode_initWithTexture : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Texture2D* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Texture2D*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SpriteBatchNode_initWithTexture : Error processing arguments");
|
|
bool ret = cobj->initWithTexture(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
if (argc == 2) {
|
|
cocos2d::Texture2D* arg0 = nullptr;
|
|
ssize_t arg1 = 0;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Texture2D*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
ok &= jsval_to_ssize(cx, args.get(1), &arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SpriteBatchNode_initWithTexture : Error processing arguments");
|
|
bool ret = cobj->initWithTexture(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SpriteBatchNode_initWithTexture : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SpriteBatchNode_setTextureAtlas(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::SpriteBatchNode* cobj = (cocos2d::SpriteBatchNode *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteBatchNode_setTextureAtlas : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::TextureAtlas* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::TextureAtlas*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SpriteBatchNode_setTextureAtlas : Error processing arguments");
|
|
cobj->setTextureAtlas(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SpriteBatchNode_setTextureAtlas : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SpriteBatchNode_reserveCapacity(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::SpriteBatchNode* cobj = (cocos2d::SpriteBatchNode *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteBatchNode_reserveCapacity : Invalid Native Object");
|
|
if (argc == 1) {
|
|
ssize_t arg0 = 0;
|
|
ok &= jsval_to_ssize(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SpriteBatchNode_reserveCapacity : Error processing arguments");
|
|
cobj->reserveCapacity(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SpriteBatchNode_reserveCapacity : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SpriteBatchNode_insertQuadFromSprite(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::SpriteBatchNode* cobj = (cocos2d::SpriteBatchNode *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteBatchNode_insertQuadFromSprite : Invalid Native Object");
|
|
if (argc == 2) {
|
|
cocos2d::Sprite* arg0 = nullptr;
|
|
ssize_t arg1 = 0;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Sprite*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
ok &= jsval_to_ssize(cx, args.get(1), &arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SpriteBatchNode_insertQuadFromSprite : Error processing arguments");
|
|
cobj->insertQuadFromSprite(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SpriteBatchNode_insertQuadFromSprite : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SpriteBatchNode_initWithFile(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::SpriteBatchNode* cobj = (cocos2d::SpriteBatchNode *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteBatchNode_initWithFile : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SpriteBatchNode_initWithFile : Error processing arguments");
|
|
bool ret = cobj->initWithFile(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
if (argc == 2) {
|
|
std::string arg0;
|
|
ssize_t arg1 = 0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
ok &= jsval_to_ssize(cx, args.get(1), &arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SpriteBatchNode_initWithFile : Error processing arguments");
|
|
bool ret = cobj->initWithFile(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SpriteBatchNode_initWithFile : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SpriteBatchNode_setBlendFunc(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::SpriteBatchNode* cobj = (cocos2d::SpriteBatchNode *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteBatchNode_setBlendFunc : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::BlendFunc arg0;
|
|
ok &= jsval_to_blendfunc(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SpriteBatchNode_setBlendFunc : Error processing arguments");
|
|
cobj->setBlendFunc(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SpriteBatchNode_setBlendFunc : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SpriteBatchNode_rebuildIndexInOrder(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::SpriteBatchNode* cobj = (cocos2d::SpriteBatchNode *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteBatchNode_rebuildIndexInOrder : Invalid Native Object");
|
|
if (argc == 2) {
|
|
cocos2d::Sprite* arg0 = nullptr;
|
|
ssize_t arg1 = 0;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Sprite*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
ok &= jsval_to_ssize(cx, args.get(1), &arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SpriteBatchNode_rebuildIndexInOrder : Error processing arguments");
|
|
ssize_t ret = cobj->rebuildIndexInOrder(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ssize_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SpriteBatchNode_rebuildIndexInOrder : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SpriteBatchNode_getTextureAtlas(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::SpriteBatchNode* cobj = (cocos2d::SpriteBatchNode *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteBatchNode_getTextureAtlas : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::TextureAtlas* ret = cobj->getTextureAtlas();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::TextureAtlas>(cx, (cocos2d::TextureAtlas*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SpriteBatchNode_getTextureAtlas : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SpriteBatchNode_highestAtlasIndexInChild(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::SpriteBatchNode* cobj = (cocos2d::SpriteBatchNode *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteBatchNode_highestAtlasIndexInChild : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Sprite* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Sprite*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SpriteBatchNode_highestAtlasIndexInChild : Error processing arguments");
|
|
ssize_t ret = cobj->highestAtlasIndexInChild(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ssize_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SpriteBatchNode_highestAtlasIndexInChild : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SpriteBatchNode_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SpriteBatchNode_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::SpriteBatchNode::create(arg0);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::SpriteBatchNode>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::SpriteBatchNode"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
if (argc == 2) {
|
|
std::string arg0;
|
|
ssize_t arg1 = 0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
ok &= jsval_to_ssize(cx, args.get(1), &arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SpriteBatchNode_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::SpriteBatchNode::create(arg0, arg1);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::SpriteBatchNode>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::SpriteBatchNode"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_SpriteBatchNode_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_SpriteBatchNode_createWithTexture(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
cocos2d::Texture2D* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Texture2D*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SpriteBatchNode_createWithTexture : Error processing arguments");
|
|
|
|
auto ret = cocos2d::SpriteBatchNode::createWithTexture(arg0);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::SpriteBatchNode>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::SpriteBatchNode"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
if (argc == 2) {
|
|
cocos2d::Texture2D* arg0 = nullptr;
|
|
ssize_t arg1 = 0;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Texture2D*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
ok &= jsval_to_ssize(cx, args.get(1), &arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SpriteBatchNode_createWithTexture : Error processing arguments");
|
|
|
|
auto ret = cocos2d::SpriteBatchNode::createWithTexture(arg0, arg1);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::SpriteBatchNode>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::SpriteBatchNode"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_SpriteBatchNode_createWithTexture : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_SpriteBatchNode_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::SpriteBatchNode* cobj = new (std::nothrow) cocos2d::SpriteBatchNode();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::SpriteBatchNode>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::SpriteBatchNode"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_SpriteBatchNode_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::SpriteBatchNode *nobj = new (std::nothrow) cocos2d::SpriteBatchNode();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::SpriteBatchNode");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_Node_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_SpriteBatchNode(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_SpriteBatchNode_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_SpriteBatchNode_class->name = "SpriteBatchNode";
|
|
jsb_cocos2d_SpriteBatchNode_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_SpriteBatchNode_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_SpriteBatchNode_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_SpriteBatchNode_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_SpriteBatchNode_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_SpriteBatchNode_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_SpriteBatchNode_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_SpriteBatchNode_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("appendChild", js_cocos2dx_SpriteBatchNode_appendChild, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("reorderBatch", js_cocos2dx_SpriteBatchNode_reorderBatch, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getTexture", js_cocos2dx_SpriteBatchNode_getTexture, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setTexture", js_cocos2dx_SpriteBatchNode_setTexture, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("removeChildAtIndex", js_cocos2dx_SpriteBatchNode_removeChildAtIndex, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("removeSpriteFromAtlas", js_cocos2dx_SpriteBatchNode_removeSpriteFromAtlas, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("addSpriteWithoutQuad", js_cocos2dx_SpriteBatchNode_addSpriteWithoutQuad, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("atlasIndexForChild", js_cocos2dx_SpriteBatchNode_atlasIndexForChild, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("increaseAtlasCapacity", js_cocos2dx_SpriteBatchNode_increaseAtlasCapacity, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("lowestAtlasIndexInChild", js_cocos2dx_SpriteBatchNode_lowestAtlasIndexInChild, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getBlendFunc", js_cocos2dx_SpriteBatchNode_getBlendFunc, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initWithTexture", js_cocos2dx_SpriteBatchNode_initWithTexture, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setTextureAtlas", js_cocos2dx_SpriteBatchNode_setTextureAtlas, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("reserveCapacity", js_cocos2dx_SpriteBatchNode_reserveCapacity, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("insertQuadFromSprite", js_cocos2dx_SpriteBatchNode_insertQuadFromSprite, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initWithFile", js_cocos2dx_SpriteBatchNode_initWithFile, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setBlendFunc", js_cocos2dx_SpriteBatchNode_setBlendFunc, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("rebuildIndexInOrder", js_cocos2dx_SpriteBatchNode_rebuildIndexInOrder, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getTextureAtlas", js_cocos2dx_SpriteBatchNode_getTextureAtlas, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("highestAtlasIndexInChild", js_cocos2dx_SpriteBatchNode_highestAtlasIndexInChild, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_SpriteBatchNode_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_SpriteBatchNode_create, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("createWithTexture", js_cocos2dx_SpriteBatchNode_createWithTexture, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_Node_prototype);
|
|
jsb_cocos2d_SpriteBatchNode_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_SpriteBatchNode_class,
|
|
js_cocos2dx_SpriteBatchNode_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_SpriteBatchNode_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "SpriteBatchNode"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::SpriteBatchNode>(cx, jsb_cocos2d_SpriteBatchNode_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.SpriteBatchNode.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_SpriteFrameCache_class;
|
|
JSObject *jsb_cocos2d_SpriteFrameCache_prototype;
|
|
|
|
bool js_cocos2dx_SpriteFrameCache_reloadTexture(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::SpriteFrameCache* cobj = (cocos2d::SpriteFrameCache *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteFrameCache_reloadTexture : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SpriteFrameCache_reloadTexture : Error processing arguments");
|
|
bool ret = cobj->reloadTexture(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SpriteFrameCache_reloadTexture : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SpriteFrameCache_addSpriteFramesWithFileContent(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::SpriteFrameCache* cobj = (cocos2d::SpriteFrameCache *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteFrameCache_addSpriteFramesWithFileContent : Invalid Native Object");
|
|
if (argc == 2) {
|
|
std::string arg0;
|
|
cocos2d::Texture2D* arg1 = nullptr;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::Texture2D*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SpriteFrameCache_addSpriteFramesWithFileContent : Error processing arguments");
|
|
cobj->addSpriteFramesWithFileContent(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SpriteFrameCache_addSpriteFramesWithFileContent : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SpriteFrameCache_addSpriteFrame(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::SpriteFrameCache* cobj = (cocos2d::SpriteFrameCache *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteFrameCache_addSpriteFrame : Invalid Native Object");
|
|
if (argc == 2) {
|
|
cocos2d::SpriteFrame* arg0 = nullptr;
|
|
std::string arg1;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::SpriteFrame*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SpriteFrameCache_addSpriteFrame : Error processing arguments");
|
|
cobj->addSpriteFrame(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SpriteFrameCache_addSpriteFrame : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SpriteFrameCache_addSpriteFramesWithFile(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::SpriteFrameCache* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::SpriteFrameCache *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteFrameCache_addSpriteFramesWithFile : Invalid Native Object");
|
|
do {
|
|
if (argc == 2) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
std::string arg1;
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
cobj->addSpriteFramesWithFile(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cobj->addSpriteFramesWithFile(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 2) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Texture2D* arg1 = nullptr;
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::Texture2D*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
if (!ok) { ok = true; break; }
|
|
cobj->addSpriteFramesWithFile(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SpriteFrameCache_addSpriteFramesWithFile : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SpriteFrameCache_getSpriteFrameByName(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::SpriteFrameCache* cobj = (cocos2d::SpriteFrameCache *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteFrameCache_getSpriteFrameByName : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SpriteFrameCache_getSpriteFrameByName : Error processing arguments");
|
|
cocos2d::SpriteFrame* ret = cobj->getSpriteFrameByName(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::SpriteFrame>(cx, (cocos2d::SpriteFrame*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SpriteFrameCache_getSpriteFrameByName : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SpriteFrameCache_removeSpriteFramesFromFile(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::SpriteFrameCache* cobj = (cocos2d::SpriteFrameCache *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteFrameCache_removeSpriteFramesFromFile : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SpriteFrameCache_removeSpriteFramesFromFile : Error processing arguments");
|
|
cobj->removeSpriteFramesFromFile(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SpriteFrameCache_removeSpriteFramesFromFile : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SpriteFrameCache_init(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::SpriteFrameCache* cobj = (cocos2d::SpriteFrameCache *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteFrameCache_init : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->init();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SpriteFrameCache_init : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SpriteFrameCache_removeSpriteFrames(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::SpriteFrameCache* cobj = (cocos2d::SpriteFrameCache *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteFrameCache_removeSpriteFrames : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->removeSpriteFrames();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SpriteFrameCache_removeSpriteFrames : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SpriteFrameCache_removeUnusedSpriteFrames(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::SpriteFrameCache* cobj = (cocos2d::SpriteFrameCache *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteFrameCache_removeUnusedSpriteFrames : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->removeUnusedSpriteFrames();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SpriteFrameCache_removeUnusedSpriteFrames : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SpriteFrameCache_removeSpriteFramesFromFileContent(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::SpriteFrameCache* cobj = (cocos2d::SpriteFrameCache *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteFrameCache_removeSpriteFramesFromFileContent : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SpriteFrameCache_removeSpriteFramesFromFileContent : Error processing arguments");
|
|
cobj->removeSpriteFramesFromFileContent(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SpriteFrameCache_removeSpriteFramesFromFileContent : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SpriteFrameCache_removeSpriteFrameByName(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::SpriteFrameCache* cobj = (cocos2d::SpriteFrameCache *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteFrameCache_removeSpriteFrameByName : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SpriteFrameCache_removeSpriteFrameByName : Error processing arguments");
|
|
cobj->removeSpriteFrameByName(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SpriteFrameCache_removeSpriteFrameByName : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SpriteFrameCache_isSpriteFramesWithFileLoaded(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::SpriteFrameCache* cobj = (cocos2d::SpriteFrameCache *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteFrameCache_isSpriteFramesWithFileLoaded : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SpriteFrameCache_isSpriteFramesWithFileLoaded : Error processing arguments");
|
|
bool ret = cobj->isSpriteFramesWithFileLoaded(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SpriteFrameCache_isSpriteFramesWithFileLoaded : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SpriteFrameCache_removeSpriteFramesFromTexture(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::SpriteFrameCache* cobj = (cocos2d::SpriteFrameCache *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteFrameCache_removeSpriteFramesFromTexture : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Texture2D* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Texture2D*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SpriteFrameCache_removeSpriteFramesFromTexture : Error processing arguments");
|
|
cobj->removeSpriteFramesFromTexture(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SpriteFrameCache_removeSpriteFramesFromTexture : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SpriteFrameCache_destroyInstance(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
if (argc == 0) {
|
|
cocos2d::SpriteFrameCache::destroyInstance();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_SpriteFrameCache_destroyInstance : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_SpriteFrameCache_getInstance(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
if (argc == 0) {
|
|
|
|
auto ret = cocos2d::SpriteFrameCache::getInstance();
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::SpriteFrameCache>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_get_or_create_jsobject(cx, ret, typeClass, "cocos2d::SpriteFrameCache"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_SpriteFrameCache_getInstance : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
|
|
void js_register_cocos2dx_SpriteFrameCache(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_SpriteFrameCache_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_SpriteFrameCache_class->name = "SpriteFrameCache";
|
|
jsb_cocos2d_SpriteFrameCache_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_SpriteFrameCache_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_SpriteFrameCache_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_SpriteFrameCache_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_SpriteFrameCache_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_SpriteFrameCache_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_SpriteFrameCache_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_SpriteFrameCache_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("reloadTexture", js_cocos2dx_SpriteFrameCache_reloadTexture, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("addSpriteFramesWithFileContent", js_cocos2dx_SpriteFrameCache_addSpriteFramesWithFileContent, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("addSpriteFrame", js_cocos2dx_SpriteFrameCache_addSpriteFrame, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("addSpriteFrames", js_cocos2dx_SpriteFrameCache_addSpriteFramesWithFile, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getSpriteFrame", js_cocos2dx_SpriteFrameCache_getSpriteFrameByName, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("removeSpriteFramesFromFile", js_cocos2dx_SpriteFrameCache_removeSpriteFramesFromFile, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("init", js_cocos2dx_SpriteFrameCache_init, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("removeSpriteFrames", js_cocos2dx_SpriteFrameCache_removeSpriteFrames, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("removeUnusedSpriteFrames", js_cocos2dx_SpriteFrameCache_removeUnusedSpriteFrames, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("removeSpriteFramesFromFileContent", js_cocos2dx_SpriteFrameCache_removeSpriteFramesFromFileContent, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("removeSpriteFrameByName", js_cocos2dx_SpriteFrameCache_removeSpriteFrameByName, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("isSpriteFramesWithFileLoaded", js_cocos2dx_SpriteFrameCache_isSpriteFramesWithFileLoaded, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("removeSpriteFramesFromTexture", js_cocos2dx_SpriteFrameCache_removeSpriteFramesFromTexture, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("destroyInstance", js_cocos2dx_SpriteFrameCache_destroyInstance, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getInstance", js_cocos2dx_SpriteFrameCache_getInstance, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
jsb_cocos2d_SpriteFrameCache_prototype = JS_InitClass(
|
|
cx, global,
|
|
JS::NullPtr(),
|
|
jsb_cocos2d_SpriteFrameCache_class,
|
|
empty_constructor, 0,
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_SpriteFrameCache_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "SpriteFrameCache"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::SpriteFrameCache>(cx, jsb_cocos2d_SpriteFrameCache_class, proto, JS::NullPtr());
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_TextFieldTTF_class;
|
|
JSObject *jsb_cocos2d_TextFieldTTF_prototype;
|
|
|
|
bool js_cocos2dx_TextFieldTTF_getCharCount(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TextFieldTTF* cobj = (cocos2d::TextFieldTTF *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TextFieldTTF_getCharCount : Invalid Native Object");
|
|
if (argc == 0) {
|
|
unsigned long ret = cobj->getCharCount();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ulong_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TextFieldTTF_getCharCount : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TextFieldTTF_setCursorChar(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TextFieldTTF* cobj = (cocos2d::TextFieldTTF *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TextFieldTTF_setCursorChar : Invalid Native Object");
|
|
if (argc == 1) {
|
|
int32_t arg0;
|
|
ok &= jsval_to_int32(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TextFieldTTF_setCursorChar : Error processing arguments");
|
|
cobj->setCursorChar(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TextFieldTTF_setCursorChar : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TextFieldTTF_setSecureTextEntry(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TextFieldTTF* cobj = (cocos2d::TextFieldTTF *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TextFieldTTF_setSecureTextEntry : Invalid Native Object");
|
|
if (argc == 1) {
|
|
bool arg0;
|
|
arg0 = JS::ToBoolean(args.get(0));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TextFieldTTF_setSecureTextEntry : Error processing arguments");
|
|
cobj->setSecureTextEntry(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TextFieldTTF_setSecureTextEntry : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TextFieldTTF_setCursorEnabled(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TextFieldTTF* cobj = (cocos2d::TextFieldTTF *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TextFieldTTF_setCursorEnabled : Invalid Native Object");
|
|
if (argc == 1) {
|
|
bool arg0;
|
|
arg0 = JS::ToBoolean(args.get(0));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TextFieldTTF_setCursorEnabled : Error processing arguments");
|
|
cobj->setCursorEnabled(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TextFieldTTF_setCursorEnabled : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TextFieldTTF_getColorSpaceHolder(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TextFieldTTF* cobj = (cocos2d::TextFieldTTF *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TextFieldTTF_getColorSpaceHolder : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const cocos2d::Color4B& ret = cobj->getColorSpaceHolder();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = cccolor4b_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TextFieldTTF_getColorSpaceHolder : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TextFieldTTF_initWithPlaceHolder(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::TextFieldTTF* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::TextFieldTTF *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TextFieldTTF_initWithPlaceHolder : Invalid Native Object");
|
|
do {
|
|
if (argc == 3) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
std::string arg1;
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
double arg2 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
if (!ok) { ok = true; break; }
|
|
bool ret = cobj->initWithPlaceHolder(arg0, arg1, arg2);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 5) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Size arg1;
|
|
ok &= jsval_to_ccsize(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::TextHAlignment arg2;
|
|
ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2);
|
|
if (!ok) { ok = true; break; }
|
|
std::string arg3;
|
|
ok &= jsval_to_std_string(cx, args.get(3), &arg3);
|
|
if (!ok) { ok = true; break; }
|
|
double arg4 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(4), &arg4) && !std::isnan(arg4);
|
|
if (!ok) { ok = true; break; }
|
|
bool ret = cobj->initWithPlaceHolder(arg0, arg1, arg2, arg3, arg4);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TextFieldTTF_initWithPlaceHolder : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TextFieldTTF_appendString(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TextFieldTTF* cobj = (cocos2d::TextFieldTTF *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TextFieldTTF_appendString : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TextFieldTTF_appendString : Error processing arguments");
|
|
cobj->appendString(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TextFieldTTF_appendString : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TextFieldTTF_getPasswordTextStyle(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TextFieldTTF* cobj = (cocos2d::TextFieldTTF *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TextFieldTTF_getPasswordTextStyle : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const std::string& ret = cobj->getPasswordTextStyle();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = std_string_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TextFieldTTF_getPasswordTextStyle : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TextFieldTTF_setPasswordTextStyle(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TextFieldTTF* cobj = (cocos2d::TextFieldTTF *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TextFieldTTF_setPasswordTextStyle : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TextFieldTTF_setPasswordTextStyle : Error processing arguments");
|
|
cobj->setPasswordTextStyle(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TextFieldTTF_setPasswordTextStyle : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TextFieldTTF_setColorSpaceHolder(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::TextFieldTTF* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::TextFieldTTF *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TextFieldTTF_setColorSpaceHolder : Invalid Native Object");
|
|
do {
|
|
if (argc == 1) {
|
|
cocos2d::Color4B arg0;
|
|
ok &= jsval_to_cccolor4b(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cobj->setColorSpaceHolder(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 1) {
|
|
cocos2d::Color3B arg0;
|
|
ok &= jsval_to_cccolor3b(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cobj->setColorSpaceHolder(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TextFieldTTF_setColorSpaceHolder : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TextFieldTTF_detachWithIME(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TextFieldTTF* cobj = (cocos2d::TextFieldTTF *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TextFieldTTF_detachWithIME : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->detachWithIME();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TextFieldTTF_detachWithIME : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TextFieldTTF_setPlaceHolder(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TextFieldTTF* cobj = (cocos2d::TextFieldTTF *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TextFieldTTF_setPlaceHolder : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TextFieldTTF_setPlaceHolder : Error processing arguments");
|
|
cobj->setPlaceHolder(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TextFieldTTF_setPlaceHolder : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TextFieldTTF_setCursorFromPoint(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TextFieldTTF* cobj = (cocos2d::TextFieldTTF *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TextFieldTTF_setCursorFromPoint : Invalid Native Object");
|
|
if (argc == 2) {
|
|
cocos2d::Vec2 arg0;
|
|
const cocos2d::Camera* arg1 = nullptr;
|
|
ok &= jsval_to_vector2(cx, args.get(0), &arg0);
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (const cocos2d::Camera*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TextFieldTTF_setCursorFromPoint : Error processing arguments");
|
|
cobj->setCursorFromPoint(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TextFieldTTF_setCursorFromPoint : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TextFieldTTF_isSecureTextEntry(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TextFieldTTF* cobj = (cocos2d::TextFieldTTF *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TextFieldTTF_isSecureTextEntry : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->isSecureTextEntry();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TextFieldTTF_isSecureTextEntry : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TextFieldTTF_getPlaceHolder(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TextFieldTTF* cobj = (cocos2d::TextFieldTTF *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TextFieldTTF_getPlaceHolder : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const std::string& ret = cobj->getPlaceHolder();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = std_string_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TextFieldTTF_getPlaceHolder : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TextFieldTTF_setCursorPosition(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TextFieldTTF* cobj = (cocos2d::TextFieldTTF *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TextFieldTTF_setCursorPosition : Invalid Native Object");
|
|
if (argc == 1) {
|
|
unsigned long arg0 = 0;
|
|
ok &= jsval_to_ulong(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TextFieldTTF_setCursorPosition : Error processing arguments");
|
|
cobj->setCursorPosition(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TextFieldTTF_setCursorPosition : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TextFieldTTF_attachWithIME(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TextFieldTTF* cobj = (cocos2d::TextFieldTTF *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TextFieldTTF_attachWithIME : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->attachWithIME();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TextFieldTTF_attachWithIME : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TextFieldTTF_textFieldWithPlaceHolder(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
|
|
do {
|
|
if (argc == 3) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
std::string arg1;
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
double arg2 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::TextFieldTTF* ret = cocos2d::TextFieldTTF::textFieldWithPlaceHolder(arg0, arg1, arg2);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::TextFieldTTF>(cx, (cocos2d::TextFieldTTF*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
|
|
do {
|
|
if (argc == 5) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Size arg1;
|
|
ok &= jsval_to_ccsize(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::TextHAlignment arg2;
|
|
ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2);
|
|
if (!ok) { ok = true; break; }
|
|
std::string arg3;
|
|
ok &= jsval_to_std_string(cx, args.get(3), &arg3);
|
|
if (!ok) { ok = true; break; }
|
|
double arg4 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(4), &arg4) && !std::isnan(arg4);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::TextFieldTTF* ret = cocos2d::TextFieldTTF::textFieldWithPlaceHolder(arg0, arg1, arg2, arg3, arg4);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::TextFieldTTF>(cx, (cocos2d::TextFieldTTF*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while (0);
|
|
JS_ReportError(cx, "js_cocos2dx_TextFieldTTF_textFieldWithPlaceHolder : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TextFieldTTF_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::TextFieldTTF* cobj = new (std::nothrow) cocos2d::TextFieldTTF();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TextFieldTTF>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::TextFieldTTF"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_TextFieldTTF_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::TextFieldTTF *nobj = new (std::nothrow) cocos2d::TextFieldTTF();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::TextFieldTTF");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_Label_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_TextFieldTTF(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_TextFieldTTF_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_TextFieldTTF_class->name = "TextFieldTTF";
|
|
jsb_cocos2d_TextFieldTTF_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TextFieldTTF_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_TextFieldTTF_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TextFieldTTF_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_TextFieldTTF_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_TextFieldTTF_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_TextFieldTTF_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_TextFieldTTF_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("getCharCount", js_cocos2dx_TextFieldTTF_getCharCount, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setCursorChar", js_cocos2dx_TextFieldTTF_setCursorChar, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setSecureTextEntry", js_cocos2dx_TextFieldTTF_setSecureTextEntry, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setCursorEnabled", js_cocos2dx_TextFieldTTF_setCursorEnabled, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getColorSpaceHolder", js_cocos2dx_TextFieldTTF_getColorSpaceHolder, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initWithPlaceHolder", js_cocos2dx_TextFieldTTF_initWithPlaceHolder, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("appendString", js_cocos2dx_TextFieldTTF_appendString, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getPasswordTextStyle", js_cocos2dx_TextFieldTTF_getPasswordTextStyle, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setPasswordTextStyle", js_cocos2dx_TextFieldTTF_setPasswordTextStyle, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setColorSpaceHolder", js_cocos2dx_TextFieldTTF_setColorSpaceHolder, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("detachWithIME", js_cocos2dx_TextFieldTTF_detachWithIME, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setPlaceHolder", js_cocos2dx_TextFieldTTF_setPlaceHolder, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setCursorFromPoint", js_cocos2dx_TextFieldTTF_setCursorFromPoint, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("isSecureTextEntry", js_cocos2dx_TextFieldTTF_isSecureTextEntry, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getPlaceHolder", js_cocos2dx_TextFieldTTF_getPlaceHolder, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setCursorPosition", js_cocos2dx_TextFieldTTF_setCursorPosition, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("attachWithIME", js_cocos2dx_TextFieldTTF_attachWithIME, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_TextFieldTTF_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_TextFieldTTF_textFieldWithPlaceHolder, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_Label_prototype);
|
|
jsb_cocos2d_TextFieldTTF_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_TextFieldTTF_class,
|
|
js_cocos2dx_TextFieldTTF_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_TextFieldTTF_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "TextFieldTTF"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::TextFieldTTF>(cx, jsb_cocos2d_TextFieldTTF_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.TextFieldTTF.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_ParallaxNode_class;
|
|
JSObject *jsb_cocos2d_ParallaxNode_prototype;
|
|
|
|
bool js_cocos2dx_ParallaxNode_getParallaxArray(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::ParallaxNode* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::ParallaxNode *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParallaxNode_getParallaxArray : Invalid Native Object");
|
|
do {
|
|
if (argc == 0) {
|
|
const cocos2d::_ccArray* ret = cobj->getParallaxArray();
|
|
jsval jsret = JSVAL_NULL;
|
|
#pragma warning NO CONVERSION FROM NATIVE FOR _ccArray*;
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 0) {
|
|
cocos2d::_ccArray* ret = cobj->getParallaxArray();
|
|
jsval jsret = JSVAL_NULL;
|
|
#pragma warning NO CONVERSION FROM NATIVE FOR _ccArray*;
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParallaxNode_getParallaxArray : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParallaxNode_addChild(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParallaxNode* cobj = (cocos2d::ParallaxNode *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParallaxNode_addChild : Invalid Native Object");
|
|
if (argc == 4) {
|
|
cocos2d::Node* arg0 = nullptr;
|
|
int arg1 = 0;
|
|
cocos2d::Vec2 arg2;
|
|
cocos2d::Vec2 arg3;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::Node*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1);
|
|
ok &= jsval_to_vector2(cx, args.get(2), &arg2);
|
|
ok &= jsval_to_vector2(cx, args.get(3), &arg3);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParallaxNode_addChild : Error processing arguments");
|
|
cobj->addChild(arg0, arg1, arg2, arg3);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParallaxNode_addChild : wrong number of arguments: %d, was expecting %d", argc, 4);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParallaxNode_removeAllChildrenWithCleanup(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParallaxNode* cobj = (cocos2d::ParallaxNode *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParallaxNode_removeAllChildrenWithCleanup : Invalid Native Object");
|
|
if (argc == 1) {
|
|
bool arg0;
|
|
arg0 = JS::ToBoolean(args.get(0));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParallaxNode_removeAllChildrenWithCleanup : Error processing arguments");
|
|
cobj->removeAllChildrenWithCleanup(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParallaxNode_removeAllChildrenWithCleanup : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParallaxNode_setParallaxArray(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::ParallaxNode* cobj = (cocos2d::ParallaxNode *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ParallaxNode_setParallaxArray : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::_ccArray* arg0 = nullptr;
|
|
#pragma warning NO CONVERSION TO NATIVE FOR _ccArray*
|
|
ok = false;
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ParallaxNode_setParallaxArray : Error processing arguments");
|
|
cobj->setParallaxArray(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_ParallaxNode_setParallaxArray : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_ParallaxNode_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
if (argc == 0) {
|
|
|
|
auto ret = cocos2d::ParallaxNode::create();
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::ParallaxNode>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::ParallaxNode"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_ParallaxNode_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_ParallaxNode_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::ParallaxNode* cobj = new (std::nothrow) cocos2d::ParallaxNode();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::ParallaxNode>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::ParallaxNode"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_ParallaxNode_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::ParallaxNode *nobj = new (std::nothrow) cocos2d::ParallaxNode();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::ParallaxNode");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_Node_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_ParallaxNode(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_ParallaxNode_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_ParallaxNode_class->name = "ParallaxNode";
|
|
jsb_cocos2d_ParallaxNode_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_ParallaxNode_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_ParallaxNode_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_ParallaxNode_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_ParallaxNode_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_ParallaxNode_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_ParallaxNode_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_ParallaxNode_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("getParallaxArray", js_cocos2dx_ParallaxNode_getParallaxArray, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("addChild", js_cocos2dx_ParallaxNode_addChild, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("removeAllChildrenWithCleanup", js_cocos2dx_ParallaxNode_removeAllChildrenWithCleanup, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setParallaxArray", js_cocos2dx_ParallaxNode_setParallaxArray, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_ParallaxNode_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_ParallaxNode_create, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_Node_prototype);
|
|
jsb_cocos2d_ParallaxNode_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_ParallaxNode_class,
|
|
js_cocos2dx_ParallaxNode_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_ParallaxNode_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "ParallaxNode"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::ParallaxNode>(cx, jsb_cocos2d_ParallaxNode_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.ParallaxNode.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_TMXObjectGroup_class;
|
|
JSObject *jsb_cocos2d_TMXObjectGroup_prototype;
|
|
|
|
bool js_cocos2dx_TMXObjectGroup_setPositionOffset(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TMXObjectGroup* cobj = (cocos2d::TMXObjectGroup *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXObjectGroup_setPositionOffset : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Vec2 arg0;
|
|
ok &= jsval_to_vector2(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TMXObjectGroup_setPositionOffset : Error processing arguments");
|
|
cobj->setPositionOffset(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXObjectGroup_setPositionOffset : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXObjectGroup_getProperty(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TMXObjectGroup* cobj = (cocos2d::TMXObjectGroup *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXObjectGroup_getProperty : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TMXObjectGroup_getProperty : Error processing arguments");
|
|
cocos2d::Value ret = cobj->getProperty(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ccvalue_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXObjectGroup_getProperty : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXObjectGroup_getPositionOffset(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TMXObjectGroup* cobj = (cocos2d::TMXObjectGroup *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXObjectGroup_getPositionOffset : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const cocos2d::Vec2& ret = cobj->getPositionOffset();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = vector2_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXObjectGroup_getPositionOffset : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXObjectGroup_getObject(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TMXObjectGroup* cobj = (cocos2d::TMXObjectGroup *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXObjectGroup_getObject : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TMXObjectGroup_getObject : Error processing arguments");
|
|
cocos2d::ValueMap ret = cobj->getObject(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ccvaluemap_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXObjectGroup_getObject : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXObjectGroup_getObjects(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::TMXObjectGroup* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::TMXObjectGroup *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXObjectGroup_getObjects : Invalid Native Object");
|
|
do {
|
|
if (argc == 0) {
|
|
cocos2d::ValueVector& ret = cobj->getObjects();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ccvaluevector_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 0) {
|
|
const cocos2d::ValueVector& ret = cobj->getObjects();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ccvaluevector_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXObjectGroup_getObjects : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXObjectGroup_setGroupName(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TMXObjectGroup* cobj = (cocos2d::TMXObjectGroup *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXObjectGroup_setGroupName : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TMXObjectGroup_setGroupName : Error processing arguments");
|
|
cobj->setGroupName(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXObjectGroup_setGroupName : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXObjectGroup_getProperties(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::TMXObjectGroup* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::TMXObjectGroup *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXObjectGroup_getProperties : Invalid Native Object");
|
|
do {
|
|
if (argc == 0) {
|
|
cocos2d::ValueMap& ret = cobj->getProperties();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ccvaluemap_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 0) {
|
|
const cocos2d::ValueMap& ret = cobj->getProperties();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ccvaluemap_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXObjectGroup_getProperties : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXObjectGroup_getGroupName(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TMXObjectGroup* cobj = (cocos2d::TMXObjectGroup *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXObjectGroup_getGroupName : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const std::string& ret = cobj->getGroupName();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = std_string_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXObjectGroup_getGroupName : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXObjectGroup_setProperties(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TMXObjectGroup* cobj = (cocos2d::TMXObjectGroup *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXObjectGroup_setProperties : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::ValueMap arg0;
|
|
ok &= jsval_to_ccvaluemap(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TMXObjectGroup_setProperties : Error processing arguments");
|
|
cobj->setProperties(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXObjectGroup_setProperties : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXObjectGroup_setObjects(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TMXObjectGroup* cobj = (cocos2d::TMXObjectGroup *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXObjectGroup_setObjects : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::ValueVector arg0;
|
|
ok &= jsval_to_ccvaluevector(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TMXObjectGroup_setObjects : Error processing arguments");
|
|
cobj->setObjects(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXObjectGroup_setObjects : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXObjectGroup_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::TMXObjectGroup* cobj = new (std::nothrow) cocos2d::TMXObjectGroup();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TMXObjectGroup>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::TMXObjectGroup"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
|
|
|
|
void js_register_cocos2dx_TMXObjectGroup(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_TMXObjectGroup_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_TMXObjectGroup_class->name = "TMXObjectGroup";
|
|
jsb_cocos2d_TMXObjectGroup_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TMXObjectGroup_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_TMXObjectGroup_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TMXObjectGroup_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_TMXObjectGroup_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_TMXObjectGroup_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_TMXObjectGroup_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_TMXObjectGroup_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("setPositionOffset", js_cocos2dx_TMXObjectGroup_setPositionOffset, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getProperty", js_cocos2dx_TMXObjectGroup_getProperty, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getPositionOffset", js_cocos2dx_TMXObjectGroup_getPositionOffset, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getObject", js_cocos2dx_TMXObjectGroup_getObject, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getObjects", js_cocos2dx_TMXObjectGroup_getObjects, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setGroupName", js_cocos2dx_TMXObjectGroup_setGroupName, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getProperties", js_cocos2dx_TMXObjectGroup_getProperties, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getGroupName", js_cocos2dx_TMXObjectGroup_getGroupName, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setProperties", js_cocos2dx_TMXObjectGroup_setProperties, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setObjects", js_cocos2dx_TMXObjectGroup_setObjects, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JSFunctionSpec *st_funcs = NULL;
|
|
|
|
jsb_cocos2d_TMXObjectGroup_prototype = JS_InitClass(
|
|
cx, global,
|
|
JS::NullPtr(),
|
|
jsb_cocos2d_TMXObjectGroup_class,
|
|
js_cocos2dx_TMXObjectGroup_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_TMXObjectGroup_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "TMXObjectGroup"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::TMXObjectGroup>(cx, jsb_cocos2d_TMXObjectGroup_class, proto, JS::NullPtr());
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_TMXLayerInfo_class;
|
|
JSObject *jsb_cocos2d_TMXLayerInfo_prototype;
|
|
|
|
bool js_cocos2dx_TMXLayerInfo_setProperties(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TMXLayerInfo* cobj = (cocos2d::TMXLayerInfo *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXLayerInfo_setProperties : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::ValueMap arg0;
|
|
ok &= jsval_to_ccvaluemap(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TMXLayerInfo_setProperties : Error processing arguments");
|
|
cobj->setProperties(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXLayerInfo_setProperties : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXLayerInfo_getProperties(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TMXLayerInfo* cobj = (cocos2d::TMXLayerInfo *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXLayerInfo_getProperties : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::ValueMap& ret = cobj->getProperties();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ccvaluemap_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXLayerInfo_getProperties : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXLayerInfo_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::TMXLayerInfo* cobj = new (std::nothrow) cocos2d::TMXLayerInfo();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TMXLayerInfo>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::TMXLayerInfo"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
|
|
|
|
void js_register_cocos2dx_TMXLayerInfo(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_TMXLayerInfo_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_TMXLayerInfo_class->name = "TMXLayerInfo";
|
|
jsb_cocos2d_TMXLayerInfo_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TMXLayerInfo_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_TMXLayerInfo_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TMXLayerInfo_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_TMXLayerInfo_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_TMXLayerInfo_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_TMXLayerInfo_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_TMXLayerInfo_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("setProperties", js_cocos2dx_TMXLayerInfo_setProperties, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getProperties", js_cocos2dx_TMXLayerInfo_getProperties, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JSFunctionSpec *st_funcs = NULL;
|
|
|
|
jsb_cocos2d_TMXLayerInfo_prototype = JS_InitClass(
|
|
cx, global,
|
|
JS::NullPtr(),
|
|
jsb_cocos2d_TMXLayerInfo_class,
|
|
js_cocos2dx_TMXLayerInfo_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_TMXLayerInfo_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "TMXLayerInfo"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::TMXLayerInfo>(cx, jsb_cocos2d_TMXLayerInfo_class, proto, JS::NullPtr());
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_TMXTilesetInfo_class;
|
|
JSObject *jsb_cocos2d_TMXTilesetInfo_prototype;
|
|
|
|
bool js_cocos2dx_TMXTilesetInfo_getRectForGID(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TMXTilesetInfo* cobj = (cocos2d::TMXTilesetInfo *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXTilesetInfo_getRectForGID : Invalid Native Object");
|
|
if (argc == 1) {
|
|
unsigned int arg0 = 0;
|
|
ok &= jsval_to_uint32(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TMXTilesetInfo_getRectForGID : Error processing arguments");
|
|
cocos2d::Rect ret = cobj->getRectForGID(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ccrect_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXTilesetInfo_getRectForGID : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXTilesetInfo_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::TMXTilesetInfo* cobj = new (std::nothrow) cocos2d::TMXTilesetInfo();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TMXTilesetInfo>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::TMXTilesetInfo"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
|
|
|
|
void js_register_cocos2dx_TMXTilesetInfo(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_TMXTilesetInfo_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_TMXTilesetInfo_class->name = "TMXTilesetInfo";
|
|
jsb_cocos2d_TMXTilesetInfo_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TMXTilesetInfo_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_TMXTilesetInfo_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TMXTilesetInfo_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_TMXTilesetInfo_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_TMXTilesetInfo_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_TMXTilesetInfo_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_TMXTilesetInfo_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("getRectForGID", js_cocos2dx_TMXTilesetInfo_getRectForGID, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JSFunctionSpec *st_funcs = NULL;
|
|
|
|
jsb_cocos2d_TMXTilesetInfo_prototype = JS_InitClass(
|
|
cx, global,
|
|
JS::NullPtr(),
|
|
jsb_cocos2d_TMXTilesetInfo_class,
|
|
js_cocos2dx_TMXTilesetInfo_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_TMXTilesetInfo_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "TMXTilesetInfo"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::TMXTilesetInfo>(cx, jsb_cocos2d_TMXTilesetInfo_class, proto, JS::NullPtr());
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_TMXMapInfo_class;
|
|
JSObject *jsb_cocos2d_TMXMapInfo_prototype;
|
|
|
|
bool js_cocos2dx_TMXMapInfo_setCurrentString(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TMXMapInfo* cobj = (cocos2d::TMXMapInfo *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXMapInfo_setCurrentString : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TMXMapInfo_setCurrentString : Error processing arguments");
|
|
cobj->setCurrentString(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXMapInfo_setCurrentString : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXMapInfo_getHexSideLength(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TMXMapInfo* cobj = (cocos2d::TMXMapInfo *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXMapInfo_getHexSideLength : Invalid Native Object");
|
|
if (argc == 0) {
|
|
int ret = cobj->getHexSideLength();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = int32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXMapInfo_getHexSideLength : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXMapInfo_setTileSize(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TMXMapInfo* cobj = (cocos2d::TMXMapInfo *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXMapInfo_setTileSize : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Size arg0;
|
|
ok &= jsval_to_ccsize(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TMXMapInfo_setTileSize : Error processing arguments");
|
|
cobj->setTileSize(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXMapInfo_setTileSize : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXMapInfo_initWithTMXFile(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TMXMapInfo* cobj = (cocos2d::TMXMapInfo *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXMapInfo_initWithTMXFile : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TMXMapInfo_initWithTMXFile : Error processing arguments");
|
|
bool ret = cobj->initWithTMXFile(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXMapInfo_initWithTMXFile : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXMapInfo_getOrientation(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TMXMapInfo* cobj = (cocos2d::TMXMapInfo *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXMapInfo_getOrientation : Invalid Native Object");
|
|
if (argc == 0) {
|
|
int ret = cobj->getOrientation();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = int32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXMapInfo_getOrientation : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXMapInfo_setObjectGroups(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TMXMapInfo* cobj = (cocos2d::TMXMapInfo *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXMapInfo_setObjectGroups : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Vector<cocos2d::TMXObjectGroup *> arg0;
|
|
ok &= jsval_to_ccvector(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TMXMapInfo_setObjectGroups : Error processing arguments");
|
|
cobj->setObjectGroups(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXMapInfo_setObjectGroups : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXMapInfo_setLayers(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TMXMapInfo* cobj = (cocos2d::TMXMapInfo *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXMapInfo_setLayers : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Vector<cocos2d::TMXLayerInfo *> arg0;
|
|
ok &= jsval_to_ccvector(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TMXMapInfo_setLayers : Error processing arguments");
|
|
cobj->setLayers(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXMapInfo_setLayers : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXMapInfo_parseXMLFile(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TMXMapInfo* cobj = (cocos2d::TMXMapInfo *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXMapInfo_parseXMLFile : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TMXMapInfo_parseXMLFile : Error processing arguments");
|
|
bool ret = cobj->parseXMLFile(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXMapInfo_parseXMLFile : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXMapInfo_getParentElement(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TMXMapInfo* cobj = (cocos2d::TMXMapInfo *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXMapInfo_getParentElement : Invalid Native Object");
|
|
if (argc == 0) {
|
|
int ret = cobj->getParentElement();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = int32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXMapInfo_getParentElement : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXMapInfo_setTMXFileName(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TMXMapInfo* cobj = (cocos2d::TMXMapInfo *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXMapInfo_setTMXFileName : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TMXMapInfo_setTMXFileName : Error processing arguments");
|
|
cobj->setTMXFileName(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXMapInfo_setTMXFileName : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXMapInfo_parseXMLString(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TMXMapInfo* cobj = (cocos2d::TMXMapInfo *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXMapInfo_parseXMLString : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TMXMapInfo_parseXMLString : Error processing arguments");
|
|
bool ret = cobj->parseXMLString(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXMapInfo_parseXMLString : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXMapInfo_getLayers(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::TMXMapInfo* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::TMXMapInfo *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXMapInfo_getLayers : Invalid Native Object");
|
|
do {
|
|
if (argc == 0) {
|
|
cocos2d::Vector<cocos2d::TMXLayerInfo *>& ret = cobj->getLayers();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ccvector_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 0) {
|
|
const cocos2d::Vector<cocos2d::TMXLayerInfo *>& ret = cobj->getLayers();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ccvector_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXMapInfo_getLayers : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXMapInfo_getStaggerAxis(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TMXMapInfo* cobj = (cocos2d::TMXMapInfo *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXMapInfo_getStaggerAxis : Invalid Native Object");
|
|
if (argc == 0) {
|
|
int ret = cobj->getStaggerAxis();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = int32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXMapInfo_getStaggerAxis : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXMapInfo_setHexSideLength(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TMXMapInfo* cobj = (cocos2d::TMXMapInfo *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXMapInfo_setHexSideLength : Invalid Native Object");
|
|
if (argc == 1) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TMXMapInfo_setHexSideLength : Error processing arguments");
|
|
cobj->setHexSideLength(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXMapInfo_setHexSideLength : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXMapInfo_getTilesets(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::TMXMapInfo* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::TMXMapInfo *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXMapInfo_getTilesets : Invalid Native Object");
|
|
do {
|
|
if (argc == 0) {
|
|
cocos2d::Vector<cocos2d::TMXTilesetInfo *>& ret = cobj->getTilesets();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ccvector_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 0) {
|
|
const cocos2d::Vector<cocos2d::TMXTilesetInfo *>& ret = cobj->getTilesets();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ccvector_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXMapInfo_getTilesets : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXMapInfo_getParentGID(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TMXMapInfo* cobj = (cocos2d::TMXMapInfo *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXMapInfo_getParentGID : Invalid Native Object");
|
|
if (argc == 0) {
|
|
int ret = cobj->getParentGID();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = int32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXMapInfo_getParentGID : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXMapInfo_setParentElement(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TMXMapInfo* cobj = (cocos2d::TMXMapInfo *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXMapInfo_setParentElement : Invalid Native Object");
|
|
if (argc == 1) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TMXMapInfo_setParentElement : Error processing arguments");
|
|
cobj->setParentElement(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXMapInfo_setParentElement : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXMapInfo_initWithXML(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TMXMapInfo* cobj = (cocos2d::TMXMapInfo *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXMapInfo_initWithXML : Invalid Native Object");
|
|
if (argc == 2) {
|
|
std::string arg0;
|
|
std::string arg1;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TMXMapInfo_initWithXML : Error processing arguments");
|
|
bool ret = cobj->initWithXML(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXMapInfo_initWithXML : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXMapInfo_setParentGID(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TMXMapInfo* cobj = (cocos2d::TMXMapInfo *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXMapInfo_setParentGID : Invalid Native Object");
|
|
if (argc == 1) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TMXMapInfo_setParentGID : Error processing arguments");
|
|
cobj->setParentGID(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXMapInfo_setParentGID : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXMapInfo_getLayerAttribs(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TMXMapInfo* cobj = (cocos2d::TMXMapInfo *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXMapInfo_getLayerAttribs : Invalid Native Object");
|
|
if (argc == 0) {
|
|
int ret = cobj->getLayerAttribs();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = int32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXMapInfo_getLayerAttribs : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXMapInfo_getTileSize(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TMXMapInfo* cobj = (cocos2d::TMXMapInfo *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXMapInfo_getTileSize : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const cocos2d::Size& ret = cobj->getTileSize();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ccsize_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXMapInfo_getTileSize : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXMapInfo_getTileProperties(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TMXMapInfo* cobj = (cocos2d::TMXMapInfo *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXMapInfo_getTileProperties : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::ValueMapIntKey& ret = cobj->getTileProperties();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ccvaluemapintkey_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXMapInfo_getTileProperties : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXMapInfo_isStoringCharacters(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TMXMapInfo* cobj = (cocos2d::TMXMapInfo *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXMapInfo_isStoringCharacters : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->isStoringCharacters();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXMapInfo_isStoringCharacters : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXMapInfo_getExternalTilesetFileName(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TMXMapInfo* cobj = (cocos2d::TMXMapInfo *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXMapInfo_getExternalTilesetFileName : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const std::string& ret = cobj->getExternalTilesetFileName();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = std_string_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXMapInfo_getExternalTilesetFileName : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXMapInfo_getObjectGroups(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::TMXMapInfo* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::TMXMapInfo *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXMapInfo_getObjectGroups : Invalid Native Object");
|
|
do {
|
|
if (argc == 0) {
|
|
cocos2d::Vector<cocos2d::TMXObjectGroup *>& ret = cobj->getObjectGroups();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ccvector_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 0) {
|
|
const cocos2d::Vector<cocos2d::TMXObjectGroup *>& ret = cobj->getObjectGroups();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ccvector_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXMapInfo_getObjectGroups : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXMapInfo_getTMXFileName(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TMXMapInfo* cobj = (cocos2d::TMXMapInfo *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXMapInfo_getTMXFileName : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const std::string& ret = cobj->getTMXFileName();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = std_string_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXMapInfo_getTMXFileName : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXMapInfo_setStaggerIndex(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TMXMapInfo* cobj = (cocos2d::TMXMapInfo *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXMapInfo_setStaggerIndex : Invalid Native Object");
|
|
if (argc == 1) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TMXMapInfo_setStaggerIndex : Error processing arguments");
|
|
cobj->setStaggerIndex(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXMapInfo_setStaggerIndex : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXMapInfo_setProperties(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TMXMapInfo* cobj = (cocos2d::TMXMapInfo *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXMapInfo_setProperties : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::ValueMap arg0;
|
|
ok &= jsval_to_ccvaluemap(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TMXMapInfo_setProperties : Error processing arguments");
|
|
cobj->setProperties(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXMapInfo_setProperties : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXMapInfo_setOrientation(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TMXMapInfo* cobj = (cocos2d::TMXMapInfo *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXMapInfo_setOrientation : Invalid Native Object");
|
|
if (argc == 1) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TMXMapInfo_setOrientation : Error processing arguments");
|
|
cobj->setOrientation(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXMapInfo_setOrientation : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXMapInfo_setTileProperties(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TMXMapInfo* cobj = (cocos2d::TMXMapInfo *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXMapInfo_setTileProperties : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::ValueMapIntKey arg0;
|
|
ok &= jsval_to_ccvaluemapintkey(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TMXMapInfo_setTileProperties : Error processing arguments");
|
|
cobj->setTileProperties(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXMapInfo_setTileProperties : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXMapInfo_setMapSize(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TMXMapInfo* cobj = (cocos2d::TMXMapInfo *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXMapInfo_setMapSize : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Size arg0;
|
|
ok &= jsval_to_ccsize(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TMXMapInfo_setMapSize : Error processing arguments");
|
|
cobj->setMapSize(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXMapInfo_setMapSize : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXMapInfo_getCurrentString(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TMXMapInfo* cobj = (cocos2d::TMXMapInfo *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXMapInfo_getCurrentString : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const std::string& ret = cobj->getCurrentString();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = std_string_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXMapInfo_getCurrentString : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXMapInfo_setStoringCharacters(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TMXMapInfo* cobj = (cocos2d::TMXMapInfo *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXMapInfo_setStoringCharacters : Invalid Native Object");
|
|
if (argc == 1) {
|
|
bool arg0;
|
|
arg0 = JS::ToBoolean(args.get(0));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TMXMapInfo_setStoringCharacters : Error processing arguments");
|
|
cobj->setStoringCharacters(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXMapInfo_setStoringCharacters : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXMapInfo_setStaggerAxis(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TMXMapInfo* cobj = (cocos2d::TMXMapInfo *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXMapInfo_setStaggerAxis : Invalid Native Object");
|
|
if (argc == 1) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TMXMapInfo_setStaggerAxis : Error processing arguments");
|
|
cobj->setStaggerAxis(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXMapInfo_setStaggerAxis : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXMapInfo_getMapSize(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TMXMapInfo* cobj = (cocos2d::TMXMapInfo *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXMapInfo_getMapSize : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const cocos2d::Size& ret = cobj->getMapSize();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ccsize_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXMapInfo_getMapSize : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXMapInfo_setTilesets(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TMXMapInfo* cobj = (cocos2d::TMXMapInfo *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXMapInfo_setTilesets : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Vector<cocos2d::TMXTilesetInfo *> arg0;
|
|
ok &= jsval_to_ccvector(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TMXMapInfo_setTilesets : Error processing arguments");
|
|
cobj->setTilesets(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXMapInfo_setTilesets : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXMapInfo_getProperties(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::TMXMapInfo* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::TMXMapInfo *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXMapInfo_getProperties : Invalid Native Object");
|
|
do {
|
|
if (argc == 0) {
|
|
cocos2d::ValueMap& ret = cobj->getProperties();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ccvaluemap_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 0) {
|
|
const cocos2d::ValueMap& ret = cobj->getProperties();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ccvaluemap_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXMapInfo_getProperties : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXMapInfo_getStaggerIndex(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TMXMapInfo* cobj = (cocos2d::TMXMapInfo *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXMapInfo_getStaggerIndex : Invalid Native Object");
|
|
if (argc == 0) {
|
|
int ret = cobj->getStaggerIndex();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = int32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXMapInfo_getStaggerIndex : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXMapInfo_setLayerAttribs(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TMXMapInfo* cobj = (cocos2d::TMXMapInfo *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXMapInfo_setLayerAttribs : Invalid Native Object");
|
|
if (argc == 1) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TMXMapInfo_setLayerAttribs : Error processing arguments");
|
|
cobj->setLayerAttribs(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXMapInfo_setLayerAttribs : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXMapInfo_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TMXMapInfo_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::TMXMapInfo::create(arg0);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TMXMapInfo>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::TMXMapInfo"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_TMXMapInfo_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_TMXMapInfo_createWithXML(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 2) {
|
|
std::string arg0;
|
|
std::string arg1;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TMXMapInfo_createWithXML : Error processing arguments");
|
|
|
|
auto ret = cocos2d::TMXMapInfo::createWithXML(arg0, arg1);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TMXMapInfo>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::TMXMapInfo"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_TMXMapInfo_createWithXML : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_TMXMapInfo_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::TMXMapInfo* cobj = new (std::nothrow) cocos2d::TMXMapInfo();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TMXMapInfo>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::TMXMapInfo"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_TMXMapInfo_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::TMXMapInfo *nobj = new (std::nothrow) cocos2d::TMXMapInfo();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::TMXMapInfo");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
|
|
void js_register_cocos2dx_TMXMapInfo(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_TMXMapInfo_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_TMXMapInfo_class->name = "TMXMapInfo";
|
|
jsb_cocos2d_TMXMapInfo_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TMXMapInfo_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_TMXMapInfo_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TMXMapInfo_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_TMXMapInfo_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_TMXMapInfo_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_TMXMapInfo_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_TMXMapInfo_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("setCurrentString", js_cocos2dx_TMXMapInfo_setCurrentString, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getHexSideLength", js_cocos2dx_TMXMapInfo_getHexSideLength, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setTileSize", js_cocos2dx_TMXMapInfo_setTileSize, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initWithTMXFile", js_cocos2dx_TMXMapInfo_initWithTMXFile, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getOrientation", js_cocos2dx_TMXMapInfo_getOrientation, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setObjectGroups", js_cocos2dx_TMXMapInfo_setObjectGroups, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setLayers", js_cocos2dx_TMXMapInfo_setLayers, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("parseXMLFile", js_cocos2dx_TMXMapInfo_parseXMLFile, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getParentElement", js_cocos2dx_TMXMapInfo_getParentElement, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setTMXFileName", js_cocos2dx_TMXMapInfo_setTMXFileName, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("parseXMLString", js_cocos2dx_TMXMapInfo_parseXMLString, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getLayers", js_cocos2dx_TMXMapInfo_getLayers, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getStaggerAxis", js_cocos2dx_TMXMapInfo_getStaggerAxis, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setHexSideLength", js_cocos2dx_TMXMapInfo_setHexSideLength, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getTilesets", js_cocos2dx_TMXMapInfo_getTilesets, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getParentGID", js_cocos2dx_TMXMapInfo_getParentGID, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setParentElement", js_cocos2dx_TMXMapInfo_setParentElement, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initWithXML", js_cocos2dx_TMXMapInfo_initWithXML, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setParentGID", js_cocos2dx_TMXMapInfo_setParentGID, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getLayerAttribs", js_cocos2dx_TMXMapInfo_getLayerAttribs, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getTileSize", js_cocos2dx_TMXMapInfo_getTileSize, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getTileProperties", js_cocos2dx_TMXMapInfo_getTileProperties, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("isStoringCharacters", js_cocos2dx_TMXMapInfo_isStoringCharacters, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getExternalTilesetFileName", js_cocos2dx_TMXMapInfo_getExternalTilesetFileName, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getObjectGroups", js_cocos2dx_TMXMapInfo_getObjectGroups, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getTMXFileName", js_cocos2dx_TMXMapInfo_getTMXFileName, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setStaggerIndex", js_cocos2dx_TMXMapInfo_setStaggerIndex, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setProperties", js_cocos2dx_TMXMapInfo_setProperties, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setOrientation", js_cocos2dx_TMXMapInfo_setOrientation, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setTileProperties", js_cocos2dx_TMXMapInfo_setTileProperties, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setMapSize", js_cocos2dx_TMXMapInfo_setMapSize, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getCurrentString", js_cocos2dx_TMXMapInfo_getCurrentString, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setStoringCharacters", js_cocos2dx_TMXMapInfo_setStoringCharacters, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setStaggerAxis", js_cocos2dx_TMXMapInfo_setStaggerAxis, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getMapSize", js_cocos2dx_TMXMapInfo_getMapSize, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setTilesets", js_cocos2dx_TMXMapInfo_setTilesets, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getProperties", js_cocos2dx_TMXMapInfo_getProperties, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getStaggerIndex", js_cocos2dx_TMXMapInfo_getStaggerIndex, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setLayerAttribs", js_cocos2dx_TMXMapInfo_setLayerAttribs, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_TMXMapInfo_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_TMXMapInfo_create, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("createWithXML", js_cocos2dx_TMXMapInfo_createWithXML, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
jsb_cocos2d_TMXMapInfo_prototype = JS_InitClass(
|
|
cx, global,
|
|
JS::NullPtr(),
|
|
jsb_cocos2d_TMXMapInfo_class,
|
|
js_cocos2dx_TMXMapInfo_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_TMXMapInfo_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "TMXMapInfo"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::TMXMapInfo>(cx, jsb_cocos2d_TMXMapInfo_class, proto, JS::NullPtr());
|
|
anonEvaluate(cx, global, "(function () { cc.TMXMapInfo.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_TMXLayer_class;
|
|
JSObject *jsb_cocos2d_TMXLayer_prototype;
|
|
|
|
bool js_cocos2dx_TMXLayer_getTileGIDAt(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TMXLayer* cobj = (cocos2d::TMXLayer *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXLayer_getTileGIDAt : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Vec2 arg0;
|
|
ok &= jsval_to_vector2(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TMXLayer_getTileGIDAt : Error processing arguments");
|
|
unsigned int ret = cobj->getTileGIDAt(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = uint32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
if (argc == 2) {
|
|
cocos2d::Vec2 arg0;
|
|
cocos2d::TMXTileFlags_* arg1 = nullptr;
|
|
ok &= jsval_to_vector2(cx, args.get(0), &arg0);
|
|
uint32_t tempData;arg1=(cocos2d::TMXTileFlags_*)&tempData;ok &= jsval_to_uint32(cx, args.get(1), (uint32_t *)&arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TMXLayer_getTileGIDAt : Error processing arguments");
|
|
unsigned int ret = cobj->getTileGIDAt(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = uint32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXLayer_getTileGIDAt : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXLayer_getPositionAt(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TMXLayer* cobj = (cocos2d::TMXLayer *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXLayer_getPositionAt : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Vec2 arg0;
|
|
ok &= jsval_to_vector2(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TMXLayer_getPositionAt : Error processing arguments");
|
|
cocos2d::Vec2 ret = cobj->getPositionAt(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = vector2_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXLayer_getPositionAt : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXLayer_setLayerOrientation(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TMXLayer* cobj = (cocos2d::TMXLayer *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXLayer_setLayerOrientation : Invalid Native Object");
|
|
if (argc == 1) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TMXLayer_setLayerOrientation : Error processing arguments");
|
|
cobj->setLayerOrientation(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXLayer_setLayerOrientation : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXLayer_releaseMap(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TMXLayer* cobj = (cocos2d::TMXLayer *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXLayer_releaseMap : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->releaseMap();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXLayer_releaseMap : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXLayer_setTiles(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TMXLayer* cobj = (cocos2d::TMXLayer *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXLayer_setTiles : Invalid Native Object");
|
|
if (argc == 1) {
|
|
unsigned int* arg0 = 0;
|
|
#pragma warning NO CONVERSION TO NATIVE FOR unsigned int*
|
|
ok = false;
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TMXLayer_setTiles : Error processing arguments");
|
|
cobj->setTiles(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXLayer_setTiles : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXLayer_getLayerSize(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TMXLayer* cobj = (cocos2d::TMXLayer *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXLayer_getLayerSize : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const cocos2d::Size& ret = cobj->getLayerSize();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ccsize_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXLayer_getLayerSize : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXLayer_setMapTileSize(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TMXLayer* cobj = (cocos2d::TMXLayer *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXLayer_setMapTileSize : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Size arg0;
|
|
ok &= jsval_to_ccsize(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TMXLayer_setMapTileSize : Error processing arguments");
|
|
cobj->setMapTileSize(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXLayer_setMapTileSize : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXLayer_getLayerOrientation(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TMXLayer* cobj = (cocos2d::TMXLayer *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXLayer_getLayerOrientation : Invalid Native Object");
|
|
if (argc == 0) {
|
|
int ret = cobj->getLayerOrientation();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = int32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXLayer_getLayerOrientation : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXLayer_setProperties(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TMXLayer* cobj = (cocos2d::TMXLayer *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXLayer_setProperties : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::ValueMap arg0;
|
|
ok &= jsval_to_ccvaluemap(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TMXLayer_setProperties : Error processing arguments");
|
|
cobj->setProperties(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXLayer_setProperties : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXLayer_setLayerName(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TMXLayer* cobj = (cocos2d::TMXLayer *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXLayer_setLayerName : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TMXLayer_setLayerName : Error processing arguments");
|
|
cobj->setLayerName(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXLayer_setLayerName : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXLayer_removeTileAt(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TMXLayer* cobj = (cocos2d::TMXLayer *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXLayer_removeTileAt : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Vec2 arg0;
|
|
ok &= jsval_to_vector2(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TMXLayer_removeTileAt : Error processing arguments");
|
|
cobj->removeTileAt(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXLayer_removeTileAt : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXLayer_initWithTilesetInfo(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TMXLayer* cobj = (cocos2d::TMXLayer *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXLayer_initWithTilesetInfo : Invalid Native Object");
|
|
if (argc == 3) {
|
|
cocos2d::TMXTilesetInfo* arg0 = nullptr;
|
|
cocos2d::TMXLayerInfo* arg1 = nullptr;
|
|
cocos2d::TMXMapInfo* arg2 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::TMXTilesetInfo*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::TMXLayerInfo*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
do {
|
|
if (args.get(2).isNull()) { arg2 = nullptr; break; }
|
|
if (!args.get(2).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(2).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg2 = (cocos2d::TMXMapInfo*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg2, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TMXLayer_initWithTilesetInfo : Error processing arguments");
|
|
bool ret = cobj->initWithTilesetInfo(arg0, arg1, arg2);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXLayer_initWithTilesetInfo : wrong number of arguments: %d, was expecting %d", argc, 3);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXLayer_setupTiles(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TMXLayer* cobj = (cocos2d::TMXLayer *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXLayer_setupTiles : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->setupTiles();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXLayer_setupTiles : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXLayer_setTileGID(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::TMXLayer* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::TMXLayer *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXLayer_setTileGID : Invalid Native Object");
|
|
do {
|
|
if (argc == 3) {
|
|
unsigned int arg0 = 0;
|
|
ok &= jsval_to_uint32(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Vec2 arg1;
|
|
ok &= jsval_to_vector2(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::TMXTileFlags_ arg2;
|
|
ok &= jsval_to_uint32(cx, args.get(2), (uint32_t *)&arg2);
|
|
if (!ok) { ok = true; break; }
|
|
cobj->setTileGID(arg0, arg1, arg2);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 2) {
|
|
unsigned int arg0 = 0;
|
|
ok &= jsval_to_uint32(cx, args.get(0), &arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Vec2 arg1;
|
|
ok &= jsval_to_vector2(cx, args.get(1), &arg1);
|
|
if (!ok) { ok = true; break; }
|
|
cobj->setTileGID(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXLayer_setTileGID : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXLayer_getMapTileSize(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TMXLayer* cobj = (cocos2d::TMXLayer *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXLayer_getMapTileSize : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const cocos2d::Size& ret = cobj->getMapTileSize();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ccsize_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXLayer_getMapTileSize : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXLayer_getProperty(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TMXLayer* cobj = (cocos2d::TMXLayer *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXLayer_getProperty : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TMXLayer_getProperty : Error processing arguments");
|
|
cocos2d::Value ret = cobj->getProperty(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ccvalue_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXLayer_getProperty : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXLayer_setLayerSize(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TMXLayer* cobj = (cocos2d::TMXLayer *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXLayer_setLayerSize : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Size arg0;
|
|
ok &= jsval_to_ccsize(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TMXLayer_setLayerSize : Error processing arguments");
|
|
cobj->setLayerSize(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXLayer_setLayerSize : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXLayer_getLayerName(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TMXLayer* cobj = (cocos2d::TMXLayer *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXLayer_getLayerName : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const std::string& ret = cobj->getLayerName();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = std_string_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXLayer_getLayerName : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXLayer_setTileSet(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TMXLayer* cobj = (cocos2d::TMXLayer *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXLayer_setTileSet : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::TMXTilesetInfo* arg0 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::TMXTilesetInfo*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TMXLayer_setTileSet : Error processing arguments");
|
|
cobj->setTileSet(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXLayer_setTileSet : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXLayer_getTileSet(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TMXLayer* cobj = (cocos2d::TMXLayer *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXLayer_getTileSet : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::TMXTilesetInfo* ret = cobj->getTileSet();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::TMXTilesetInfo>(cx, (cocos2d::TMXTilesetInfo*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXLayer_getTileSet : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXLayer_getProperties(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::TMXLayer* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::TMXLayer *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXLayer_getProperties : Invalid Native Object");
|
|
do {
|
|
if (argc == 0) {
|
|
cocos2d::ValueMap& ret = cobj->getProperties();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ccvaluemap_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 0) {
|
|
const cocos2d::ValueMap& ret = cobj->getProperties();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ccvaluemap_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXLayer_getProperties : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXLayer_getTileAt(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TMXLayer* cobj = (cocos2d::TMXLayer *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXLayer_getTileAt : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Vec2 arg0;
|
|
ok &= jsval_to_vector2(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TMXLayer_getTileAt : Error processing arguments");
|
|
cocos2d::Sprite* ret = cobj->getTileAt(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::Sprite>(cx, (cocos2d::Sprite*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXLayer_getTileAt : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXLayer_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 3) {
|
|
cocos2d::TMXTilesetInfo* arg0 = nullptr;
|
|
cocos2d::TMXLayerInfo* arg1 = nullptr;
|
|
cocos2d::TMXMapInfo* arg2 = nullptr;
|
|
do {
|
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
|
if (!args.get(0).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg0 = (cocos2d::TMXTilesetInfo*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::TMXLayerInfo*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
do {
|
|
if (args.get(2).isNull()) { arg2 = nullptr; break; }
|
|
if (!args.get(2).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(2).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg2 = (cocos2d::TMXMapInfo*)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg2, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TMXLayer_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::TMXLayer::create(arg0, arg1, arg2);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TMXLayer>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::TMXLayer"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_TMXLayer_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_TMXLayer_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::TMXLayer* cobj = new (std::nothrow) cocos2d::TMXLayer();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TMXLayer>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::TMXLayer"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_TMXLayer_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::TMXLayer *nobj = new (std::nothrow) cocos2d::TMXLayer();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::TMXLayer");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_SpriteBatchNode_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_TMXLayer(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_TMXLayer_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_TMXLayer_class->name = "TMXLayer";
|
|
jsb_cocos2d_TMXLayer_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TMXLayer_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_TMXLayer_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TMXLayer_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_TMXLayer_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_TMXLayer_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_TMXLayer_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_TMXLayer_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("getTileGIDAt", js_cocos2dx_TMXLayer_getTileGIDAt, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getPositionAt", js_cocos2dx_TMXLayer_getPositionAt, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setLayerOrientation", js_cocos2dx_TMXLayer_setLayerOrientation, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("releaseMap", js_cocos2dx_TMXLayer_releaseMap, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setTiles", js_cocos2dx_TMXLayer_setTiles, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getLayerSize", js_cocos2dx_TMXLayer_getLayerSize, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setMapTileSize", js_cocos2dx_TMXLayer_setMapTileSize, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getLayerOrientation", js_cocos2dx_TMXLayer_getLayerOrientation, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setProperties", js_cocos2dx_TMXLayer_setProperties, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setLayerName", js_cocos2dx_TMXLayer_setLayerName, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("removeTileAt", js_cocos2dx_TMXLayer_removeTileAt, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initWithTilesetInfo", js_cocos2dx_TMXLayer_initWithTilesetInfo, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setupTiles", js_cocos2dx_TMXLayer_setupTiles, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setTileGID", js_cocos2dx_TMXLayer_setTileGID, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getMapTileSize", js_cocos2dx_TMXLayer_getMapTileSize, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getProperty", js_cocos2dx_TMXLayer_getProperty, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setLayerSize", js_cocos2dx_TMXLayer_setLayerSize, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getLayerName", js_cocos2dx_TMXLayer_getLayerName, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setTileSet", js_cocos2dx_TMXLayer_setTileSet, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getTileSet", js_cocos2dx_TMXLayer_getTileSet, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getProperties", js_cocos2dx_TMXLayer_getProperties, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getTileAt", js_cocos2dx_TMXLayer_getTileAt, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_TMXLayer_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_TMXLayer_create, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_SpriteBatchNode_prototype);
|
|
jsb_cocos2d_TMXLayer_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_TMXLayer_class,
|
|
js_cocos2dx_TMXLayer_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_TMXLayer_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "TMXLayer"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::TMXLayer>(cx, jsb_cocos2d_TMXLayer_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.TMXLayer.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_TMXTiledMap_class;
|
|
JSObject *jsb_cocos2d_TMXTiledMap_prototype;
|
|
|
|
bool js_cocos2dx_TMXTiledMap_setObjectGroups(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TMXTiledMap* cobj = (cocos2d::TMXTiledMap *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXTiledMap_setObjectGroups : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Vector<cocos2d::TMXObjectGroup *> arg0;
|
|
ok &= jsval_to_ccvector(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TMXTiledMap_setObjectGroups : Error processing arguments");
|
|
cobj->setObjectGroups(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXTiledMap_setObjectGroups : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXTiledMap_getProperty(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TMXTiledMap* cobj = (cocos2d::TMXTiledMap *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXTiledMap_getProperty : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TMXTiledMap_getProperty : Error processing arguments");
|
|
cocos2d::Value ret = cobj->getProperty(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ccvalue_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXTiledMap_getProperty : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXTiledMap_getLayerNum(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TMXTiledMap* cobj = (cocos2d::TMXTiledMap *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXTiledMap_getLayerNum : Invalid Native Object");
|
|
if (argc == 0) {
|
|
int ret = cobj->getLayerNum();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = int32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXTiledMap_getLayerNum : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXTiledMap_setMapSize(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TMXTiledMap* cobj = (cocos2d::TMXTiledMap *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXTiledMap_setMapSize : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Size arg0;
|
|
ok &= jsval_to_ccsize(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TMXTiledMap_setMapSize : Error processing arguments");
|
|
cobj->setMapSize(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXTiledMap_setMapSize : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXTiledMap_getObjectGroup(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TMXTiledMap* cobj = (cocos2d::TMXTiledMap *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXTiledMap_getObjectGroup : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TMXTiledMap_getObjectGroup : Error processing arguments");
|
|
cocos2d::TMXObjectGroup* ret = cobj->getObjectGroup(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::TMXObjectGroup>(cx, (cocos2d::TMXObjectGroup*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXTiledMap_getObjectGroup : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXTiledMap_getObjectGroups(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::TMXTiledMap* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::TMXTiledMap *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXTiledMap_getObjectGroups : Invalid Native Object");
|
|
do {
|
|
if (argc == 0) {
|
|
cocos2d::Vector<cocos2d::TMXObjectGroup *>& ret = cobj->getObjectGroups();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ccvector_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 0) {
|
|
const cocos2d::Vector<cocos2d::TMXObjectGroup *>& ret = cobj->getObjectGroups();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ccvector_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXTiledMap_getObjectGroups : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXTiledMap_getResourceFile(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TMXTiledMap* cobj = (cocos2d::TMXTiledMap *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXTiledMap_getResourceFile : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const std::string& ret = cobj->getResourceFile();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = std_string_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXTiledMap_getResourceFile : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXTiledMap_initWithTMXFile(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TMXTiledMap* cobj = (cocos2d::TMXTiledMap *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXTiledMap_initWithTMXFile : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TMXTiledMap_initWithTMXFile : Error processing arguments");
|
|
bool ret = cobj->initWithTMXFile(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXTiledMap_initWithTMXFile : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXTiledMap_getTileSize(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TMXTiledMap* cobj = (cocos2d::TMXTiledMap *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXTiledMap_getTileSize : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const cocos2d::Size& ret = cobj->getTileSize();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ccsize_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXTiledMap_getTileSize : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXTiledMap_getMapSize(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TMXTiledMap* cobj = (cocos2d::TMXTiledMap *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXTiledMap_getMapSize : Invalid Native Object");
|
|
if (argc == 0) {
|
|
const cocos2d::Size& ret = cobj->getMapSize();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ccsize_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXTiledMap_getMapSize : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXTiledMap_initWithXML(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TMXTiledMap* cobj = (cocos2d::TMXTiledMap *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXTiledMap_initWithXML : Invalid Native Object");
|
|
if (argc == 2) {
|
|
std::string arg0;
|
|
std::string arg1;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TMXTiledMap_initWithXML : Error processing arguments");
|
|
bool ret = cobj->initWithXML(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXTiledMap_initWithXML : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXTiledMap_getProperties(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TMXTiledMap* cobj = (cocos2d::TMXTiledMap *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXTiledMap_getProperties : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::ValueMap& ret = cobj->getProperties();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ccvaluemap_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXTiledMap_getProperties : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXTiledMap_getPropertiesForGID(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
bool ok = true;
|
|
cocos2d::TMXTiledMap* cobj = nullptr;
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx);
|
|
obj.set(args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cobj = (cocos2d::TMXTiledMap *)(proxy ? proxy->ptr : nullptr);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXTiledMap_getPropertiesForGID : Invalid Native Object");
|
|
do {
|
|
if (argc == 2) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Value** arg1 = nullptr;
|
|
do {
|
|
if (args.get(1).isNull()) { arg1 = nullptr; break; }
|
|
if (!args.get(1).isObject()) { ok = false; break; }
|
|
js_proxy_t *jsProxy;
|
|
JS::RootedObject tmpObj(cx, args.get(1).toObjectOrNull());
|
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
|
arg1 = (cocos2d::Value**)(jsProxy ? jsProxy->ptr : NULL);
|
|
JSB_PRECONDITION2( arg1, cx, false, "Invalid Native Object");
|
|
} while (0);
|
|
if (!ok) { ok = true; break; }
|
|
bool ret = cobj->getPropertiesForGID(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
do {
|
|
if (argc == 1) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
if (!ok) { ok = true; break; }
|
|
cocos2d::Value ret = cobj->getPropertiesForGID(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = ccvalue_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
} while(0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXTiledMap_getPropertiesForGID : wrong number of arguments");
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXTiledMap_setTileSize(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TMXTiledMap* cobj = (cocos2d::TMXTiledMap *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXTiledMap_setTileSize : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Size arg0;
|
|
ok &= jsval_to_ccsize(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TMXTiledMap_setTileSize : Error processing arguments");
|
|
cobj->setTileSize(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXTiledMap_setTileSize : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXTiledMap_setProperties(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TMXTiledMap* cobj = (cocos2d::TMXTiledMap *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXTiledMap_setProperties : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::ValueMap arg0;
|
|
ok &= jsval_to_ccvaluemap(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TMXTiledMap_setProperties : Error processing arguments");
|
|
cobj->setProperties(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXTiledMap_setProperties : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXTiledMap_getLayer(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TMXTiledMap* cobj = (cocos2d::TMXTiledMap *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXTiledMap_getLayer : Invalid Native Object");
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TMXTiledMap_getLayer : Error processing arguments");
|
|
cocos2d::TMXLayer* ret = cobj->getLayer(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<cocos2d::TMXLayer>(cx, (cocos2d::TMXLayer*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXTiledMap_getLayer : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXTiledMap_getMapOrientation(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TMXTiledMap* cobj = (cocos2d::TMXTiledMap *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXTiledMap_getMapOrientation : Invalid Native Object");
|
|
if (argc == 0) {
|
|
int ret = cobj->getMapOrientation();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = int32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXTiledMap_getMapOrientation : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXTiledMap_setMapOrientation(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TMXTiledMap* cobj = (cocos2d::TMXTiledMap *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXTiledMap_setMapOrientation : Invalid Native Object");
|
|
if (argc == 1) {
|
|
int arg0 = 0;
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TMXTiledMap_setMapOrientation : Error processing arguments");
|
|
cobj->setMapOrientation(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TMXTiledMap_setMapOrientation : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TMXTiledMap_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 1) {
|
|
std::string arg0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TMXTiledMap_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::TMXTiledMap::create(arg0);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TMXTiledMap>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::TMXTiledMap"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_TMXTiledMap_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_TMXTiledMap_createWithXML(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 2) {
|
|
std::string arg0;
|
|
std::string arg1;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TMXTiledMap_createWithXML : Error processing arguments");
|
|
|
|
auto ret = cocos2d::TMXTiledMap::createWithXML(arg0, arg1);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TMXTiledMap>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::TMXTiledMap"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_TMXTiledMap_createWithXML : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_TMXTiledMap_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::TMXTiledMap* cobj = new (std::nothrow) cocos2d::TMXTiledMap();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TMXTiledMap>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::TMXTiledMap"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_TMXTiledMap_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::TMXTiledMap *nobj = new (std::nothrow) cocos2d::TMXTiledMap();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::TMXTiledMap");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_Node_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_TMXTiledMap(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_TMXTiledMap_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_TMXTiledMap_class->name = "TMXTiledMap";
|
|
jsb_cocos2d_TMXTiledMap_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TMXTiledMap_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_TMXTiledMap_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TMXTiledMap_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_TMXTiledMap_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_TMXTiledMap_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_TMXTiledMap_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_TMXTiledMap_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("setObjectGroups", js_cocos2dx_TMXTiledMap_setObjectGroups, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getProperty", js_cocos2dx_TMXTiledMap_getProperty, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getLayerNum", js_cocos2dx_TMXTiledMap_getLayerNum, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setMapSize", js_cocos2dx_TMXTiledMap_setMapSize, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getObjectGroup", js_cocos2dx_TMXTiledMap_getObjectGroup, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getObjectGroups", js_cocos2dx_TMXTiledMap_getObjectGroups, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getResourceFile", js_cocos2dx_TMXTiledMap_getResourceFile, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initWithTMXFile", js_cocos2dx_TMXTiledMap_initWithTMXFile, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getTileSize", js_cocos2dx_TMXTiledMap_getTileSize, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getMapSize", js_cocos2dx_TMXTiledMap_getMapSize, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("initWithXML", js_cocos2dx_TMXTiledMap_initWithXML, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getProperties", js_cocos2dx_TMXTiledMap_getProperties, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getPropertiesForGID", js_cocos2dx_TMXTiledMap_getPropertiesForGID, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setTileSize", js_cocos2dx_TMXTiledMap_setTileSize, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setProperties", js_cocos2dx_TMXTiledMap_setProperties, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getLayer", js_cocos2dx_TMXTiledMap_getLayer, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getMapOrientation", js_cocos2dx_TMXTiledMap_getMapOrientation, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setMapOrientation", js_cocos2dx_TMXTiledMap_setMapOrientation, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_TMXTiledMap_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_TMXTiledMap_create, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("createWithXML", js_cocos2dx_TMXTiledMap_createWithXML, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_Node_prototype);
|
|
jsb_cocos2d_TMXTiledMap_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_TMXTiledMap_class,
|
|
js_cocos2dx_TMXTiledMap_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_TMXTiledMap_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "TMXTiledMap"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::TMXTiledMap>(cx, jsb_cocos2d_TMXTiledMap_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.TMXTiledMap.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_TileMapAtlas_class;
|
|
JSObject *jsb_cocos2d_TileMapAtlas_prototype;
|
|
|
|
bool js_cocos2dx_TileMapAtlas_initWithTileFile(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TileMapAtlas* cobj = (cocos2d::TileMapAtlas *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TileMapAtlas_initWithTileFile : Invalid Native Object");
|
|
if (argc == 4) {
|
|
std::string arg0;
|
|
std::string arg1;
|
|
int arg2 = 0;
|
|
int arg3 = 0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
|
ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2);
|
|
ok &= jsval_to_int32(cx, args.get(3), (int32_t *)&arg3);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TileMapAtlas_initWithTileFile : Error processing arguments");
|
|
bool ret = cobj->initWithTileFile(arg0, arg1, arg2, arg3);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TileMapAtlas_initWithTileFile : wrong number of arguments: %d, was expecting %d", argc, 4);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TileMapAtlas_releaseMap(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TileMapAtlas* cobj = (cocos2d::TileMapAtlas *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TileMapAtlas_releaseMap : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->releaseMap();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TileMapAtlas_releaseMap : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TileMapAtlas_getTGAInfo(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TileMapAtlas* cobj = (cocos2d::TileMapAtlas *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TileMapAtlas_getTGAInfo : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cocos2d::sImageTGA* ret = cobj->getTGAInfo();
|
|
jsval jsret = JSVAL_NULL;
|
|
#pragma warning NO CONVERSION FROM NATIVE FOR sImageTGA*;
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TileMapAtlas_getTGAInfo : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TileMapAtlas_getTileAt(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TileMapAtlas* cobj = (cocos2d::TileMapAtlas *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TileMapAtlas_getTileAt : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::Vec2 arg0;
|
|
ok &= jsval_to_vector2(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TileMapAtlas_getTileAt : Error processing arguments");
|
|
cocos2d::Color3B ret = cobj->getTileAt(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = cccolor3b_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TileMapAtlas_getTileAt : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TileMapAtlas_setTile(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TileMapAtlas* cobj = (cocos2d::TileMapAtlas *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TileMapAtlas_setTile : Invalid Native Object");
|
|
if (argc == 2) {
|
|
cocos2d::Color3B arg0;
|
|
cocos2d::Vec2 arg1;
|
|
ok &= jsval_to_cccolor3b(cx, args.get(0), &arg0);
|
|
ok &= jsval_to_vector2(cx, args.get(1), &arg1);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TileMapAtlas_setTile : Error processing arguments");
|
|
cobj->setTile(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TileMapAtlas_setTile : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TileMapAtlas_setTGAInfo(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
cocos2d::TileMapAtlas* cobj = (cocos2d::TileMapAtlas *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TileMapAtlas_setTGAInfo : Invalid Native Object");
|
|
if (argc == 1) {
|
|
cocos2d::sImageTGA* arg0 = nullptr;
|
|
#pragma warning NO CONVERSION TO NATIVE FOR sImageTGA*
|
|
ok = false;
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TileMapAtlas_setTGAInfo : Error processing arguments");
|
|
cobj->setTGAInfo(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_TileMapAtlas_setTGAInfo : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_TileMapAtlas_create(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
if (argc == 4) {
|
|
std::string arg0;
|
|
std::string arg1;
|
|
int arg2 = 0;
|
|
int arg3 = 0;
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
|
ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2);
|
|
ok &= jsval_to_int32(cx, args.get(3), (int32_t *)&arg3);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TileMapAtlas_create : Error processing arguments");
|
|
|
|
auto ret = cocos2d::TileMapAtlas::create(arg0, arg1, arg2, arg3);
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TileMapAtlas>(ret);
|
|
JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::TileMapAtlas"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsret));
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_TileMapAtlas_create : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_TileMapAtlas_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
cocos2d::TileMapAtlas* cobj = new (std::nothrow) cocos2d::TileMapAtlas();
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::TileMapAtlas>(cobj);
|
|
|
|
// link the native object with the javascript object
|
|
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::TileMapAtlas"));
|
|
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
|
if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args);
|
|
return true;
|
|
}
|
|
static bool js_cocos2dx_TileMapAtlas_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
cocos2d::TileMapAtlas *nobj = new (std::nothrow) cocos2d::TileMapAtlas();
|
|
auto newproxy = jsb_new_proxy(nobj, obj);
|
|
jsb_ref_init(cx, &newproxy->obj, nobj, "cocos2d::TileMapAtlas");
|
|
bool isFound = false;
|
|
if (JS_HasProperty(cx, obj, "_ctor", &isFound) && isFound)
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_AtlasNode_prototype;
|
|
|
|
|
|
void js_register_cocos2dx_TileMapAtlas(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_TileMapAtlas_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_TileMapAtlas_class->name = "TileMapAtlas";
|
|
jsb_cocos2d_TileMapAtlas_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TileMapAtlas_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_TileMapAtlas_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_TileMapAtlas_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_TileMapAtlas_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_TileMapAtlas_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_TileMapAtlas_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_TileMapAtlas_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("initWithTileFile", js_cocos2dx_TileMapAtlas_initWithTileFile, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("releaseMap", js_cocos2dx_TileMapAtlas_releaseMap, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getTGAInfo", js_cocos2dx_TileMapAtlas_getTGAInfo, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getTileAt", js_cocos2dx_TileMapAtlas_getTileAt, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setTile", js_cocos2dx_TileMapAtlas_setTile, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setTGAInfo", js_cocos2dx_TileMapAtlas_setTGAInfo, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("ctor", js_cocos2dx_TileMapAtlas_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("create", js_cocos2dx_TileMapAtlas_create, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_AtlasNode_prototype);
|
|
jsb_cocos2d_TileMapAtlas_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_TileMapAtlas_class,
|
|
js_cocos2dx_TileMapAtlas_constructor, 0, // constructor
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_TileMapAtlas_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "TileMapAtlas"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::TileMapAtlas>(cx, jsb_cocos2d_TileMapAtlas_class, proto, parent_proto);
|
|
anonEvaluate(cx, global, "(function () { cc.TileMapAtlas.extend = cc.Class.extend; })()");
|
|
}
|
|
|
|
JSClass *jsb_CocosDenshion_SimpleAudioEngine_class;
|
|
JSObject *jsb_CocosDenshion_SimpleAudioEngine_prototype;
|
|
|
|
bool js_cocos2dx_SimpleAudioEngine_preloadBackgroundMusic(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
CocosDenshion::SimpleAudioEngine* cobj = (CocosDenshion::SimpleAudioEngine *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SimpleAudioEngine_preloadBackgroundMusic : Invalid Native Object");
|
|
if (argc == 1) {
|
|
const char* arg0 = nullptr;
|
|
std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str();
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SimpleAudioEngine_preloadBackgroundMusic : Error processing arguments");
|
|
cobj->preloadBackgroundMusic(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SimpleAudioEngine_preloadBackgroundMusic : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SimpleAudioEngine_stopBackgroundMusic(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
CocosDenshion::SimpleAudioEngine* cobj = (CocosDenshion::SimpleAudioEngine *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SimpleAudioEngine_stopBackgroundMusic : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->stopBackgroundMusic();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
if (argc == 1) {
|
|
bool arg0;
|
|
arg0 = JS::ToBoolean(args.get(0));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SimpleAudioEngine_stopBackgroundMusic : Error processing arguments");
|
|
cobj->stopBackgroundMusic(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SimpleAudioEngine_stopBackgroundMusic : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SimpleAudioEngine_stopAllEffects(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
CocosDenshion::SimpleAudioEngine* cobj = (CocosDenshion::SimpleAudioEngine *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SimpleAudioEngine_stopAllEffects : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->stopAllEffects();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SimpleAudioEngine_stopAllEffects : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SimpleAudioEngine_getBackgroundMusicVolume(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
CocosDenshion::SimpleAudioEngine* cobj = (CocosDenshion::SimpleAudioEngine *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SimpleAudioEngine_getBackgroundMusicVolume : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getBackgroundMusicVolume();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SimpleAudioEngine_getBackgroundMusicVolume : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SimpleAudioEngine_resumeBackgroundMusic(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
CocosDenshion::SimpleAudioEngine* cobj = (CocosDenshion::SimpleAudioEngine *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SimpleAudioEngine_resumeBackgroundMusic : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->resumeBackgroundMusic();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SimpleAudioEngine_resumeBackgroundMusic : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SimpleAudioEngine_setBackgroundMusicVolume(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
CocosDenshion::SimpleAudioEngine* cobj = (CocosDenshion::SimpleAudioEngine *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SimpleAudioEngine_setBackgroundMusicVolume : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SimpleAudioEngine_setBackgroundMusicVolume : Error processing arguments");
|
|
cobj->setBackgroundMusicVolume(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SimpleAudioEngine_setBackgroundMusicVolume : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SimpleAudioEngine_preloadEffect(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
CocosDenshion::SimpleAudioEngine* cobj = (CocosDenshion::SimpleAudioEngine *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SimpleAudioEngine_preloadEffect : Invalid Native Object");
|
|
if (argc == 1) {
|
|
const char* arg0 = nullptr;
|
|
std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str();
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SimpleAudioEngine_preloadEffect : Error processing arguments");
|
|
cobj->preloadEffect(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SimpleAudioEngine_preloadEffect : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SimpleAudioEngine_isBackgroundMusicPlaying(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
CocosDenshion::SimpleAudioEngine* cobj = (CocosDenshion::SimpleAudioEngine *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SimpleAudioEngine_isBackgroundMusicPlaying : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->isBackgroundMusicPlaying();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SimpleAudioEngine_isBackgroundMusicPlaying : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SimpleAudioEngine_getEffectsVolume(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
CocosDenshion::SimpleAudioEngine* cobj = (CocosDenshion::SimpleAudioEngine *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SimpleAudioEngine_getEffectsVolume : Invalid Native Object");
|
|
if (argc == 0) {
|
|
double ret = cobj->getEffectsVolume();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = DOUBLE_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SimpleAudioEngine_getEffectsVolume : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SimpleAudioEngine_willPlayBackgroundMusic(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
CocosDenshion::SimpleAudioEngine* cobj = (CocosDenshion::SimpleAudioEngine *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SimpleAudioEngine_willPlayBackgroundMusic : Invalid Native Object");
|
|
if (argc == 0) {
|
|
bool ret = cobj->willPlayBackgroundMusic();
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SimpleAudioEngine_willPlayBackgroundMusic : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SimpleAudioEngine_pauseEffect(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
CocosDenshion::SimpleAudioEngine* cobj = (CocosDenshion::SimpleAudioEngine *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SimpleAudioEngine_pauseEffect : Invalid Native Object");
|
|
if (argc == 1) {
|
|
unsigned int arg0 = 0;
|
|
ok &= jsval_to_uint32(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SimpleAudioEngine_pauseEffect : Error processing arguments");
|
|
cobj->pauseEffect(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SimpleAudioEngine_pauseEffect : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SimpleAudioEngine_playEffect(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
CocosDenshion::SimpleAudioEngine* cobj = (CocosDenshion::SimpleAudioEngine *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SimpleAudioEngine_playEffect : Invalid Native Object");
|
|
if (argc == 1) {
|
|
const char* arg0 = nullptr;
|
|
std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str();
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SimpleAudioEngine_playEffect : Error processing arguments");
|
|
unsigned int ret = cobj->playEffect(arg0);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = uint32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
if (argc == 2) {
|
|
const char* arg0 = nullptr;
|
|
bool arg1;
|
|
std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str();
|
|
arg1 = JS::ToBoolean(args.get(1));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SimpleAudioEngine_playEffect : Error processing arguments");
|
|
unsigned int ret = cobj->playEffect(arg0, arg1);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = uint32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
if (argc == 3) {
|
|
const char* arg0 = nullptr;
|
|
bool arg1;
|
|
double arg2 = 0;
|
|
std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str();
|
|
arg1 = JS::ToBoolean(args.get(1));
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SimpleAudioEngine_playEffect : Error processing arguments");
|
|
unsigned int ret = cobj->playEffect(arg0, arg1, arg2);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = uint32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
if (argc == 4) {
|
|
const char* arg0 = nullptr;
|
|
bool arg1;
|
|
double arg2 = 0;
|
|
double arg3 = 0;
|
|
std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str();
|
|
arg1 = JS::ToBoolean(args.get(1));
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
ok &= JS::ToNumber( cx, args.get(3), &arg3) && !std::isnan(arg3);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SimpleAudioEngine_playEffect : Error processing arguments");
|
|
unsigned int ret = cobj->playEffect(arg0, arg1, arg2, arg3);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = uint32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
if (argc == 5) {
|
|
const char* arg0 = nullptr;
|
|
bool arg1;
|
|
double arg2 = 0;
|
|
double arg3 = 0;
|
|
double arg4 = 0;
|
|
std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str();
|
|
arg1 = JS::ToBoolean(args.get(1));
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
|
ok &= JS::ToNumber( cx, args.get(3), &arg3) && !std::isnan(arg3);
|
|
ok &= JS::ToNumber( cx, args.get(4), &arg4) && !std::isnan(arg4);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SimpleAudioEngine_playEffect : Error processing arguments");
|
|
unsigned int ret = cobj->playEffect(arg0, arg1, arg2, arg3, arg4);
|
|
jsval jsret = JSVAL_NULL;
|
|
jsret = uint32_to_jsval(cx, ret);
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SimpleAudioEngine_playEffect : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SimpleAudioEngine_rewindBackgroundMusic(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
CocosDenshion::SimpleAudioEngine* cobj = (CocosDenshion::SimpleAudioEngine *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SimpleAudioEngine_rewindBackgroundMusic : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->rewindBackgroundMusic();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SimpleAudioEngine_rewindBackgroundMusic : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SimpleAudioEngine_playBackgroundMusic(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
CocosDenshion::SimpleAudioEngine* cobj = (CocosDenshion::SimpleAudioEngine *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SimpleAudioEngine_playBackgroundMusic : Invalid Native Object");
|
|
if (argc == 1) {
|
|
const char* arg0 = nullptr;
|
|
std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str();
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SimpleAudioEngine_playBackgroundMusic : Error processing arguments");
|
|
cobj->playBackgroundMusic(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
if (argc == 2) {
|
|
const char* arg0 = nullptr;
|
|
bool arg1;
|
|
std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str();
|
|
arg1 = JS::ToBoolean(args.get(1));
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SimpleAudioEngine_playBackgroundMusic : Error processing arguments");
|
|
cobj->playBackgroundMusic(arg0, arg1);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SimpleAudioEngine_playBackgroundMusic : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SimpleAudioEngine_resumeAllEffects(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
CocosDenshion::SimpleAudioEngine* cobj = (CocosDenshion::SimpleAudioEngine *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SimpleAudioEngine_resumeAllEffects : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->resumeAllEffects();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SimpleAudioEngine_resumeAllEffects : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SimpleAudioEngine_setEffectsVolume(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
CocosDenshion::SimpleAudioEngine* cobj = (CocosDenshion::SimpleAudioEngine *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SimpleAudioEngine_setEffectsVolume : Invalid Native Object");
|
|
if (argc == 1) {
|
|
double arg0 = 0;
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SimpleAudioEngine_setEffectsVolume : Error processing arguments");
|
|
cobj->setEffectsVolume(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SimpleAudioEngine_setEffectsVolume : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SimpleAudioEngine_stopEffect(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
CocosDenshion::SimpleAudioEngine* cobj = (CocosDenshion::SimpleAudioEngine *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SimpleAudioEngine_stopEffect : Invalid Native Object");
|
|
if (argc == 1) {
|
|
unsigned int arg0 = 0;
|
|
ok &= jsval_to_uint32(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SimpleAudioEngine_stopEffect : Error processing arguments");
|
|
cobj->stopEffect(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SimpleAudioEngine_stopEffect : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SimpleAudioEngine_pauseBackgroundMusic(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
CocosDenshion::SimpleAudioEngine* cobj = (CocosDenshion::SimpleAudioEngine *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SimpleAudioEngine_pauseBackgroundMusic : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->pauseBackgroundMusic();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SimpleAudioEngine_pauseBackgroundMusic : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SimpleAudioEngine_pauseAllEffects(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
CocosDenshion::SimpleAudioEngine* cobj = (CocosDenshion::SimpleAudioEngine *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SimpleAudioEngine_pauseAllEffects : Invalid Native Object");
|
|
if (argc == 0) {
|
|
cobj->pauseAllEffects();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SimpleAudioEngine_pauseAllEffects : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SimpleAudioEngine_unloadEffect(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
CocosDenshion::SimpleAudioEngine* cobj = (CocosDenshion::SimpleAudioEngine *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SimpleAudioEngine_unloadEffect : Invalid Native Object");
|
|
if (argc == 1) {
|
|
const char* arg0 = nullptr;
|
|
std::string arg0_tmp; ok &= jsval_to_std_string(cx, args.get(0), &arg0_tmp); arg0 = arg0_tmp.c_str();
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SimpleAudioEngine_unloadEffect : Error processing arguments");
|
|
cobj->unloadEffect(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SimpleAudioEngine_unloadEffect : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SimpleAudioEngine_resumeEffect(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
bool ok = true;
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
CocosDenshion::SimpleAudioEngine* cobj = (CocosDenshion::SimpleAudioEngine *)(proxy ? proxy->ptr : NULL);
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SimpleAudioEngine_resumeEffect : Invalid Native Object");
|
|
if (argc == 1) {
|
|
unsigned int arg0 = 0;
|
|
ok &= jsval_to_uint32(cx, args.get(0), &arg0);
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SimpleAudioEngine_resumeEffect : Error processing arguments");
|
|
cobj->resumeEffect(arg0);
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_SimpleAudioEngine_resumeEffect : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
return false;
|
|
}
|
|
bool js_cocos2dx_SimpleAudioEngine_end(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
if (argc == 0) {
|
|
CocosDenshion::SimpleAudioEngine::end();
|
|
args.rval().setUndefined();
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_SimpleAudioEngine_end : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
bool js_cocos2dx_SimpleAudioEngine_getInstance(JSContext *cx, uint32_t argc, jsval *vp)
|
|
{
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
if (argc == 0) {
|
|
|
|
CocosDenshion::SimpleAudioEngine* ret = CocosDenshion::SimpleAudioEngine::getInstance();
|
|
jsval jsret = JSVAL_NULL;
|
|
if (ret) {
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<CocosDenshion::SimpleAudioEngine>(cx, (CocosDenshion::SimpleAudioEngine*)ret));
|
|
} else {
|
|
jsret = JSVAL_NULL;
|
|
};
|
|
args.rval().set(jsret);
|
|
return true;
|
|
}
|
|
JS_ReportError(cx, "js_cocos2dx_SimpleAudioEngine_getInstance : wrong number of arguments");
|
|
return false;
|
|
}
|
|
|
|
|
|
void js_register_cocos2dx_SimpleAudioEngine(JSContext *cx, JS::HandleObject global) {
|
|
jsb_CocosDenshion_SimpleAudioEngine_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_CocosDenshion_SimpleAudioEngine_class->name = "AudioEngine";
|
|
jsb_CocosDenshion_SimpleAudioEngine_class->addProperty = JS_PropertyStub;
|
|
jsb_CocosDenshion_SimpleAudioEngine_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_CocosDenshion_SimpleAudioEngine_class->getProperty = JS_PropertyStub;
|
|
jsb_CocosDenshion_SimpleAudioEngine_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_CocosDenshion_SimpleAudioEngine_class->enumerate = JS_EnumerateStub;
|
|
jsb_CocosDenshion_SimpleAudioEngine_class->resolve = JS_ResolveStub;
|
|
jsb_CocosDenshion_SimpleAudioEngine_class->convert = JS_ConvertStub;
|
|
jsb_CocosDenshion_SimpleAudioEngine_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FN("preloadMusic", js_cocos2dx_SimpleAudioEngine_preloadBackgroundMusic, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("stopMusic", js_cocos2dx_SimpleAudioEngine_stopBackgroundMusic, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("stopAllEffects", js_cocos2dx_SimpleAudioEngine_stopAllEffects, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getMusicVolume", js_cocos2dx_SimpleAudioEngine_getBackgroundMusicVolume, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("resumeMusic", js_cocos2dx_SimpleAudioEngine_resumeBackgroundMusic, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setMusicVolume", js_cocos2dx_SimpleAudioEngine_setBackgroundMusicVolume, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("preloadEffect", js_cocos2dx_SimpleAudioEngine_preloadEffect, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("isMusicPlaying", js_cocos2dx_SimpleAudioEngine_isBackgroundMusicPlaying, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getEffectsVolume", js_cocos2dx_SimpleAudioEngine_getEffectsVolume, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("willPlayMusic", js_cocos2dx_SimpleAudioEngine_willPlayBackgroundMusic, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("pauseEffect", js_cocos2dx_SimpleAudioEngine_pauseEffect, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("playEffect", js_cocos2dx_SimpleAudioEngine_playEffect, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("rewindMusic", js_cocos2dx_SimpleAudioEngine_rewindBackgroundMusic, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("playMusic", js_cocos2dx_SimpleAudioEngine_playBackgroundMusic, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("resumeAllEffects", js_cocos2dx_SimpleAudioEngine_resumeAllEffects, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("setEffectsVolume", js_cocos2dx_SimpleAudioEngine_setEffectsVolume, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("stopEffect", js_cocos2dx_SimpleAudioEngine_stopEffect, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("pauseMusic", js_cocos2dx_SimpleAudioEngine_pauseBackgroundMusic, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("pauseAllEffects", js_cocos2dx_SimpleAudioEngine_pauseAllEffects, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("unloadEffect", js_cocos2dx_SimpleAudioEngine_unloadEffect, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("resumeEffect", js_cocos2dx_SimpleAudioEngine_resumeEffect, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
JS_FN("end", js_cocos2dx_SimpleAudioEngine_end, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FN("getInstance", js_cocos2dx_SimpleAudioEngine_getInstance, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
JS_FS_END
|
|
};
|
|
|
|
jsb_CocosDenshion_SimpleAudioEngine_prototype = JS_InitClass(
|
|
cx, global,
|
|
JS::NullPtr(),
|
|
jsb_CocosDenshion_SimpleAudioEngine_class,
|
|
empty_constructor, 0,
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_CocosDenshion_SimpleAudioEngine_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "SimpleAudioEngine"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::FalseHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<CocosDenshion::SimpleAudioEngine>(cx, jsb_CocosDenshion_SimpleAudioEngine_class, proto, JS::NullPtr());
|
|
}
|
|
|
|
JSClass *jsb_cocos2d_ComponentJS_class;
|
|
JSObject *jsb_cocos2d_ComponentJS_prototype;
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_Component_prototype;
|
|
|
|
void js_register_cocos2dx_ComponentJS(JSContext *cx, JS::HandleObject global) {
|
|
jsb_cocos2d_ComponentJS_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
jsb_cocos2d_ComponentJS_class->name = "ComponentJS";
|
|
jsb_cocos2d_ComponentJS_class->addProperty = JS_PropertyStub;
|
|
jsb_cocos2d_ComponentJS_class->delProperty = JS_DeletePropertyStub;
|
|
jsb_cocos2d_ComponentJS_class->getProperty = JS_PropertyStub;
|
|
jsb_cocos2d_ComponentJS_class->setProperty = JS_StrictPropertyStub;
|
|
jsb_cocos2d_ComponentJS_class->enumerate = JS_EnumerateStub;
|
|
jsb_cocos2d_ComponentJS_class->resolve = JS_ResolveStub;
|
|
jsb_cocos2d_ComponentJS_class->convert = JS_ConvertStub;
|
|
jsb_cocos2d_ComponentJS_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
static JSPropertySpec properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
JS_FS_END
|
|
};
|
|
|
|
JSFunctionSpec *st_funcs = NULL;
|
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_Component_prototype);
|
|
jsb_cocos2d_ComponentJS_prototype = JS_InitClass(
|
|
cx, global,
|
|
parent_proto,
|
|
jsb_cocos2d_ComponentJS_class,
|
|
empty_constructor, 0,
|
|
properties,
|
|
funcs,
|
|
NULL, // no static properties
|
|
st_funcs);
|
|
|
|
JS::RootedObject proto(cx, jsb_cocos2d_ComponentJS_prototype);
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "ComponentJS"));
|
|
JS_SetProperty(cx, proto, "_className", className);
|
|
JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
|
|
JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue);
|
|
// add the proto and JSClass to the type->js info hash table
|
|
jsb_register_class<cocos2d::ComponentJS>(cx, jsb_cocos2d_ComponentJS_class, proto, parent_proto);
|
|
}
|
|
|
|
void register_all_cocos2dx(JSContext* cx, JS::HandleObject obj) {
|
|
// Get the ns
|
|
JS::RootedObject ns(cx);
|
|
get_or_create_js_obj(cx, obj, "cc", &ns);
|
|
|
|
js_register_cocos2dx_RenderState(cx, ns);
|
|
js_register_cocos2dx_Material(cx, ns);
|
|
js_register_cocos2dx_Action(cx, ns);
|
|
js_register_cocos2dx_FiniteTimeAction(cx, ns);
|
|
js_register_cocos2dx_ActionInstant(cx, ns);
|
|
js_register_cocos2dx_Hide(cx, ns);
|
|
js_register_cocos2dx_Node(cx, ns);
|
|
js_register_cocos2dx_Scene(cx, ns);
|
|
js_register_cocos2dx_TransitionScene(cx, ns);
|
|
js_register_cocos2dx_TransitionEaseScene(cx, ns);
|
|
js_register_cocos2dx_TransitionMoveInL(cx, ns);
|
|
js_register_cocos2dx_TransitionMoveInB(cx, ns);
|
|
js_register_cocos2dx_Layer(cx, ns);
|
|
js_register_cocos2dx___LayerRGBA(cx, ns);
|
|
js_register_cocos2dx_AtlasNode(cx, ns);
|
|
js_register_cocos2dx_TileMapAtlas(cx, ns);
|
|
js_register_cocos2dx_TransitionMoveInT(cx, ns);
|
|
js_register_cocos2dx_TMXTilesetInfo(cx, ns);
|
|
js_register_cocos2dx_TransitionMoveInR(cx, ns);
|
|
js_register_cocos2dx_ParticleSystem(cx, ns);
|
|
js_register_cocos2dx_ParticleSystemQuad(cx, ns);
|
|
js_register_cocos2dx_ParticleSpiral(cx, ns);
|
|
js_register_cocos2dx_GridBase(cx, ns);
|
|
js_register_cocos2dx_AnimationCache(cx, ns);
|
|
js_register_cocos2dx_ActionInterval(cx, ns);
|
|
js_register_cocos2dx_ActionCamera(cx, ns);
|
|
js_register_cocos2dx_ProgressFromTo(cx, ns);
|
|
js_register_cocos2dx_MoveBy(cx, ns);
|
|
js_register_cocos2dx_MoveTo(cx, ns);
|
|
js_register_cocos2dx_JumpBy(cx, ns);
|
|
js_register_cocos2dx_EventListener(cx, ns);
|
|
js_register_cocos2dx_EventListenerKeyboard(cx, ns);
|
|
js_register_cocos2dx_ActionEase(cx, ns);
|
|
js_register_cocos2dx_EaseBounceIn(cx, ns);
|
|
js_register_cocos2dx_ComponentContainer(cx, ns);
|
|
js_register_cocos2dx_Director(cx, ns);
|
|
js_register_cocos2dx_Scheduler(cx, ns);
|
|
js_register_cocos2dx_EaseElastic(cx, ns);
|
|
js_register_cocos2dx_EaseElasticOut(cx, ns);
|
|
js_register_cocos2dx_EaseQuadraticActionInOut(cx, ns);
|
|
js_register_cocos2dx_EaseBackOut(cx, ns);
|
|
js_register_cocos2dx_Texture2D(cx, ns);
|
|
js_register_cocos2dx_TransitionSceneOriented(cx, ns);
|
|
js_register_cocos2dx_TransitionFlipX(cx, ns);
|
|
js_register_cocos2dx_CameraBackgroundBrush(cx, ns);
|
|
js_register_cocos2dx_CameraBackgroundDepthBrush(cx, ns);
|
|
js_register_cocos2dx_CameraBackgroundColorBrush(cx, ns);
|
|
js_register_cocos2dx_GridAction(cx, ns);
|
|
js_register_cocos2dx_TiledGrid3DAction(cx, ns);
|
|
js_register_cocos2dx_FadeOutTRTiles(cx, ns);
|
|
js_register_cocos2dx_FadeOutUpTiles(cx, ns);
|
|
js_register_cocos2dx_FadeOutDownTiles(cx, ns);
|
|
js_register_cocos2dx_StopGrid(cx, ns);
|
|
js_register_cocos2dx_Technique(cx, ns);
|
|
js_register_cocos2dx_SkewTo(cx, ns);
|
|
js_register_cocos2dx_SkewBy(cx, ns);
|
|
js_register_cocos2dx_EaseQuadraticActionOut(cx, ns);
|
|
js_register_cocos2dx_TransitionProgress(cx, ns);
|
|
js_register_cocos2dx_TransitionProgressVertical(cx, ns);
|
|
js_register_cocos2dx_TMXTiledMap(cx, ns);
|
|
js_register_cocos2dx_Grid3DAction(cx, ns);
|
|
js_register_cocos2dx_BaseLight(cx, ns);
|
|
js_register_cocos2dx_SpotLight(cx, ns);
|
|
js_register_cocos2dx_FadeTo(cx, ns);
|
|
js_register_cocos2dx_FadeIn(cx, ns);
|
|
js_register_cocos2dx_DirectionLight(cx, ns);
|
|
js_register_cocos2dx_ShakyTiles3D(cx, ns);
|
|
js_register_cocos2dx_EventListenerCustom(cx, ns);
|
|
js_register_cocos2dx_FlipX3D(cx, ns);
|
|
js_register_cocos2dx_FlipY3D(cx, ns);
|
|
js_register_cocos2dx_EaseSineInOut(cx, ns);
|
|
js_register_cocos2dx_TransitionFlipAngular(cx, ns);
|
|
js_register_cocos2dx_SimpleAudioEngine(cx, ns);
|
|
js_register_cocos2dx_EaseElasticInOut(cx, ns);
|
|
js_register_cocos2dx_EaseBounce(cx, ns);
|
|
js_register_cocos2dx_Show(cx, ns);
|
|
js_register_cocos2dx_FadeOut(cx, ns);
|
|
js_register_cocos2dx_CallFunc(cx, ns);
|
|
js_register_cocos2dx_Event(cx, ns);
|
|
js_register_cocos2dx_EventMouse(cx, ns);
|
|
js_register_cocos2dx_GLView(cx, ns);
|
|
js_register_cocos2dx_EaseBezierAction(cx, ns);
|
|
js_register_cocos2dx_ParticleFireworks(cx, ns);
|
|
js_register_cocos2dx_MenuItem(cx, ns);
|
|
js_register_cocos2dx_MenuItemSprite(cx, ns);
|
|
js_register_cocos2dx_MenuItemImage(cx, ns);
|
|
js_register_cocos2dx_ParticleFire(cx, ns);
|
|
js_register_cocos2dx_ProgressTo(cx, ns);
|
|
js_register_cocos2dx_ParticleSmoke(cx, ns);
|
|
js_register_cocos2dx_TransitionZoomFlipAngular(cx, ns);
|
|
js_register_cocos2dx_EaseRateAction(cx, ns);
|
|
js_register_cocos2dx_EaseIn(cx, ns);
|
|
js_register_cocos2dx_EaseExponentialInOut(cx, ns);
|
|
js_register_cocos2dx_CardinalSplineTo(cx, ns);
|
|
js_register_cocos2dx_CatmullRomTo(cx, ns);
|
|
js_register_cocos2dx_Waves3D(cx, ns);
|
|
js_register_cocos2dx_EaseExponentialOut(cx, ns);
|
|
js_register_cocos2dx_Label(cx, ns);
|
|
js_register_cocos2dx_Application(cx, ns);
|
|
js_register_cocos2dx_DelayTime(cx, ns);
|
|
js_register_cocos2dx_LabelAtlas(cx, ns);
|
|
js_register_cocos2dx_LabelBMFont(cx, ns);
|
|
js_register_cocos2dx_AsyncTaskPool(cx, ns);
|
|
js_register_cocos2dx_ParticleSnow(cx, ns);
|
|
js_register_cocos2dx_EaseElasticIn(cx, ns);
|
|
js_register_cocos2dx_EaseCircleActionInOut(cx, ns);
|
|
js_register_cocos2dx_TransitionFadeTR(cx, ns);
|
|
js_register_cocos2dx_EaseQuarticActionOut(cx, ns);
|
|
js_register_cocos2dx_EventAcceleration(cx, ns);
|
|
js_register_cocos2dx_EaseCubicActionIn(cx, ns);
|
|
js_register_cocos2dx_TextureCache(cx, ns);
|
|
js_register_cocos2dx_SpriteBatchNode(cx, ns);
|
|
js_register_cocos2dx_TMXLayer(cx, ns);
|
|
js_register_cocos2dx_Configuration(cx, ns);
|
|
js_register_cocos2dx_ActionTween(cx, ns);
|
|
js_register_cocos2dx_TransitionFadeDown(cx, ns);
|
|
js_register_cocos2dx_ParticleSun(cx, ns);
|
|
js_register_cocos2dx_TransitionProgressHorizontal(cx, ns);
|
|
js_register_cocos2dx_TMXObjectGroup(cx, ns);
|
|
js_register_cocos2dx_CameraBackgroundSkyBoxBrush(cx, ns);
|
|
js_register_cocos2dx_FlipX(cx, ns);
|
|
js_register_cocos2dx_FlipY(cx, ns);
|
|
js_register_cocos2dx_TransitionSplitCols(cx, ns);
|
|
js_register_cocos2dx_RepeatForever(cx, ns);
|
|
js_register_cocos2dx_Place(cx, ns);
|
|
js_register_cocos2dx_EventListenerAcceleration(cx, ns);
|
|
js_register_cocos2dx_TiledGrid3D(cx, ns);
|
|
js_register_cocos2dx_EaseBounceOut(cx, ns);
|
|
js_register_cocos2dx_RenderTexture(cx, ns);
|
|
js_register_cocos2dx_TintBy(cx, ns);
|
|
js_register_cocos2dx_TransitionShrinkGrow(cx, ns);
|
|
js_register_cocos2dx_LabelTTF(cx, ns);
|
|
js_register_cocos2dx_ClippingNode(cx, ns);
|
|
js_register_cocos2dx_ActionFloat(cx, ns);
|
|
js_register_cocos2dx_ParticleFlower(cx, ns);
|
|
js_register_cocos2dx_EaseCircleActionIn(cx, ns);
|
|
js_register_cocos2dx_Image(cx, ns);
|
|
js_register_cocos2dx_LayerMultiplex(cx, ns);
|
|
js_register_cocos2dx_Blink(cx, ns);
|
|
js_register_cocos2dx_JumpTo(cx, ns);
|
|
js_register_cocos2dx_ParticleExplosion(cx, ns);
|
|
js_register_cocos2dx_TransitionJumpZoom(cx, ns);
|
|
js_register_cocos2dx_Pass(cx, ns);
|
|
js_register_cocos2dx_Touch(cx, ns);
|
|
js_register_cocos2dx_SAXParser(cx, ns);
|
|
js_register_cocos2dx_CardinalSplineBy(cx, ns);
|
|
js_register_cocos2dx_CatmullRomBy(cx, ns);
|
|
js_register_cocos2dx_NodeGrid(cx, ns);
|
|
js_register_cocos2dx_TMXLayerInfo(cx, ns);
|
|
js_register_cocos2dx_EaseSineIn(cx, ns);
|
|
js_register_cocos2dx_EventListenerMouse(cx, ns);
|
|
js_register_cocos2dx_Camera(cx, ns);
|
|
js_register_cocos2dx_GLProgram(cx, ns);
|
|
js_register_cocos2dx_ParticleGalaxy(cx, ns);
|
|
js_register_cocos2dx_Twirl(cx, ns);
|
|
js_register_cocos2dx_MenuItemLabel(cx, ns);
|
|
js_register_cocos2dx_EaseQuinticActionIn(cx, ns);
|
|
js_register_cocos2dx_LayerColor(cx, ns);
|
|
js_register_cocos2dx_FadeOutBLTiles(cx, ns);
|
|
js_register_cocos2dx_LayerGradient(cx, ns);
|
|
js_register_cocos2dx_EventListenerTouchAllAtOnce(cx, ns);
|
|
js_register_cocos2dx_ToggleVisibility(cx, ns);
|
|
js_register_cocos2dx_Repeat(cx, ns);
|
|
js_register_cocos2dx_TransitionFlipY(cx, ns);
|
|
js_register_cocos2dx_TurnOffTiles(cx, ns);
|
|
js_register_cocos2dx_TintTo(cx, ns);
|
|
js_register_cocos2dx_EaseBackInOut(cx, ns);
|
|
js_register_cocos2dx_TransitionFadeBL(cx, ns);
|
|
js_register_cocos2dx_TargetedAction(cx, ns);
|
|
js_register_cocos2dx_DrawNode(cx, ns);
|
|
js_register_cocos2dx_TransitionTurnOffTiles(cx, ns);
|
|
js_register_cocos2dx_RotateTo(cx, ns);
|
|
js_register_cocos2dx_TransitionSplitRows(cx, ns);
|
|
js_register_cocos2dx_Device(cx, ns);
|
|
js_register_cocos2dx_TransitionProgressRadialCCW(cx, ns);
|
|
js_register_cocos2dx_EventListenerFocus(cx, ns);
|
|
js_register_cocos2dx_TransitionPageTurn(cx, ns);
|
|
js_register_cocos2dx_Properties(cx, ns);
|
|
js_register_cocos2dx_BezierBy(cx, ns);
|
|
js_register_cocos2dx_BezierTo(cx, ns);
|
|
js_register_cocos2dx_ParticleMeteor(cx, ns);
|
|
js_register_cocos2dx_SpriteFrame(cx, ns);
|
|
js_register_cocos2dx_Liquid(cx, ns);
|
|
js_register_cocos2dx_ParticleBatchNode(cx, ns);
|
|
js_register_cocos2dx_TransitionZoomFlipX(cx, ns);
|
|
js_register_cocos2dx_EventFocus(cx, ns);
|
|
js_register_cocos2dx_Component(cx, ns);
|
|
js_register_cocos2dx_ComponentJS(cx, ns);
|
|
js_register_cocos2dx_EaseQuinticActionInOut(cx, ns);
|
|
js_register_cocos2dx_TransitionRotoZoom(cx, ns);
|
|
js_register_cocos2dx_SpriteFrameCache(cx, ns);
|
|
js_register_cocos2dx_PointLight(cx, ns);
|
|
js_register_cocos2dx_TransitionCrossFade(cx, ns);
|
|
js_register_cocos2dx_Ripple3D(cx, ns);
|
|
js_register_cocos2dx_Lens3D(cx, ns);
|
|
js_register_cocos2dx_ScaleTo(cx, ns);
|
|
js_register_cocos2dx_Spawn(cx, ns);
|
|
js_register_cocos2dx_EaseQuarticActionInOut(cx, ns);
|
|
js_register_cocos2dx_GLProgramState(cx, ns);
|
|
js_register_cocos2dx_PageTurn3D(cx, ns);
|
|
js_register_cocos2dx_TransitionSlideInL(cx, ns);
|
|
js_register_cocos2dx_TransitionSlideInT(cx, ns);
|
|
js_register_cocos2dx_Grid3D(cx, ns);
|
|
js_register_cocos2dx_EaseCircleActionOut(cx, ns);
|
|
js_register_cocos2dx_TransitionProgressInOut(cx, ns);
|
|
js_register_cocos2dx_EaseCubicActionInOut(cx, ns);
|
|
js_register_cocos2dx_ParticleData(cx, ns);
|
|
js_register_cocos2dx_EaseBackIn(cx, ns);
|
|
js_register_cocos2dx_SplitRows(cx, ns);
|
|
js_register_cocos2dx_Follow(cx, ns);
|
|
js_register_cocos2dx_Animate(cx, ns);
|
|
js_register_cocos2dx_ShuffleTiles(cx, ns);
|
|
js_register_cocos2dx_ReverseTime(cx, ns);
|
|
js_register_cocos2dx_ProgressTimer(cx, ns);
|
|
js_register_cocos2dx_EaseQuarticActionIn(cx, ns);
|
|
js_register_cocos2dx_Menu(cx, ns);
|
|
js_register_cocos2dx_EaseInOut(cx, ns);
|
|
js_register_cocos2dx_TransitionZoomFlipY(cx, ns);
|
|
js_register_cocos2dx_ScaleBy(cx, ns);
|
|
js_register_cocos2dx_EventTouch(cx, ns);
|
|
js_register_cocos2dx_Animation(cx, ns);
|
|
js_register_cocos2dx_TMXMapInfo(cx, ns);
|
|
js_register_cocos2dx_EaseExponentialIn(cx, ns);
|
|
js_register_cocos2dx_ReuseGrid(cx, ns);
|
|
js_register_cocos2dx_EaseQuinticActionOut(cx, ns);
|
|
js_register_cocos2dx_EventDispatcher(cx, ns);
|
|
js_register_cocos2dx_MenuItemAtlasFont(cx, ns);
|
|
js_register_cocos2dx_ActionManager(cx, ns);
|
|
js_register_cocos2dx_OrbitCamera(cx, ns);
|
|
js_register_cocos2dx_ParallaxNode(cx, ns);
|
|
js_register_cocos2dx_TransitionFade(cx, ns);
|
|
js_register_cocos2dx_EaseCubicActionOut(cx, ns);
|
|
js_register_cocos2dx_EventListenerTouchOneByOne(cx, ns);
|
|
js_register_cocos2dx_TextFieldTTF(cx, ns);
|
|
js_register_cocos2dx_ParticleRain(cx, ns);
|
|
js_register_cocos2dx_Waves(cx, ns);
|
|
js_register_cocos2dx_EaseOut(cx, ns);
|
|
js_register_cocos2dx_MenuItemFont(cx, ns);
|
|
js_register_cocos2dx_TransitionFadeUp(cx, ns);
|
|
js_register_cocos2dx_EaseSineOut(cx, ns);
|
|
js_register_cocos2dx_JumpTiles3D(cx, ns);
|
|
js_register_cocos2dx_MenuItemToggle(cx, ns);
|
|
js_register_cocos2dx_RemoveSelf(cx, ns);
|
|
js_register_cocos2dx_SplitCols(cx, ns);
|
|
js_register_cocos2dx_ProtectedNode(cx, ns);
|
|
js_register_cocos2dx_MotionStreak(cx, ns);
|
|
js_register_cocos2dx_RotateBy(cx, ns);
|
|
js_register_cocos2dx_FileUtils(cx, ns);
|
|
js_register_cocos2dx_Sprite(cx, ns);
|
|
js_register_cocos2dx_CallFuncN(cx, ns);
|
|
js_register_cocos2dx_TransitionProgressOutIn(cx, ns);
|
|
js_register_cocos2dx_AnimationFrame(cx, ns);
|
|
js_register_cocos2dx_Sequence(cx, ns);
|
|
js_register_cocos2dx_Shaky3D(cx, ns);
|
|
js_register_cocos2dx_TransitionProgressRadialCW(cx, ns);
|
|
js_register_cocos2dx_EaseBounceInOut(cx, ns);
|
|
js_register_cocos2dx_TransitionSlideInR(cx, ns);
|
|
js_register_cocos2dx___NodeRGBA(cx, ns);
|
|
js_register_cocos2dx_AmbientLight(cx, ns);
|
|
js_register_cocos2dx_GLProgramCache(cx, ns);
|
|
js_register_cocos2dx_EaseQuadraticActionIn(cx, ns);
|
|
js_register_cocos2dx_WavesTiles3D(cx, ns);
|
|
js_register_cocos2dx_TransitionSlideInB(cx, ns);
|
|
js_register_cocos2dx_Speed(cx, ns);
|
|
js_register_cocos2dx_EventCustom(cx, ns);
|
|
js_register_cocos2dx_ShatteredTiles3D(cx, ns);
|
|
}
|
|
|