2016-03-22 16:08:28 +08:00
|
|
|
#include "scripting/js-bindings/auto/jsb_cocos2dx_spine_auto.hpp"
|
|
|
|
#include "scripting/js-bindings/manual/cocos2d_specifics.hpp"
|
|
|
|
#include "editor-support/spine/spine-cocos2dx.h"
|
|
|
|
#include "scripting/js-bindings/manual/spine/jsb_cocos2dx_spine_manual.h"
|
2015-05-05 10:50:19 +08:00
|
|
|
|
|
|
|
template<class T>
|
2015-12-03 06:45:13 +08:00
|
|
|
static bool dummy_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
|
|
{
|
2015-05-05 10:50:19 +08:00
|
|
|
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);
|
2016-03-22 20:58:39 +08:00
|
|
|
return true;
|
2015-05-05 10:50:19 +08:00
|
|
|
}
|
|
|
|
JSClass *jsb_spine_SkeletonRenderer_class;
|
|
|
|
JSObject *jsb_spine_SkeletonRenderer_prototype;
|
|
|
|
|
|
|
|
bool js_cocos2dx_spine_SkeletonRenderer_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);
|
|
|
|
spine::SkeletonRenderer* cobj = (spine::SkeletonRenderer *)(proxy ? proxy->ptr : NULL);
|
|
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_spine_SkeletonRenderer_setTimeScale : Invalid Native Object");
|
|
|
|
if (argc == 1) {
|
2015-09-14 12:01:38 +08:00
|
|
|
double arg0 = 0;
|
2016-05-30 17:27:04 +08:00
|
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
2015-05-05 10:50:19 +08:00
|
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_spine_SkeletonRenderer_setTimeScale : Error processing arguments");
|
|
|
|
cobj->setTimeScale(arg0);
|
|
|
|
args.rval().setUndefined();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_spine_SkeletonRenderer_setTimeScale : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
bool js_cocos2dx_spine_SkeletonRenderer_getDebugSlotsEnabled(JSContext *cx, uint32_t argc, jsval *vp)
|
|
|
|
{
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
|
|
spine::SkeletonRenderer* cobj = (spine::SkeletonRenderer *)(proxy ? proxy->ptr : NULL);
|
|
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_spine_SkeletonRenderer_getDebugSlotsEnabled : Invalid Native Object");
|
|
|
|
if (argc == 0) {
|
|
|
|
bool ret = cobj->getDebugSlotsEnabled();
|
|
|
|
jsval jsret = JSVAL_NULL;
|
|
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
|
|
args.rval().set(jsret);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_spine_SkeletonRenderer_getDebugSlotsEnabled : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
bool js_cocos2dx_spine_SkeletonRenderer_setAttachment(JSContext *cx, uint32_t argc, jsval *vp)
|
|
|
|
{
|
|
|
|
bool ok = true;
|
2015-09-25 16:43:00 +08:00
|
|
|
spine::SkeletonRenderer* cobj = nullptr;
|
2015-05-05 10:50:19 +08:00
|
|
|
|
2015-09-25 16:43:00 +08:00
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
2015-05-05 10:50:19 +08:00
|
|
|
JS::RootedObject obj(cx);
|
2015-12-01 12:32:19 +08:00
|
|
|
obj.set(args.thisv().toObjectOrNull());
|
2015-05-05 10:50:19 +08:00
|
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
2015-09-25 16:43:00 +08:00
|
|
|
cobj = (spine::SkeletonRenderer *)(proxy ? proxy->ptr : nullptr);
|
2015-05-05 10:50:19 +08:00
|
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_spine_SkeletonRenderer_setAttachment : 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; }
|
2015-09-14 12:01:38 +08:00
|
|
|
const char* arg1 = nullptr;
|
2015-05-05 10:50:19 +08:00
|
|
|
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->setAttachment(arg0, arg1);
|
|
|
|
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->setAttachment(arg0, arg1);
|
|
|
|
jsval jsret = JSVAL_NULL;
|
|
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
|
|
args.rval().set(jsret);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
} while(0);
|
|
|
|
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_spine_SkeletonRenderer_setAttachment : wrong number of arguments");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
bool js_cocos2dx_spine_SkeletonRenderer_setBonesToSetupPose(JSContext *cx, uint32_t argc, jsval *vp)
|
|
|
|
{
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
|
|
spine::SkeletonRenderer* cobj = (spine::SkeletonRenderer *)(proxy ? proxy->ptr : NULL);
|
|
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_spine_SkeletonRenderer_setBonesToSetupPose : Invalid Native Object");
|
|
|
|
if (argc == 0) {
|
|
|
|
cobj->setBonesToSetupPose();
|
|
|
|
args.rval().setUndefined();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_spine_SkeletonRenderer_setBonesToSetupPose : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
bool js_cocos2dx_spine_SkeletonRenderer_initWithData(JSContext *cx, uint32_t argc, jsval *vp)
|
|
|
|
{
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
|
|
bool ok = true;
|
|
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
|
|
spine::SkeletonRenderer* cobj = (spine::SkeletonRenderer *)(proxy ? proxy->ptr : NULL);
|
|
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_spine_SkeletonRenderer_initWithData : Invalid Native Object");
|
|
|
|
if (argc == 1) {
|
2015-09-14 12:01:38 +08:00
|
|
|
spSkeletonData* arg0 = nullptr;
|
2015-05-05 10:50:19 +08:00
|
|
|
#pragma warning NO CONVERSION TO NATIVE FOR spSkeletonData*
|
|
|
|
ok = false;
|
|
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_spine_SkeletonRenderer_initWithData : Error processing arguments");
|
|
|
|
cobj->initWithData(arg0);
|
|
|
|
args.rval().setUndefined();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if (argc == 2) {
|
2015-09-14 12:01:38 +08:00
|
|
|
spSkeletonData* arg0 = nullptr;
|
2015-05-05 10:50:19 +08:00
|
|
|
bool arg1;
|
|
|
|
#pragma warning NO CONVERSION TO NATIVE FOR spSkeletonData*
|
|
|
|
ok = false;
|
|
|
|
arg1 = JS::ToBoolean(args.get(1));
|
|
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_spine_SkeletonRenderer_initWithData : Error processing arguments");
|
|
|
|
cobj->initWithData(arg0, arg1);
|
|
|
|
args.rval().setUndefined();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_spine_SkeletonRenderer_initWithData : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
bool js_cocos2dx_spine_SkeletonRenderer_setDebugSlotsEnabled(JSContext *cx, uint32_t argc, jsval *vp)
|
|
|
|
{
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
|
|
bool ok = true;
|
|
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
|
|
spine::SkeletonRenderer* cobj = (spine::SkeletonRenderer *)(proxy ? proxy->ptr : NULL);
|
|
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_spine_SkeletonRenderer_setDebugSlotsEnabled : Invalid Native Object");
|
|
|
|
if (argc == 1) {
|
|
|
|
bool arg0;
|
|
|
|
arg0 = JS::ToBoolean(args.get(0));
|
|
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_spine_SkeletonRenderer_setDebugSlotsEnabled : Error processing arguments");
|
|
|
|
cobj->setDebugSlotsEnabled(arg0);
|
|
|
|
args.rval().setUndefined();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_spine_SkeletonRenderer_setDebugSlotsEnabled : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
bool js_cocos2dx_spine_SkeletonRenderer_setSlotsToSetupPose(JSContext *cx, uint32_t argc, jsval *vp)
|
|
|
|
{
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
|
|
spine::SkeletonRenderer* cobj = (spine::SkeletonRenderer *)(proxy ? proxy->ptr : NULL);
|
|
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_spine_SkeletonRenderer_setSlotsToSetupPose : Invalid Native Object");
|
|
|
|
if (argc == 0) {
|
|
|
|
cobj->setSlotsToSetupPose();
|
|
|
|
args.rval().setUndefined();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_spine_SkeletonRenderer_setSlotsToSetupPose : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
bool js_cocos2dx_spine_SkeletonRenderer_setToSetupPose(JSContext *cx, uint32_t argc, jsval *vp)
|
|
|
|
{
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
|
|
spine::SkeletonRenderer* cobj = (spine::SkeletonRenderer *)(proxy ? proxy->ptr : NULL);
|
|
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_spine_SkeletonRenderer_setToSetupPose : Invalid Native Object");
|
|
|
|
if (argc == 0) {
|
|
|
|
cobj->setToSetupPose();
|
|
|
|
args.rval().setUndefined();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_spine_SkeletonRenderer_setToSetupPose : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
bool js_cocos2dx_spine_SkeletonRenderer_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);
|
|
|
|
spine::SkeletonRenderer* cobj = (spine::SkeletonRenderer *)(proxy ? proxy->ptr : NULL);
|
|
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_spine_SkeletonRenderer_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_spine_SkeletonRenderer_getBlendFunc : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
bool js_cocos2dx_spine_SkeletonRenderer_drawSkeleton(JSContext *cx, uint32_t argc, jsval *vp)
|
|
|
|
{
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
|
|
bool ok = true;
|
|
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
|
|
spine::SkeletonRenderer* cobj = (spine::SkeletonRenderer *)(proxy ? proxy->ptr : NULL);
|
|
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_spine_SkeletonRenderer_drawSkeleton : Invalid Native Object");
|
|
|
|
if (argc == 2) {
|
|
|
|
cocos2d::Mat4 arg0;
|
2015-09-14 12:01:38 +08:00
|
|
|
unsigned int arg1 = 0;
|
2015-05-05 10:50:19 +08:00
|
|
|
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_spine_SkeletonRenderer_drawSkeleton : Error processing arguments");
|
|
|
|
cobj->drawSkeleton(arg0, arg1);
|
|
|
|
args.rval().setUndefined();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_spine_SkeletonRenderer_drawSkeleton : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
bool js_cocos2dx_spine_SkeletonRenderer_updateWorldTransform(JSContext *cx, uint32_t argc, jsval *vp)
|
|
|
|
{
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
|
|
spine::SkeletonRenderer* cobj = (spine::SkeletonRenderer *)(proxy ? proxy->ptr : NULL);
|
|
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_spine_SkeletonRenderer_updateWorldTransform : Invalid Native Object");
|
|
|
|
if (argc == 0) {
|
|
|
|
cobj->updateWorldTransform();
|
|
|
|
args.rval().setUndefined();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_spine_SkeletonRenderer_updateWorldTransform : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
bool js_cocos2dx_spine_SkeletonRenderer_initialize(JSContext *cx, uint32_t argc, jsval *vp)
|
|
|
|
{
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
|
|
spine::SkeletonRenderer* cobj = (spine::SkeletonRenderer *)(proxy ? proxy->ptr : NULL);
|
|
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_spine_SkeletonRenderer_initialize : Invalid Native Object");
|
|
|
|
if (argc == 0) {
|
|
|
|
cobj->initialize();
|
|
|
|
args.rval().setUndefined();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_spine_SkeletonRenderer_initialize : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
bool js_cocos2dx_spine_SkeletonRenderer_setDebugBonesEnabled(JSContext *cx, uint32_t argc, jsval *vp)
|
|
|
|
{
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
|
|
bool ok = true;
|
|
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
|
|
spine::SkeletonRenderer* cobj = (spine::SkeletonRenderer *)(proxy ? proxy->ptr : NULL);
|
|
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_spine_SkeletonRenderer_setDebugBonesEnabled : Invalid Native Object");
|
|
|
|
if (argc == 1) {
|
|
|
|
bool arg0;
|
|
|
|
arg0 = JS::ToBoolean(args.get(0));
|
|
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_spine_SkeletonRenderer_setDebugBonesEnabled : Error processing arguments");
|
|
|
|
cobj->setDebugBonesEnabled(arg0);
|
|
|
|
args.rval().setUndefined();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_spine_SkeletonRenderer_setDebugBonesEnabled : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
bool js_cocos2dx_spine_SkeletonRenderer_getDebugBonesEnabled(JSContext *cx, uint32_t argc, jsval *vp)
|
|
|
|
{
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
|
|
spine::SkeletonRenderer* cobj = (spine::SkeletonRenderer *)(proxy ? proxy->ptr : NULL);
|
|
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_spine_SkeletonRenderer_getDebugBonesEnabled : Invalid Native Object");
|
|
|
|
if (argc == 0) {
|
|
|
|
bool ret = cobj->getDebugBonesEnabled();
|
|
|
|
jsval jsret = JSVAL_NULL;
|
|
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
|
|
args.rval().set(jsret);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_spine_SkeletonRenderer_getDebugBonesEnabled : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
bool js_cocos2dx_spine_SkeletonRenderer_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);
|
|
|
|
spine::SkeletonRenderer* cobj = (spine::SkeletonRenderer *)(proxy ? proxy->ptr : NULL);
|
|
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_spine_SkeletonRenderer_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_spine_SkeletonRenderer_getTimeScale : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
bool js_cocos2dx_spine_SkeletonRenderer_initWithFile(JSContext *cx, uint32_t argc, jsval *vp)
|
|
|
|
{
|
|
|
|
bool ok = true;
|
2015-09-25 16:43:00 +08:00
|
|
|
spine::SkeletonRenderer* cobj = nullptr;
|
2015-05-05 10:50:19 +08:00
|
|
|
|
2015-09-25 16:43:00 +08:00
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
2015-05-05 10:50:19 +08:00
|
|
|
JS::RootedObject obj(cx);
|
2015-12-01 12:32:19 +08:00
|
|
|
obj.set(args.thisv().toObjectOrNull());
|
2015-05-05 10:50:19 +08:00
|
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
2015-09-25 16:43:00 +08:00
|
|
|
cobj = (spine::SkeletonRenderer *)(proxy ? proxy->ptr : nullptr);
|
2015-05-05 10:50:19 +08:00
|
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_spine_SkeletonRenderer_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; }
|
|
|
|
std::string arg1;
|
|
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
|
|
|
if (!ok) { ok = true; break; }
|
|
|
|
cobj->initWithFile(arg0, arg1);
|
|
|
|
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; }
|
|
|
|
std::string arg1;
|
|
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
|
|
|
if (!ok) { ok = true; break; }
|
2015-09-14 12:01:38 +08:00
|
|
|
double arg2 = 0;
|
2016-05-30 17:27:04 +08:00
|
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
2015-05-05 10:50:19 +08:00
|
|
|
if (!ok) { ok = true; break; }
|
|
|
|
cobj->initWithFile(arg0, arg1, arg2);
|
|
|
|
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; }
|
2015-09-14 12:01:38 +08:00
|
|
|
spAtlas* arg1 = nullptr;
|
2015-05-05 10:50:19 +08:00
|
|
|
#pragma warning NO CONVERSION TO NATIVE FOR spAtlas*
|
|
|
|
ok = false;
|
|
|
|
if (!ok) { ok = true; break; }
|
|
|
|
cobj->initWithFile(arg0, arg1);
|
|
|
|
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; }
|
2015-09-14 12:01:38 +08:00
|
|
|
spAtlas* arg1 = nullptr;
|
2015-05-05 10:50:19 +08:00
|
|
|
#pragma warning NO CONVERSION TO NATIVE FOR spAtlas*
|
|
|
|
ok = false;
|
|
|
|
if (!ok) { ok = true; break; }
|
2015-09-14 12:01:38 +08:00
|
|
|
double arg2 = 0;
|
2016-05-30 17:27:04 +08:00
|
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
2015-05-05 10:50:19 +08:00
|
|
|
if (!ok) { ok = true; break; }
|
|
|
|
cobj->initWithFile(arg0, arg1, arg2);
|
|
|
|
args.rval().setUndefined();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
} while(0);
|
|
|
|
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_spine_SkeletonRenderer_initWithFile : wrong number of arguments");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
bool js_cocos2dx_spine_SkeletonRenderer_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);
|
|
|
|
spine::SkeletonRenderer* cobj = (spine::SkeletonRenderer *)(proxy ? proxy->ptr : NULL);
|
|
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_spine_SkeletonRenderer_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_spine_SkeletonRenderer_setBlendFunc : Error processing arguments");
|
|
|
|
cobj->setBlendFunc(arg0);
|
|
|
|
args.rval().setUndefined();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_spine_SkeletonRenderer_setBlendFunc : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
bool js_cocos2dx_spine_SkeletonRenderer_setSkin(JSContext *cx, uint32_t argc, jsval *vp)
|
|
|
|
{
|
|
|
|
bool ok = true;
|
2015-09-25 16:43:00 +08:00
|
|
|
spine::SkeletonRenderer* cobj = nullptr;
|
2015-05-05 10:50:19 +08:00
|
|
|
|
2015-09-25 16:43:00 +08:00
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
2015-05-05 10:50:19 +08:00
|
|
|
JS::RootedObject obj(cx);
|
2015-12-01 12:32:19 +08:00
|
|
|
obj.set(args.thisv().toObjectOrNull());
|
2015-05-05 10:50:19 +08:00
|
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
2015-09-25 16:43:00 +08:00
|
|
|
cobj = (spine::SkeletonRenderer *)(proxy ? proxy->ptr : nullptr);
|
2015-05-05 10:50:19 +08:00
|
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_spine_SkeletonRenderer_setSkin : Invalid Native Object");
|
|
|
|
do {
|
|
|
|
if (argc == 1) {
|
2015-09-14 12:01:38 +08:00
|
|
|
const char* arg0 = nullptr;
|
2015-05-05 10:50:19 +08:00
|
|
|
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 ret = cobj->setSkin(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->setSkin(arg0);
|
|
|
|
jsval jsret = JSVAL_NULL;
|
|
|
|
jsret = BOOLEAN_TO_JSVAL(ret);
|
|
|
|
args.rval().set(jsret);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
} while(0);
|
|
|
|
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_spine_SkeletonRenderer_setSkin : wrong number of arguments");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
bool js_cocos2dx_spine_SkeletonRenderer_getSkeleton(JSContext *cx, uint32_t argc, jsval *vp)
|
|
|
|
{
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
|
|
spine::SkeletonRenderer* cobj = (spine::SkeletonRenderer *)(proxy ? proxy->ptr : NULL);
|
|
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_spine_SkeletonRenderer_getSkeleton : Invalid Native Object");
|
|
|
|
if (argc == 0) {
|
|
|
|
spSkeleton* ret = cobj->getSkeleton();
|
|
|
|
jsval jsret = JSVAL_NULL;
|
|
|
|
jsret = spskeleton_to_jsval(cx, *ret);
|
|
|
|
args.rval().set(jsret);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_spine_SkeletonRenderer_getSkeleton : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
bool js_cocos2dx_spine_SkeletonRenderer_createWithFile(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; }
|
|
|
|
std::string arg1;
|
|
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
|
|
|
if (!ok) { ok = true; break; }
|
|
|
|
spine::SkeletonRenderer* ret = spine::SkeletonRenderer::createWithFile(arg0, arg1);
|
|
|
|
jsval jsret = JSVAL_NULL;
|
2015-12-08 11:05:23 +08:00
|
|
|
if (ret) {
|
|
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<spine::SkeletonRenderer>(cx, (spine::SkeletonRenderer*)ret));
|
|
|
|
} else {
|
|
|
|
jsret = JSVAL_NULL;
|
|
|
|
};
|
2015-05-05 10:50:19 +08:00
|
|
|
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; }
|
2015-09-14 12:01:38 +08:00
|
|
|
double arg2 = 0;
|
2016-05-30 17:27:04 +08:00
|
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
2015-05-05 10:50:19 +08:00
|
|
|
if (!ok) { ok = true; break; }
|
|
|
|
spine::SkeletonRenderer* ret = spine::SkeletonRenderer::createWithFile(arg0, arg1, arg2);
|
|
|
|
jsval jsret = JSVAL_NULL;
|
2015-12-08 11:05:23 +08:00
|
|
|
if (ret) {
|
|
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<spine::SkeletonRenderer>(cx, (spine::SkeletonRenderer*)ret));
|
|
|
|
} else {
|
|
|
|
jsret = JSVAL_NULL;
|
|
|
|
};
|
2015-05-05 10:50:19 +08:00
|
|
|
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; }
|
2015-09-14 12:01:38 +08:00
|
|
|
spAtlas* arg1 = nullptr;
|
2015-05-05 10:50:19 +08:00
|
|
|
#pragma warning NO CONVERSION TO NATIVE FOR spAtlas*
|
|
|
|
ok = false;
|
|
|
|
if (!ok) { ok = true; break; }
|
|
|
|
spine::SkeletonRenderer* ret = spine::SkeletonRenderer::createWithFile(arg0, arg1);
|
|
|
|
jsval jsret = JSVAL_NULL;
|
2015-12-08 11:05:23 +08:00
|
|
|
if (ret) {
|
|
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<spine::SkeletonRenderer>(cx, (spine::SkeletonRenderer*)ret));
|
|
|
|
} else {
|
|
|
|
jsret = JSVAL_NULL;
|
|
|
|
};
|
2015-05-05 10:50:19 +08:00
|
|
|
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; }
|
2015-09-14 12:01:38 +08:00
|
|
|
spAtlas* arg1 = nullptr;
|
2015-05-05 10:50:19 +08:00
|
|
|
#pragma warning NO CONVERSION TO NATIVE FOR spAtlas*
|
|
|
|
ok = false;
|
|
|
|
if (!ok) { ok = true; break; }
|
2015-09-14 12:01:38 +08:00
|
|
|
double arg2 = 0;
|
2016-05-30 17:27:04 +08:00
|
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
2015-05-05 10:50:19 +08:00
|
|
|
if (!ok) { ok = true; break; }
|
|
|
|
spine::SkeletonRenderer* ret = spine::SkeletonRenderer::createWithFile(arg0, arg1, arg2);
|
|
|
|
jsval jsret = JSVAL_NULL;
|
2015-12-08 11:05:23 +08:00
|
|
|
if (ret) {
|
|
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<spine::SkeletonRenderer>(cx, (spine::SkeletonRenderer*)ret));
|
|
|
|
} else {
|
|
|
|
jsret = JSVAL_NULL;
|
|
|
|
};
|
2015-05-05 10:50:19 +08:00
|
|
|
args.rval().set(jsret);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
} while (0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_spine_SkeletonRenderer_createWithFile : wrong number of arguments");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
bool js_cocos2dx_spine_SkeletonRenderer_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
|
|
{
|
|
|
|
bool ok = true;
|
2015-09-25 16:43:00 +08:00
|
|
|
spine::SkeletonRenderer* cobj = nullptr;
|
2015-05-05 10:50:19 +08:00
|
|
|
|
2015-09-25 16:43:00 +08:00
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
2015-05-05 10:50:19 +08:00
|
|
|
JS::RootedObject obj(cx);
|
|
|
|
do {
|
|
|
|
if (argc == 1) {
|
2015-09-14 12:01:38 +08:00
|
|
|
spSkeletonData* arg0 = nullptr;
|
2015-05-05 10:50:19 +08:00
|
|
|
#pragma warning NO CONVERSION TO NATIVE FOR spSkeletonData*
|
|
|
|
ok = false;
|
|
|
|
if (!ok) { ok = true; break; }
|
|
|
|
cobj = new (std::nothrow) spine::SkeletonRenderer(arg0);
|
2015-12-03 06:45:13 +08:00
|
|
|
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<spine::SkeletonRenderer>(cobj);
|
2015-12-01 12:32:19 +08:00
|
|
|
JS::RootedObject proto(cx, typeClass->proto.ref());
|
|
|
|
JS::RootedObject parent(cx, typeClass->parentProto.ref());
|
2015-05-05 10:50:19 +08:00
|
|
|
obj = JS_NewObject(cx, typeClass->jsclass, proto, parent);
|
|
|
|
js_proxy_t* p = jsb_new_proxy(cobj, obj);
|
2015-12-03 06:45:13 +08:00
|
|
|
jsb_ref_init(cx, &p->obj, cobj, "spine::SkeletonRenderer");
|
2015-05-05 10:50:19 +08:00
|
|
|
}
|
|
|
|
} while(0);
|
|
|
|
|
|
|
|
do {
|
|
|
|
if (argc == 2) {
|
2015-09-14 12:01:38 +08:00
|
|
|
spSkeletonData* arg0 = nullptr;
|
2015-05-05 10:50:19 +08:00
|
|
|
#pragma warning NO CONVERSION TO NATIVE FOR spSkeletonData*
|
|
|
|
ok = false;
|
|
|
|
if (!ok) { ok = true; break; }
|
|
|
|
bool arg1;
|
|
|
|
arg1 = JS::ToBoolean(args.get(1));
|
|
|
|
cobj = new (std::nothrow) spine::SkeletonRenderer(arg0, arg1);
|
2015-12-03 06:45:13 +08:00
|
|
|
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<spine::SkeletonRenderer>(cobj);
|
2015-12-01 12:32:19 +08:00
|
|
|
JS::RootedObject proto(cx, typeClass->proto.ref());
|
|
|
|
JS::RootedObject parent(cx, typeClass->parentProto.ref());
|
2015-05-05 10:50:19 +08:00
|
|
|
obj = JS_NewObject(cx, typeClass->jsclass, proto, parent);
|
|
|
|
js_proxy_t* p = jsb_new_proxy(cobj, obj);
|
2015-12-03 06:45:13 +08:00
|
|
|
jsb_ref_init(cx, &p->obj, cobj, "spine::SkeletonRenderer");
|
2015-05-05 10:50:19 +08:00
|
|
|
}
|
|
|
|
} while(0);
|
|
|
|
|
|
|
|
do {
|
|
|
|
if (argc == 0) {
|
|
|
|
cobj = new (std::nothrow) spine::SkeletonRenderer();
|
2015-12-03 06:45:13 +08:00
|
|
|
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<spine::SkeletonRenderer>(cobj);
|
2015-12-01 12:32:19 +08:00
|
|
|
JS::RootedObject proto(cx, typeClass->proto.ref());
|
|
|
|
JS::RootedObject parent(cx, typeClass->parentProto.ref());
|
2015-05-05 10:50:19 +08:00
|
|
|
obj = JS_NewObject(cx, typeClass->jsclass, proto, parent);
|
|
|
|
js_proxy_t* p = jsb_new_proxy(cobj, obj);
|
2015-12-03 06:45:13 +08:00
|
|
|
jsb_ref_init(cx, &p->obj, cobj, "spine::SkeletonRenderer");
|
2015-05-05 10:50:19 +08:00
|
|
|
}
|
|
|
|
} while(0);
|
|
|
|
|
|
|
|
do {
|
|
|
|
if (argc == 2) {
|
|
|
|
std::string arg0;
|
|
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
|
|
if (!ok) { ok = true; break; }
|
2015-09-14 12:01:38 +08:00
|
|
|
spAtlas* arg1 = nullptr;
|
2015-05-05 10:50:19 +08:00
|
|
|
#pragma warning NO CONVERSION TO NATIVE FOR spAtlas*
|
|
|
|
ok = false;
|
|
|
|
if (!ok) { ok = true; break; }
|
|
|
|
cobj = new (std::nothrow) spine::SkeletonRenderer(arg0, arg1);
|
2015-12-03 06:45:13 +08:00
|
|
|
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<spine::SkeletonRenderer>(cobj);
|
2015-12-01 12:32:19 +08:00
|
|
|
JS::RootedObject proto(cx, typeClass->proto.ref());
|
|
|
|
JS::RootedObject parent(cx, typeClass->parentProto.ref());
|
2015-05-05 10:50:19 +08:00
|
|
|
obj = JS_NewObject(cx, typeClass->jsclass, proto, parent);
|
|
|
|
js_proxy_t* p = jsb_new_proxy(cobj, obj);
|
2015-12-03 06:45:13 +08:00
|
|
|
jsb_ref_init(cx, &p->obj, cobj, "spine::SkeletonRenderer");
|
2015-05-05 10:50:19 +08:00
|
|
|
}
|
|
|
|
} while(0);
|
|
|
|
|
|
|
|
do {
|
|
|
|
if (argc == 3) {
|
|
|
|
std::string arg0;
|
|
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
|
|
if (!ok) { ok = true; break; }
|
2015-09-14 12:01:38 +08:00
|
|
|
spAtlas* arg1 = nullptr;
|
2015-05-05 10:50:19 +08:00
|
|
|
#pragma warning NO CONVERSION TO NATIVE FOR spAtlas*
|
|
|
|
ok = false;
|
|
|
|
if (!ok) { ok = true; break; }
|
2015-09-14 12:01:38 +08:00
|
|
|
double arg2 = 0;
|
2016-05-30 17:27:04 +08:00
|
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
2015-05-05 10:50:19 +08:00
|
|
|
if (!ok) { ok = true; break; }
|
|
|
|
cobj = new (std::nothrow) spine::SkeletonRenderer(arg0, arg1, arg2);
|
2015-12-03 06:45:13 +08:00
|
|
|
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<spine::SkeletonRenderer>(cobj);
|
2015-12-01 12:32:19 +08:00
|
|
|
JS::RootedObject proto(cx, typeClass->proto.ref());
|
|
|
|
JS::RootedObject parent(cx, typeClass->parentProto.ref());
|
2015-05-05 10:50:19 +08:00
|
|
|
obj = JS_NewObject(cx, typeClass->jsclass, proto, parent);
|
|
|
|
js_proxy_t* p = jsb_new_proxy(cobj, obj);
|
2015-12-03 06:45:13 +08:00
|
|
|
jsb_ref_init(cx, &p->obj, cobj, "spine::SkeletonRenderer");
|
2015-05-05 10:50:19 +08:00
|
|
|
}
|
|
|
|
} 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; }
|
|
|
|
cobj = new (std::nothrow) spine::SkeletonRenderer(arg0, arg1);
|
2015-12-03 06:45:13 +08:00
|
|
|
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<spine::SkeletonRenderer>(cobj);
|
2015-12-01 12:32:19 +08:00
|
|
|
JS::RootedObject proto(cx, typeClass->proto.ref());
|
|
|
|
JS::RootedObject parent(cx, typeClass->parentProto.ref());
|
2015-05-05 10:50:19 +08:00
|
|
|
obj = JS_NewObject(cx, typeClass->jsclass, proto, parent);
|
|
|
|
js_proxy_t* p = jsb_new_proxy(cobj, obj);
|
2015-12-03 06:45:13 +08:00
|
|
|
jsb_ref_init(cx, &p->obj, cobj, "spine::SkeletonRenderer");
|
2015-05-05 10:50:19 +08:00
|
|
|
}
|
|
|
|
} 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; }
|
2015-09-14 12:01:38 +08:00
|
|
|
double arg2 = 0;
|
2016-05-30 17:27:04 +08:00
|
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
2015-05-05 10:50:19 +08:00
|
|
|
if (!ok) { ok = true; break; }
|
|
|
|
cobj = new (std::nothrow) spine::SkeletonRenderer(arg0, arg1, arg2);
|
2015-12-03 06:45:13 +08:00
|
|
|
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<spine::SkeletonRenderer>(cobj);
|
2015-12-01 12:32:19 +08:00
|
|
|
JS::RootedObject proto(cx, typeClass->proto.ref());
|
|
|
|
JS::RootedObject parent(cx, typeClass->parentProto.ref());
|
2015-05-05 10:50:19 +08:00
|
|
|
obj = JS_NewObject(cx, typeClass->jsclass, proto, parent);
|
|
|
|
js_proxy_t* p = jsb_new_proxy(cobj, obj);
|
2015-12-03 06:45:13 +08:00
|
|
|
jsb_ref_init(cx, &p->obj, cobj, "spine::SkeletonRenderer");
|
2015-05-05 10:50:19 +08:00
|
|
|
}
|
|
|
|
} while(0);
|
|
|
|
|
|
|
|
if (cobj) {
|
|
|
|
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
|
|
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
|
|
|
|
|
|
args.rval().set(OBJECT_TO_JSVAL(obj));
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_spine_SkeletonRenderer_constructor : wrong number of arguments");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
extern JSObject *jsb_cocos2d_Node_prototype;
|
|
|
|
|
|
|
|
void js_register_cocos2dx_spine_SkeletonRenderer(JSContext *cx, JS::HandleObject global) {
|
|
|
|
jsb_spine_SkeletonRenderer_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
|
|
jsb_spine_SkeletonRenderer_class->name = "Skeleton";
|
|
|
|
jsb_spine_SkeletonRenderer_class->addProperty = JS_PropertyStub;
|
|
|
|
jsb_spine_SkeletonRenderer_class->delProperty = JS_DeletePropertyStub;
|
|
|
|
jsb_spine_SkeletonRenderer_class->getProperty = JS_PropertyStub;
|
|
|
|
jsb_spine_SkeletonRenderer_class->setProperty = JS_StrictPropertyStub;
|
|
|
|
jsb_spine_SkeletonRenderer_class->enumerate = JS_EnumerateStub;
|
|
|
|
jsb_spine_SkeletonRenderer_class->resolve = JS_ResolveStub;
|
|
|
|
jsb_spine_SkeletonRenderer_class->convert = JS_ConvertStub;
|
|
|
|
jsb_spine_SkeletonRenderer_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
|
|
|
|
static JSPropertySpec properties[] = {
|
|
|
|
JS_PS_END
|
|
|
|
};
|
|
|
|
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
|
|
JS_FN("setTimeScale", js_cocos2dx_spine_SkeletonRenderer_setTimeScale, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
|
|
JS_FN("getDebugSlotsEnabled", js_cocos2dx_spine_SkeletonRenderer_getDebugSlotsEnabled, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
|
|
JS_FN("setAttachment", js_cocos2dx_spine_SkeletonRenderer_setAttachment, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
|
|
JS_FN("setBonesToSetupPose", js_cocos2dx_spine_SkeletonRenderer_setBonesToSetupPose, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
|
|
JS_FN("initWithData", js_cocos2dx_spine_SkeletonRenderer_initWithData, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
|
|
JS_FN("setDebugSlotsEnabled", js_cocos2dx_spine_SkeletonRenderer_setDebugSlotsEnabled, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
|
|
JS_FN("setSlotsToSetupPose", js_cocos2dx_spine_SkeletonRenderer_setSlotsToSetupPose, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
|
|
JS_FN("setToSetupPose", js_cocos2dx_spine_SkeletonRenderer_setToSetupPose, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
|
|
JS_FN("getBlendFunc", js_cocos2dx_spine_SkeletonRenderer_getBlendFunc, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
|
|
JS_FN("drawSkeleton", js_cocos2dx_spine_SkeletonRenderer_drawSkeleton, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
|
|
JS_FN("updateWorldTransform", js_cocos2dx_spine_SkeletonRenderer_updateWorldTransform, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
|
|
JS_FN("initialize", js_cocos2dx_spine_SkeletonRenderer_initialize, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
|
|
JS_FN("setDebugBonesEnabled", js_cocos2dx_spine_SkeletonRenderer_setDebugBonesEnabled, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
|
|
JS_FN("getDebugBonesEnabled", js_cocos2dx_spine_SkeletonRenderer_getDebugBonesEnabled, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
|
|
JS_FN("getTimeScale", js_cocos2dx_spine_SkeletonRenderer_getTimeScale, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
|
|
JS_FN("initWithFile", js_cocos2dx_spine_SkeletonRenderer_initWithFile, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
|
|
JS_FN("setBlendFunc", js_cocos2dx_spine_SkeletonRenderer_setBlendFunc, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
|
|
JS_FN("setSkin", js_cocos2dx_spine_SkeletonRenderer_setSkin, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
|
|
JS_FN("getSkeleton", js_cocos2dx_spine_SkeletonRenderer_getSkeleton, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
|
|
JS_FS_END
|
|
|
|
};
|
|
|
|
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
|
|
JS_FN("create", js_cocos2dx_spine_SkeletonRenderer_createWithFile, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
|
|
JS_FS_END
|
|
|
|
};
|
|
|
|
|
2015-12-01 12:32:19 +08:00
|
|
|
JS::RootedObject parent_proto(cx, jsb_cocos2d_Node_prototype);
|
2015-05-05 10:50:19 +08:00
|
|
|
jsb_spine_SkeletonRenderer_prototype = JS_InitClass(
|
|
|
|
cx, global,
|
2015-12-01 12:32:19 +08:00
|
|
|
parent_proto,
|
2015-05-05 10:50:19 +08:00
|
|
|
jsb_spine_SkeletonRenderer_class,
|
|
|
|
js_cocos2dx_spine_SkeletonRenderer_constructor, 0, // constructor
|
|
|
|
properties,
|
|
|
|
funcs,
|
|
|
|
NULL, // no static properties
|
|
|
|
st_funcs);
|
|
|
|
|
2015-12-01 12:32:19 +08:00
|
|
|
JS::RootedObject proto(cx, jsb_spine_SkeletonRenderer_prototype);
|
2016-02-14 14:53:19 +08:00
|
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "SkeletonRenderer"));
|
|
|
|
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
|
2015-12-01 12:32:19 +08:00
|
|
|
jsb_register_class<spine::SkeletonRenderer>(cx, jsb_spine_SkeletonRenderer_class, proto, parent_proto);
|
2015-05-05 10:50:19 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
JSClass *jsb_spine_SkeletonAnimation_class;
|
|
|
|
JSObject *jsb_spine_SkeletonAnimation_prototype;
|
|
|
|
|
|
|
|
bool js_cocos2dx_spine_SkeletonAnimation_setStartListener(JSContext *cx, uint32_t argc, jsval *vp)
|
|
|
|
{
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
|
|
bool ok = true;
|
|
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
|
|
spine::SkeletonAnimation* cobj = (spine::SkeletonAnimation *)(proxy ? proxy->ptr : NULL);
|
|
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_spine_SkeletonAnimation_setStartListener : Invalid Native Object");
|
|
|
|
if (argc == 1) {
|
|
|
|
std::function<void (int)> arg0;
|
|
|
|
do {
|
|
|
|
if(JS_TypeOfValue(cx, args.get(0)) == JSTYPE_FUNCTION)
|
|
|
|
{
|
2015-12-01 12:32:19 +08:00
|
|
|
JS::RootedObject jstarget(cx, args.thisv().toObjectOrNull());
|
2016-02-14 14:53:19 +08:00
|
|
|
std::shared_ptr<JSFunctionWrapper> func(new JSFunctionWrapper(cx, jstarget, args.get(0), args.thisv()));
|
2015-05-05 10:50:19 +08:00
|
|
|
auto lambda = [=](int larg0) -> void {
|
|
|
|
JSB_AUTOCOMPARTMENT_WITH_GLOBAL_OBJCET
|
|
|
|
jsval largv[1];
|
|
|
|
largv[0] = int32_to_jsval(cx, larg0);
|
|
|
|
JS::RootedValue rval(cx);
|
2015-07-30 18:50:00 +08:00
|
|
|
bool succeed = func->invoke(1, &largv[0], &rval);
|
|
|
|
if (!succeed && JS_IsExceptionPending(cx)) {
|
2015-05-05 10:50:19 +08:00
|
|
|
JS_ReportPendingException(cx);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
arg0 = lambda;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
arg0 = nullptr;
|
|
|
|
}
|
|
|
|
} while(0)
|
|
|
|
;
|
|
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_spine_SkeletonAnimation_setStartListener : Error processing arguments");
|
|
|
|
cobj->setStartListener(arg0);
|
|
|
|
args.rval().setUndefined();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_spine_SkeletonAnimation_setStartListener : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
bool js_cocos2dx_spine_SkeletonAnimation_setTrackEventListener(JSContext *cx, uint32_t argc, jsval *vp)
|
|
|
|
{
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
|
|
bool ok = true;
|
|
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
|
|
spine::SkeletonAnimation* cobj = (spine::SkeletonAnimation *)(proxy ? proxy->ptr : NULL);
|
|
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_spine_SkeletonAnimation_setTrackEventListener : Invalid Native Object");
|
|
|
|
if (argc == 2) {
|
2015-09-14 12:01:38 +08:00
|
|
|
spTrackEntry* arg0 = nullptr;
|
2015-05-05 10:50:19 +08:00
|
|
|
std::function<void (int, spEvent *)> arg1;
|
|
|
|
#pragma warning NO CONVERSION TO NATIVE FOR spTrackEntry*
|
|
|
|
ok = false;
|
|
|
|
do {
|
|
|
|
if(JS_TypeOfValue(cx, args.get(1)) == JSTYPE_FUNCTION)
|
|
|
|
{
|
2015-12-01 12:32:19 +08:00
|
|
|
JS::RootedObject jstarget(cx, args.thisv().toObjectOrNull());
|
2016-02-14 14:53:19 +08:00
|
|
|
std::shared_ptr<JSFunctionWrapper> func(new JSFunctionWrapper(cx, jstarget, args.get(1), args.thisv()));
|
2015-05-05 10:50:19 +08:00
|
|
|
auto lambda = [=](int larg0, spEvent* larg1) -> void {
|
|
|
|
JSB_AUTOCOMPARTMENT_WITH_GLOBAL_OBJCET
|
|
|
|
jsval largv[2];
|
|
|
|
largv[0] = int32_to_jsval(cx, larg0);
|
|
|
|
largv[1] = spevent_to_jsval(cx, *larg1);
|
|
|
|
JS::RootedValue rval(cx);
|
2015-07-30 18:50:00 +08:00
|
|
|
bool succeed = func->invoke(2, &largv[0], &rval);
|
|
|
|
if (!succeed && JS_IsExceptionPending(cx)) {
|
2015-05-05 10:50:19 +08:00
|
|
|
JS_ReportPendingException(cx);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
arg1 = lambda;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
arg1 = nullptr;
|
|
|
|
}
|
|
|
|
} while(0)
|
|
|
|
;
|
|
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_spine_SkeletonAnimation_setTrackEventListener : Error processing arguments");
|
|
|
|
cobj->setTrackEventListener(arg0, arg1);
|
|
|
|
args.rval().setUndefined();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_spine_SkeletonAnimation_setTrackEventListener : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
bool js_cocos2dx_spine_SkeletonAnimation_getState(JSContext *cx, uint32_t argc, jsval *vp)
|
|
|
|
{
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
|
|
spine::SkeletonAnimation* cobj = (spine::SkeletonAnimation *)(proxy ? proxy->ptr : NULL);
|
|
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_spine_SkeletonAnimation_getState : Invalid Native Object");
|
|
|
|
if (argc == 0) {
|
|
|
|
spAnimationState* ret = cobj->getState();
|
|
|
|
jsval jsret = JSVAL_NULL;
|
|
|
|
jsret = spanimationstate_to_jsval(cx, *ret);
|
|
|
|
args.rval().set(jsret);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_spine_SkeletonAnimation_getState : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
bool js_cocos2dx_spine_SkeletonAnimation_setTrackCompleteListener(JSContext *cx, uint32_t argc, jsval *vp)
|
|
|
|
{
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
|
|
bool ok = true;
|
|
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
|
|
spine::SkeletonAnimation* cobj = (spine::SkeletonAnimation *)(proxy ? proxy->ptr : NULL);
|
|
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_spine_SkeletonAnimation_setTrackCompleteListener : Invalid Native Object");
|
|
|
|
if (argc == 2) {
|
2015-09-14 12:01:38 +08:00
|
|
|
spTrackEntry* arg0 = nullptr;
|
2015-05-05 10:50:19 +08:00
|
|
|
std::function<void (int, int)> arg1;
|
|
|
|
#pragma warning NO CONVERSION TO NATIVE FOR spTrackEntry*
|
|
|
|
ok = false;
|
|
|
|
do {
|
|
|
|
if(JS_TypeOfValue(cx, args.get(1)) == JSTYPE_FUNCTION)
|
|
|
|
{
|
2015-12-01 12:32:19 +08:00
|
|
|
JS::RootedObject jstarget(cx, args.thisv().toObjectOrNull());
|
2016-02-14 14:53:19 +08:00
|
|
|
std::shared_ptr<JSFunctionWrapper> func(new JSFunctionWrapper(cx, jstarget, args.get(1), args.thisv()));
|
2015-05-05 10:50:19 +08:00
|
|
|
auto lambda = [=](int larg0, int larg1) -> void {
|
|
|
|
JSB_AUTOCOMPARTMENT_WITH_GLOBAL_OBJCET
|
|
|
|
jsval largv[2];
|
|
|
|
largv[0] = int32_to_jsval(cx, larg0);
|
|
|
|
largv[1] = int32_to_jsval(cx, larg1);
|
|
|
|
JS::RootedValue rval(cx);
|
2015-07-30 18:50:00 +08:00
|
|
|
bool succeed = func->invoke(2, &largv[0], &rval);
|
|
|
|
if (!succeed && JS_IsExceptionPending(cx)) {
|
2015-05-05 10:50:19 +08:00
|
|
|
JS_ReportPendingException(cx);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
arg1 = lambda;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
arg1 = nullptr;
|
|
|
|
}
|
|
|
|
} while(0)
|
|
|
|
;
|
|
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_spine_SkeletonAnimation_setTrackCompleteListener : Error processing arguments");
|
|
|
|
cobj->setTrackCompleteListener(arg0, arg1);
|
|
|
|
args.rval().setUndefined();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_spine_SkeletonAnimation_setTrackCompleteListener : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
bool js_cocos2dx_spine_SkeletonAnimation_onTrackEntryEvent(JSContext *cx, uint32_t argc, jsval *vp)
|
|
|
|
{
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
|
|
bool ok = true;
|
|
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
|
|
spine::SkeletonAnimation* cobj = (spine::SkeletonAnimation *)(proxy ? proxy->ptr : NULL);
|
|
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_spine_SkeletonAnimation_onTrackEntryEvent : Invalid Native Object");
|
|
|
|
if (argc == 4) {
|
2015-09-14 12:01:38 +08:00
|
|
|
int arg0 = 0;
|
2015-05-05 10:50:19 +08:00
|
|
|
spEventType arg1;
|
2015-09-14 12:01:38 +08:00
|
|
|
spEvent* arg2 = nullptr;
|
|
|
|
int arg3 = 0;
|
2015-05-05 10:50:19 +08:00
|
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
|
|
ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1);
|
|
|
|
#pragma warning NO CONVERSION TO NATIVE FOR spEvent*
|
|
|
|
ok = false;
|
|
|
|
ok &= jsval_to_int32(cx, args.get(3), (int32_t *)&arg3);
|
|
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_spine_SkeletonAnimation_onTrackEntryEvent : Error processing arguments");
|
|
|
|
cobj->onTrackEntryEvent(arg0, arg1, arg2, arg3);
|
|
|
|
args.rval().setUndefined();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_spine_SkeletonAnimation_onTrackEntryEvent : wrong number of arguments: %d, was expecting %d", argc, 4);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
bool js_cocos2dx_spine_SkeletonAnimation_setTrackStartListener(JSContext *cx, uint32_t argc, jsval *vp)
|
|
|
|
{
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
|
|
bool ok = true;
|
|
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
|
|
spine::SkeletonAnimation* cobj = (spine::SkeletonAnimation *)(proxy ? proxy->ptr : NULL);
|
|
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_spine_SkeletonAnimation_setTrackStartListener : Invalid Native Object");
|
|
|
|
if (argc == 2) {
|
2015-09-14 12:01:38 +08:00
|
|
|
spTrackEntry* arg0 = nullptr;
|
2015-05-05 10:50:19 +08:00
|
|
|
std::function<void (int)> arg1;
|
|
|
|
#pragma warning NO CONVERSION TO NATIVE FOR spTrackEntry*
|
|
|
|
ok = false;
|
|
|
|
do {
|
|
|
|
if(JS_TypeOfValue(cx, args.get(1)) == JSTYPE_FUNCTION)
|
|
|
|
{
|
2015-12-01 12:32:19 +08:00
|
|
|
JS::RootedObject jstarget(cx, args.thisv().toObjectOrNull());
|
2016-02-14 14:53:19 +08:00
|
|
|
std::shared_ptr<JSFunctionWrapper> func(new JSFunctionWrapper(cx, jstarget, args.get(1), args.thisv()));
|
2015-05-05 10:50:19 +08:00
|
|
|
auto lambda = [=](int larg0) -> void {
|
|
|
|
JSB_AUTOCOMPARTMENT_WITH_GLOBAL_OBJCET
|
|
|
|
jsval largv[1];
|
|
|
|
largv[0] = int32_to_jsval(cx, larg0);
|
|
|
|
JS::RootedValue rval(cx);
|
2015-07-30 18:50:00 +08:00
|
|
|
bool succeed = func->invoke(1, &largv[0], &rval);
|
|
|
|
if (!succeed && JS_IsExceptionPending(cx)) {
|
2015-05-05 10:50:19 +08:00
|
|
|
JS_ReportPendingException(cx);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
arg1 = lambda;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
arg1 = nullptr;
|
|
|
|
}
|
|
|
|
} while(0)
|
|
|
|
;
|
|
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_spine_SkeletonAnimation_setTrackStartListener : Error processing arguments");
|
|
|
|
cobj->setTrackStartListener(arg0, arg1);
|
|
|
|
args.rval().setUndefined();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_spine_SkeletonAnimation_setTrackStartListener : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
bool js_cocos2dx_spine_SkeletonAnimation_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);
|
|
|
|
spine::SkeletonAnimation* cobj = (spine::SkeletonAnimation *)(proxy ? proxy->ptr : NULL);
|
|
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_spine_SkeletonAnimation_update : Invalid Native Object");
|
|
|
|
if (argc == 1) {
|
2015-09-14 12:01:38 +08:00
|
|
|
double arg0 = 0;
|
2016-05-30 17:27:04 +08:00
|
|
|
ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0);
|
2015-05-05 10:50:19 +08:00
|
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_spine_SkeletonAnimation_update : Error processing arguments");
|
|
|
|
cobj->update(arg0);
|
|
|
|
args.rval().setUndefined();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_spine_SkeletonAnimation_update : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
bool js_cocos2dx_spine_SkeletonAnimation_setCompleteListener(JSContext *cx, uint32_t argc, jsval *vp)
|
|
|
|
{
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
|
|
bool ok = true;
|
|
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
|
|
spine::SkeletonAnimation* cobj = (spine::SkeletonAnimation *)(proxy ? proxy->ptr : NULL);
|
|
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_spine_SkeletonAnimation_setCompleteListener : Invalid Native Object");
|
|
|
|
if (argc == 1) {
|
|
|
|
std::function<void (int, int)> arg0;
|
|
|
|
do {
|
|
|
|
if(JS_TypeOfValue(cx, args.get(0)) == JSTYPE_FUNCTION)
|
|
|
|
{
|
2015-12-01 12:32:19 +08:00
|
|
|
JS::RootedObject jstarget(cx, args.thisv().toObjectOrNull());
|
2016-02-14 14:53:19 +08:00
|
|
|
std::shared_ptr<JSFunctionWrapper> func(new JSFunctionWrapper(cx, jstarget, args.get(0), args.thisv()));
|
2015-05-05 10:50:19 +08:00
|
|
|
auto lambda = [=](int larg0, int larg1) -> void {
|
|
|
|
JSB_AUTOCOMPARTMENT_WITH_GLOBAL_OBJCET
|
|
|
|
jsval largv[2];
|
|
|
|
largv[0] = int32_to_jsval(cx, larg0);
|
|
|
|
largv[1] = int32_to_jsval(cx, larg1);
|
|
|
|
JS::RootedValue rval(cx);
|
2015-07-30 18:50:00 +08:00
|
|
|
bool succeed = func->invoke(2, &largv[0], &rval);
|
|
|
|
if (!succeed && JS_IsExceptionPending(cx)) {
|
2015-05-05 10:50:19 +08:00
|
|
|
JS_ReportPendingException(cx);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
arg0 = lambda;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
arg0 = nullptr;
|
|
|
|
}
|
|
|
|
} while(0)
|
|
|
|
;
|
|
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_spine_SkeletonAnimation_setCompleteListener : Error processing arguments");
|
|
|
|
cobj->setCompleteListener(arg0);
|
|
|
|
args.rval().setUndefined();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_spine_SkeletonAnimation_setCompleteListener : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
bool js_cocos2dx_spine_SkeletonAnimation_setTrackEndListener(JSContext *cx, uint32_t argc, jsval *vp)
|
|
|
|
{
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
|
|
bool ok = true;
|
|
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
|
|
spine::SkeletonAnimation* cobj = (spine::SkeletonAnimation *)(proxy ? proxy->ptr : NULL);
|
|
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_spine_SkeletonAnimation_setTrackEndListener : Invalid Native Object");
|
|
|
|
if (argc == 2) {
|
2015-09-14 12:01:38 +08:00
|
|
|
spTrackEntry* arg0 = nullptr;
|
2015-05-05 10:50:19 +08:00
|
|
|
std::function<void (int)> arg1;
|
|
|
|
#pragma warning NO CONVERSION TO NATIVE FOR spTrackEntry*
|
|
|
|
ok = false;
|
|
|
|
do {
|
|
|
|
if(JS_TypeOfValue(cx, args.get(1)) == JSTYPE_FUNCTION)
|
|
|
|
{
|
2015-12-01 12:32:19 +08:00
|
|
|
JS::RootedObject jstarget(cx, args.thisv().toObjectOrNull());
|
2016-02-14 14:53:19 +08:00
|
|
|
std::shared_ptr<JSFunctionWrapper> func(new JSFunctionWrapper(cx, jstarget, args.get(1), args.thisv()));
|
2015-05-05 10:50:19 +08:00
|
|
|
auto lambda = [=](int larg0) -> void {
|
|
|
|
JSB_AUTOCOMPARTMENT_WITH_GLOBAL_OBJCET
|
|
|
|
jsval largv[1];
|
|
|
|
largv[0] = int32_to_jsval(cx, larg0);
|
|
|
|
JS::RootedValue rval(cx);
|
2015-07-30 18:50:00 +08:00
|
|
|
bool succeed = func->invoke(1, &largv[0], &rval);
|
|
|
|
if (!succeed && JS_IsExceptionPending(cx)) {
|
2015-05-05 10:50:19 +08:00
|
|
|
JS_ReportPendingException(cx);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
arg1 = lambda;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
arg1 = nullptr;
|
|
|
|
}
|
|
|
|
} while(0)
|
|
|
|
;
|
|
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_spine_SkeletonAnimation_setTrackEndListener : Error processing arguments");
|
|
|
|
cobj->setTrackEndListener(arg0, arg1);
|
|
|
|
args.rval().setUndefined();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_spine_SkeletonAnimation_setTrackEndListener : wrong number of arguments: %d, was expecting %d", argc, 2);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
bool js_cocos2dx_spine_SkeletonAnimation_setEventListener(JSContext *cx, uint32_t argc, jsval *vp)
|
|
|
|
{
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
|
|
bool ok = true;
|
|
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
|
|
spine::SkeletonAnimation* cobj = (spine::SkeletonAnimation *)(proxy ? proxy->ptr : NULL);
|
|
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_spine_SkeletonAnimation_setEventListener : Invalid Native Object");
|
|
|
|
if (argc == 1) {
|
|
|
|
std::function<void (int, spEvent *)> arg0;
|
|
|
|
do {
|
|
|
|
if(JS_TypeOfValue(cx, args.get(0)) == JSTYPE_FUNCTION)
|
|
|
|
{
|
2015-12-01 12:32:19 +08:00
|
|
|
JS::RootedObject jstarget(cx, args.thisv().toObjectOrNull());
|
2016-02-14 14:53:19 +08:00
|
|
|
std::shared_ptr<JSFunctionWrapper> func(new JSFunctionWrapper(cx, jstarget, args.get(0), args.thisv()));
|
2015-05-05 10:50:19 +08:00
|
|
|
auto lambda = [=](int larg0, spEvent* larg1) -> void {
|
|
|
|
JSB_AUTOCOMPARTMENT_WITH_GLOBAL_OBJCET
|
|
|
|
jsval largv[2];
|
|
|
|
largv[0] = int32_to_jsval(cx, larg0);
|
|
|
|
largv[1] = spevent_to_jsval(cx, *larg1);
|
|
|
|
JS::RootedValue rval(cx);
|
2015-07-30 18:50:00 +08:00
|
|
|
bool succeed = func->invoke(2, &largv[0], &rval);
|
|
|
|
if (!succeed && JS_IsExceptionPending(cx)) {
|
2015-05-05 10:50:19 +08:00
|
|
|
JS_ReportPendingException(cx);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
arg0 = lambda;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
arg0 = nullptr;
|
|
|
|
}
|
|
|
|
} while(0)
|
|
|
|
;
|
|
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_spine_SkeletonAnimation_setEventListener : Error processing arguments");
|
|
|
|
cobj->setEventListener(arg0);
|
|
|
|
args.rval().setUndefined();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_spine_SkeletonAnimation_setEventListener : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
bool js_cocos2dx_spine_SkeletonAnimation_setMix(JSContext *cx, uint32_t argc, jsval *vp)
|
|
|
|
{
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
|
|
bool ok = true;
|
|
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
|
|
spine::SkeletonAnimation* cobj = (spine::SkeletonAnimation *)(proxy ? proxy->ptr : NULL);
|
|
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_spine_SkeletonAnimation_setMix : Invalid Native Object");
|
|
|
|
if (argc == 3) {
|
|
|
|
std::string arg0;
|
|
|
|
std::string arg1;
|
2015-09-14 12:01:38 +08:00
|
|
|
double arg2 = 0;
|
2015-05-05 10:50:19 +08:00
|
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
2016-05-30 17:27:04 +08:00
|
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
2015-05-05 10:50:19 +08:00
|
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_spine_SkeletonAnimation_setMix : Error processing arguments");
|
|
|
|
cobj->setMix(arg0, arg1, arg2);
|
|
|
|
args.rval().setUndefined();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_spine_SkeletonAnimation_setMix : wrong number of arguments: %d, was expecting %d", argc, 3);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
bool js_cocos2dx_spine_SkeletonAnimation_setEndListener(JSContext *cx, uint32_t argc, jsval *vp)
|
|
|
|
{
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
|
|
bool ok = true;
|
|
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
|
|
spine::SkeletonAnimation* cobj = (spine::SkeletonAnimation *)(proxy ? proxy->ptr : NULL);
|
|
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_spine_SkeletonAnimation_setEndListener : Invalid Native Object");
|
|
|
|
if (argc == 1) {
|
|
|
|
std::function<void (int)> arg0;
|
|
|
|
do {
|
|
|
|
if(JS_TypeOfValue(cx, args.get(0)) == JSTYPE_FUNCTION)
|
|
|
|
{
|
2015-12-01 12:32:19 +08:00
|
|
|
JS::RootedObject jstarget(cx, args.thisv().toObjectOrNull());
|
2016-02-14 14:53:19 +08:00
|
|
|
std::shared_ptr<JSFunctionWrapper> func(new JSFunctionWrapper(cx, jstarget, args.get(0), args.thisv()));
|
2015-05-05 10:50:19 +08:00
|
|
|
auto lambda = [=](int larg0) -> void {
|
|
|
|
JSB_AUTOCOMPARTMENT_WITH_GLOBAL_OBJCET
|
|
|
|
jsval largv[1];
|
|
|
|
largv[0] = int32_to_jsval(cx, larg0);
|
|
|
|
JS::RootedValue rval(cx);
|
2015-07-30 18:50:00 +08:00
|
|
|
bool succeed = func->invoke(1, &largv[0], &rval);
|
|
|
|
if (!succeed && JS_IsExceptionPending(cx)) {
|
2015-05-05 10:50:19 +08:00
|
|
|
JS_ReportPendingException(cx);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
arg0 = lambda;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
arg0 = nullptr;
|
|
|
|
}
|
|
|
|
} while(0)
|
|
|
|
;
|
|
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_spine_SkeletonAnimation_setEndListener : Error processing arguments");
|
|
|
|
cobj->setEndListener(arg0);
|
|
|
|
args.rval().setUndefined();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_spine_SkeletonAnimation_setEndListener : wrong number of arguments: %d, was expecting %d", argc, 1);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
bool js_cocos2dx_spine_SkeletonAnimation_initialize(JSContext *cx, uint32_t argc, jsval *vp)
|
|
|
|
{
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
|
|
spine::SkeletonAnimation* cobj = (spine::SkeletonAnimation *)(proxy ? proxy->ptr : NULL);
|
|
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_spine_SkeletonAnimation_initialize : Invalid Native Object");
|
|
|
|
if (argc == 0) {
|
|
|
|
cobj->initialize();
|
|
|
|
args.rval().setUndefined();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_spine_SkeletonAnimation_initialize : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
bool js_cocos2dx_spine_SkeletonAnimation_clearTracks(JSContext *cx, uint32_t argc, jsval *vp)
|
|
|
|
{
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
|
|
spine::SkeletonAnimation* cobj = (spine::SkeletonAnimation *)(proxy ? proxy->ptr : NULL);
|
|
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_spine_SkeletonAnimation_clearTracks : Invalid Native Object");
|
|
|
|
if (argc == 0) {
|
|
|
|
cobj->clearTracks();
|
|
|
|
args.rval().setUndefined();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_spine_SkeletonAnimation_clearTracks : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
bool js_cocos2dx_spine_SkeletonAnimation_clearTrack(JSContext *cx, uint32_t argc, jsval *vp)
|
|
|
|
{
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
|
|
bool ok = true;
|
|
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
|
|
spine::SkeletonAnimation* cobj = (spine::SkeletonAnimation *)(proxy ? proxy->ptr : NULL);
|
|
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_spine_SkeletonAnimation_clearTrack : Invalid Native Object");
|
|
|
|
if (argc == 0) {
|
|
|
|
cobj->clearTrack();
|
|
|
|
args.rval().setUndefined();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if (argc == 1) {
|
2015-09-14 12:01:38 +08:00
|
|
|
int arg0 = 0;
|
2015-05-05 10:50:19 +08:00
|
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_spine_SkeletonAnimation_clearTrack : Error processing arguments");
|
|
|
|
cobj->clearTrack(arg0);
|
|
|
|
args.rval().setUndefined();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_spine_SkeletonAnimation_clearTrack : wrong number of arguments: %d, was expecting %d", argc, 0);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
bool js_cocos2dx_spine_SkeletonAnimation_onAnimationStateEvent(JSContext *cx, uint32_t argc, jsval *vp)
|
|
|
|
{
|
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
|
|
bool ok = true;
|
|
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
|
|
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
|
|
|
spine::SkeletonAnimation* cobj = (spine::SkeletonAnimation *)(proxy ? proxy->ptr : NULL);
|
|
|
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_spine_SkeletonAnimation_onAnimationStateEvent : Invalid Native Object");
|
|
|
|
if (argc == 4) {
|
2015-09-14 12:01:38 +08:00
|
|
|
int arg0 = 0;
|
2015-05-05 10:50:19 +08:00
|
|
|
spEventType arg1;
|
2015-09-14 12:01:38 +08:00
|
|
|
spEvent* arg2 = nullptr;
|
|
|
|
int arg3 = 0;
|
2015-05-05 10:50:19 +08:00
|
|
|
ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
|
|
|
|
ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1);
|
|
|
|
#pragma warning NO CONVERSION TO NATIVE FOR spEvent*
|
|
|
|
ok = false;
|
|
|
|
ok &= jsval_to_int32(cx, args.get(3), (int32_t *)&arg3);
|
|
|
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_spine_SkeletonAnimation_onAnimationStateEvent : Error processing arguments");
|
|
|
|
cobj->onAnimationStateEvent(arg0, arg1, arg2, arg3);
|
|
|
|
args.rval().setUndefined();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_spine_SkeletonAnimation_onAnimationStateEvent : wrong number of arguments: %d, was expecting %d", argc, 4);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
bool js_cocos2dx_spine_SkeletonAnimation_createWithFile(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; }
|
|
|
|
std::string arg1;
|
|
|
|
ok &= jsval_to_std_string(cx, args.get(1), &arg1);
|
|
|
|
if (!ok) { ok = true; break; }
|
|
|
|
spine::SkeletonAnimation* ret = spine::SkeletonAnimation::createWithFile(arg0, arg1);
|
|
|
|
jsval jsret = JSVAL_NULL;
|
2015-12-08 11:05:23 +08:00
|
|
|
if (ret) {
|
|
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<spine::SkeletonAnimation>(cx, (spine::SkeletonAnimation*)ret));
|
|
|
|
} else {
|
|
|
|
jsret = JSVAL_NULL;
|
|
|
|
};
|
2015-05-05 10:50:19 +08:00
|
|
|
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; }
|
2015-09-14 12:01:38 +08:00
|
|
|
double arg2 = 0;
|
2016-05-30 17:27:04 +08:00
|
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
2015-05-05 10:50:19 +08:00
|
|
|
if (!ok) { ok = true; break; }
|
|
|
|
spine::SkeletonAnimation* ret = spine::SkeletonAnimation::createWithFile(arg0, arg1, arg2);
|
|
|
|
jsval jsret = JSVAL_NULL;
|
2015-12-08 11:05:23 +08:00
|
|
|
if (ret) {
|
|
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<spine::SkeletonAnimation>(cx, (spine::SkeletonAnimation*)ret));
|
|
|
|
} else {
|
|
|
|
jsret = JSVAL_NULL;
|
|
|
|
};
|
2015-05-05 10:50:19 +08:00
|
|
|
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; }
|
2015-09-14 12:01:38 +08:00
|
|
|
spAtlas* arg1 = nullptr;
|
2015-05-05 10:50:19 +08:00
|
|
|
#pragma warning NO CONVERSION TO NATIVE FOR spAtlas*
|
|
|
|
ok = false;
|
|
|
|
if (!ok) { ok = true; break; }
|
|
|
|
spine::SkeletonAnimation* ret = spine::SkeletonAnimation::createWithFile(arg0, arg1);
|
|
|
|
jsval jsret = JSVAL_NULL;
|
2015-12-08 11:05:23 +08:00
|
|
|
if (ret) {
|
|
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<spine::SkeletonAnimation>(cx, (spine::SkeletonAnimation*)ret));
|
|
|
|
} else {
|
|
|
|
jsret = JSVAL_NULL;
|
|
|
|
};
|
2015-05-05 10:50:19 +08:00
|
|
|
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; }
|
2015-09-14 12:01:38 +08:00
|
|
|
spAtlas* arg1 = nullptr;
|
2015-05-05 10:50:19 +08:00
|
|
|
#pragma warning NO CONVERSION TO NATIVE FOR spAtlas*
|
|
|
|
ok = false;
|
|
|
|
if (!ok) { ok = true; break; }
|
2015-09-14 12:01:38 +08:00
|
|
|
double arg2 = 0;
|
2016-05-30 17:27:04 +08:00
|
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
2015-05-05 10:50:19 +08:00
|
|
|
if (!ok) { ok = true; break; }
|
|
|
|
spine::SkeletonAnimation* ret = spine::SkeletonAnimation::createWithFile(arg0, arg1, arg2);
|
|
|
|
jsval jsret = JSVAL_NULL;
|
2015-12-08 11:05:23 +08:00
|
|
|
if (ret) {
|
|
|
|
jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject<spine::SkeletonAnimation>(cx, (spine::SkeletonAnimation*)ret));
|
|
|
|
} else {
|
|
|
|
jsret = JSVAL_NULL;
|
|
|
|
};
|
2015-05-05 10:50:19 +08:00
|
|
|
args.rval().set(jsret);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
} while (0);
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_spine_SkeletonAnimation_createWithFile : wrong number of arguments");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
bool js_cocos2dx_spine_SkeletonAnimation_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
|
|
{
|
|
|
|
bool ok = true;
|
2015-09-25 16:43:00 +08:00
|
|
|
spine::SkeletonAnimation* cobj = nullptr;
|
2015-05-05 10:50:19 +08:00
|
|
|
|
2015-09-25 16:43:00 +08:00
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
2015-05-05 10:50:19 +08:00
|
|
|
JS::RootedObject obj(cx);
|
|
|
|
do {
|
|
|
|
if (argc == 1) {
|
2015-09-14 12:01:38 +08:00
|
|
|
spSkeletonData* arg0 = nullptr;
|
2015-05-05 10:50:19 +08:00
|
|
|
#pragma warning NO CONVERSION TO NATIVE FOR spSkeletonData*
|
|
|
|
ok = false;
|
|
|
|
if (!ok) { ok = true; break; }
|
|
|
|
cobj = new (std::nothrow) spine::SkeletonAnimation(arg0);
|
2015-12-03 06:45:13 +08:00
|
|
|
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<spine::SkeletonAnimation>(cobj);
|
2015-12-01 12:32:19 +08:00
|
|
|
JS::RootedObject proto(cx, typeClass->proto.ref());
|
|
|
|
JS::RootedObject parent(cx, typeClass->parentProto.ref());
|
2015-05-05 10:50:19 +08:00
|
|
|
obj = JS_NewObject(cx, typeClass->jsclass, proto, parent);
|
2015-07-30 04:42:46 +08:00
|
|
|
js_proxy_t* p = jsb_new_proxy(cobj, obj);
|
2015-12-03 06:45:13 +08:00
|
|
|
jsb_ref_init(cx, &p->obj, cobj, "spine::SkeletonAnimation");
|
2015-07-30 04:42:46 +08:00
|
|
|
}
|
|
|
|
} while(0);
|
|
|
|
|
|
|
|
do {
|
|
|
|
if (argc == 2) {
|
2015-09-14 12:01:38 +08:00
|
|
|
spSkeletonData* arg0 = nullptr;
|
2015-07-30 04:42:46 +08:00
|
|
|
#pragma warning NO CONVERSION TO NATIVE FOR spSkeletonData*
|
|
|
|
ok = false;
|
|
|
|
if (!ok) { ok = true; break; }
|
|
|
|
bool arg1;
|
|
|
|
arg1 = JS::ToBoolean(args.get(1));
|
|
|
|
cobj = new (std::nothrow) spine::SkeletonAnimation(arg0, arg1);
|
2015-12-03 06:45:13 +08:00
|
|
|
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<spine::SkeletonAnimation>(cobj);
|
2015-12-01 12:32:19 +08:00
|
|
|
JS::RootedObject proto(cx, typeClass->proto.ref());
|
|
|
|
JS::RootedObject parent(cx, typeClass->parentProto.ref());
|
2015-07-30 04:42:46 +08:00
|
|
|
obj = JS_NewObject(cx, typeClass->jsclass, proto, parent);
|
2015-05-05 10:50:19 +08:00
|
|
|
js_proxy_t* p = jsb_new_proxy(cobj, obj);
|
2015-12-03 06:45:13 +08:00
|
|
|
jsb_ref_init(cx, &p->obj, cobj, "spine::SkeletonAnimation");
|
2015-05-05 10:50:19 +08:00
|
|
|
}
|
|
|
|
} while(0);
|
|
|
|
|
|
|
|
do {
|
|
|
|
if (argc == 0) {
|
|
|
|
cobj = new (std::nothrow) spine::SkeletonAnimation();
|
2015-12-03 06:45:13 +08:00
|
|
|
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<spine::SkeletonAnimation>(cobj);
|
2015-12-01 12:32:19 +08:00
|
|
|
JS::RootedObject proto(cx, typeClass->proto.ref());
|
|
|
|
JS::RootedObject parent(cx, typeClass->parentProto.ref());
|
2015-05-05 10:50:19 +08:00
|
|
|
obj = JS_NewObject(cx, typeClass->jsclass, proto, parent);
|
|
|
|
js_proxy_t* p = jsb_new_proxy(cobj, obj);
|
2015-12-03 06:45:13 +08:00
|
|
|
jsb_ref_init(cx, &p->obj, cobj, "spine::SkeletonAnimation");
|
2015-05-05 10:50:19 +08:00
|
|
|
}
|
|
|
|
} while(0);
|
|
|
|
|
|
|
|
do {
|
|
|
|
if (argc == 2) {
|
|
|
|
std::string arg0;
|
|
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
|
|
if (!ok) { ok = true; break; }
|
2015-09-14 12:01:38 +08:00
|
|
|
spAtlas* arg1 = nullptr;
|
2015-05-05 10:50:19 +08:00
|
|
|
#pragma warning NO CONVERSION TO NATIVE FOR spAtlas*
|
|
|
|
ok = false;
|
|
|
|
if (!ok) { ok = true; break; }
|
|
|
|
cobj = new (std::nothrow) spine::SkeletonAnimation(arg0, arg1);
|
2015-12-03 06:45:13 +08:00
|
|
|
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<spine::SkeletonAnimation>(cobj);
|
2015-12-01 12:32:19 +08:00
|
|
|
JS::RootedObject proto(cx, typeClass->proto.ref());
|
|
|
|
JS::RootedObject parent(cx, typeClass->parentProto.ref());
|
2015-05-05 10:50:19 +08:00
|
|
|
obj = JS_NewObject(cx, typeClass->jsclass, proto, parent);
|
|
|
|
js_proxy_t* p = jsb_new_proxy(cobj, obj);
|
2015-12-03 06:45:13 +08:00
|
|
|
jsb_ref_init(cx, &p->obj, cobj, "spine::SkeletonAnimation");
|
2015-05-05 10:50:19 +08:00
|
|
|
}
|
|
|
|
} while(0);
|
|
|
|
|
|
|
|
do {
|
|
|
|
if (argc == 3) {
|
|
|
|
std::string arg0;
|
|
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
|
|
if (!ok) { ok = true; break; }
|
2015-09-14 12:01:38 +08:00
|
|
|
spAtlas* arg1 = nullptr;
|
2015-05-05 10:50:19 +08:00
|
|
|
#pragma warning NO CONVERSION TO NATIVE FOR spAtlas*
|
|
|
|
ok = false;
|
|
|
|
if (!ok) { ok = true; break; }
|
2015-09-14 12:01:38 +08:00
|
|
|
double arg2 = 0;
|
2016-05-30 17:27:04 +08:00
|
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
2015-05-05 10:50:19 +08:00
|
|
|
if (!ok) { ok = true; break; }
|
|
|
|
cobj = new (std::nothrow) spine::SkeletonAnimation(arg0, arg1, arg2);
|
2015-12-03 06:45:13 +08:00
|
|
|
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<spine::SkeletonAnimation>(cobj);
|
2015-12-01 12:32:19 +08:00
|
|
|
JS::RootedObject proto(cx, typeClass->proto.ref());
|
|
|
|
JS::RootedObject parent(cx, typeClass->parentProto.ref());
|
2015-05-05 10:50:19 +08:00
|
|
|
obj = JS_NewObject(cx, typeClass->jsclass, proto, parent);
|
|
|
|
js_proxy_t* p = jsb_new_proxy(cobj, obj);
|
2015-12-03 06:45:13 +08:00
|
|
|
jsb_ref_init(cx, &p->obj, cobj, "spine::SkeletonAnimation");
|
2015-05-05 10:50:19 +08:00
|
|
|
}
|
|
|
|
} 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; }
|
|
|
|
cobj = new (std::nothrow) spine::SkeletonAnimation(arg0, arg1);
|
2015-12-03 06:45:13 +08:00
|
|
|
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<spine::SkeletonAnimation>(cobj);
|
2015-12-01 12:32:19 +08:00
|
|
|
JS::RootedObject proto(cx, typeClass->proto.ref());
|
|
|
|
JS::RootedObject parent(cx, typeClass->parentProto.ref());
|
2015-05-05 10:50:19 +08:00
|
|
|
obj = JS_NewObject(cx, typeClass->jsclass, proto, parent);
|
|
|
|
js_proxy_t* p = jsb_new_proxy(cobj, obj);
|
2015-12-03 06:45:13 +08:00
|
|
|
jsb_ref_init(cx, &p->obj, cobj, "spine::SkeletonAnimation");
|
2015-05-05 10:50:19 +08:00
|
|
|
}
|
|
|
|
} 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; }
|
2015-09-14 12:01:38 +08:00
|
|
|
double arg2 = 0;
|
2016-05-30 17:27:04 +08:00
|
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
2015-05-05 10:50:19 +08:00
|
|
|
if (!ok) { ok = true; break; }
|
|
|
|
cobj = new (std::nothrow) spine::SkeletonAnimation(arg0, arg1, arg2);
|
2015-12-03 06:45:13 +08:00
|
|
|
|
|
|
|
js_type_class_t *typeClass = js_get_type_from_native<spine::SkeletonAnimation>(cobj);
|
2015-12-01 12:32:19 +08:00
|
|
|
JS::RootedObject proto(cx, typeClass->proto.ref());
|
|
|
|
JS::RootedObject parent(cx, typeClass->parentProto.ref());
|
2015-05-05 10:50:19 +08:00
|
|
|
obj = JS_NewObject(cx, typeClass->jsclass, proto, parent);
|
|
|
|
js_proxy_t* p = jsb_new_proxy(cobj, obj);
|
2015-12-03 06:45:13 +08:00
|
|
|
jsb_ref_init(cx, &p->obj, cobj, "spine::SkeletonAnimation");
|
2015-05-05 10:50:19 +08:00
|
|
|
}
|
|
|
|
} while(0);
|
|
|
|
|
|
|
|
if (cobj) {
|
|
|
|
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
|
|
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
|
|
|
|
|
|
args.rval().set(OBJECT_TO_JSVAL(obj));
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_spine_SkeletonAnimation_constructor : wrong number of arguments");
|
|
|
|
return false;
|
|
|
|
}
|
2015-07-30 18:50:00 +08:00
|
|
|
bool js_cocos2dx_spine_SkeletonAnimation_ctor(JSContext *cx, uint32_t argc, jsval *vp)
|
|
|
|
{
|
|
|
|
bool ok = true;
|
2015-09-25 16:43:00 +08:00
|
|
|
spine::SkeletonAnimation* cobj = nullptr;
|
2015-07-30 18:50:00 +08:00
|
|
|
|
2015-09-25 16:43:00 +08:00
|
|
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
|
|
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
2015-07-30 18:50:00 +08:00
|
|
|
do {
|
|
|
|
if (argc == 1) {
|
2015-09-14 12:01:38 +08:00
|
|
|
spSkeletonData* arg0 = nullptr;
|
2015-07-30 18:50:00 +08:00
|
|
|
#pragma warning NO CONVERSION TO NATIVE FOR spSkeletonData*
|
|
|
|
ok = false;
|
|
|
|
if (!ok) { ok = true; break; }
|
|
|
|
cobj = new (std::nothrow) spine::SkeletonAnimation(arg0);
|
|
|
|
|
|
|
|
js_proxy_t* p = jsb_new_proxy(cobj, obj);
|
2015-12-03 06:45:13 +08:00
|
|
|
jsb_ref_init(cx, &p->obj, cobj, "spine::SkeletonAnimation");
|
2015-07-30 18:50:00 +08:00
|
|
|
}
|
|
|
|
} while(0);
|
|
|
|
|
|
|
|
do {
|
|
|
|
if (argc == 2) {
|
2015-09-14 12:01:38 +08:00
|
|
|
spSkeletonData* arg0 = nullptr;
|
2015-07-30 18:50:00 +08:00
|
|
|
#pragma warning NO CONVERSION TO NATIVE FOR spSkeletonData*
|
|
|
|
ok = false;
|
|
|
|
if (!ok) { ok = true; break; }
|
|
|
|
bool arg1;
|
|
|
|
arg1 = JS::ToBoolean(args.get(1));
|
|
|
|
cobj = new (std::nothrow) spine::SkeletonAnimation(arg0, arg1);
|
|
|
|
|
|
|
|
js_proxy_t* p = jsb_new_proxy(cobj, obj);
|
2015-12-03 06:45:13 +08:00
|
|
|
jsb_ref_init(cx, &p->obj, cobj, "spine::SkeletonAnimation");
|
2015-07-30 18:50:00 +08:00
|
|
|
}
|
|
|
|
} while(0);
|
|
|
|
|
|
|
|
do {
|
|
|
|
if (argc == 0) {
|
|
|
|
cobj = new (std::nothrow) spine::SkeletonAnimation();
|
|
|
|
|
|
|
|
js_proxy_t* p = jsb_new_proxy(cobj, obj);
|
2015-12-03 06:45:13 +08:00
|
|
|
jsb_ref_init(cx, &p->obj, cobj, "spine::SkeletonAnimation");
|
2015-07-30 18:50:00 +08:00
|
|
|
}
|
|
|
|
} while(0);
|
|
|
|
|
|
|
|
do {
|
|
|
|
if (argc == 2) {
|
|
|
|
std::string arg0;
|
|
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
|
|
if (!ok) { ok = true; break; }
|
2015-09-14 12:01:38 +08:00
|
|
|
spAtlas* arg1 = nullptr;
|
2015-07-30 18:50:00 +08:00
|
|
|
#pragma warning NO CONVERSION TO NATIVE FOR spAtlas*
|
|
|
|
ok = false;
|
|
|
|
if (!ok) { ok = true; break; }
|
|
|
|
cobj = new (std::nothrow) spine::SkeletonAnimation(arg0, arg1);
|
|
|
|
|
|
|
|
js_proxy_t* p = jsb_new_proxy(cobj, obj);
|
2015-12-03 06:45:13 +08:00
|
|
|
jsb_ref_init(cx, &p->obj, cobj, "spine::SkeletonAnimation");
|
2015-07-30 18:50:00 +08:00
|
|
|
}
|
|
|
|
} while(0);
|
|
|
|
|
|
|
|
do {
|
|
|
|
if (argc == 3) {
|
|
|
|
std::string arg0;
|
|
|
|
ok &= jsval_to_std_string(cx, args.get(0), &arg0);
|
|
|
|
if (!ok) { ok = true; break; }
|
2015-09-14 12:01:38 +08:00
|
|
|
spAtlas* arg1 = nullptr;
|
2015-07-30 18:50:00 +08:00
|
|
|
#pragma warning NO CONVERSION TO NATIVE FOR spAtlas*
|
|
|
|
ok = false;
|
|
|
|
if (!ok) { ok = true; break; }
|
2015-09-14 12:01:38 +08:00
|
|
|
double arg2 = 0;
|
2016-05-30 17:27:04 +08:00
|
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
2015-07-30 18:50:00 +08:00
|
|
|
if (!ok) { ok = true; break; }
|
|
|
|
cobj = new (std::nothrow) spine::SkeletonAnimation(arg0, arg1, arg2);
|
|
|
|
|
|
|
|
js_proxy_t* p = jsb_new_proxy(cobj, obj);
|
2015-12-03 06:45:13 +08:00
|
|
|
jsb_ref_init(cx, &p->obj, cobj, "spine::SkeletonAnimation");
|
2015-07-30 18:50:00 +08:00
|
|
|
}
|
|
|
|
} 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; }
|
|
|
|
cobj = new (std::nothrow) spine::SkeletonAnimation(arg0, arg1);
|
|
|
|
|
|
|
|
js_proxy_t* p = jsb_new_proxy(cobj, obj);
|
2015-12-03 06:45:13 +08:00
|
|
|
jsb_ref_init(cx, &p->obj, cobj, "spine::SkeletonAnimation");
|
2015-07-30 18:50:00 +08:00
|
|
|
}
|
|
|
|
} 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; }
|
2015-09-14 12:01:38 +08:00
|
|
|
double arg2 = 0;
|
2016-05-30 17:27:04 +08:00
|
|
|
ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2);
|
2015-07-30 18:50:00 +08:00
|
|
|
if (!ok) { ok = true; break; }
|
|
|
|
cobj = new (std::nothrow) spine::SkeletonAnimation(arg0, arg1, arg2);
|
|
|
|
|
|
|
|
js_proxy_t* p = jsb_new_proxy(cobj, obj);
|
2015-12-03 06:45:13 +08:00
|
|
|
jsb_ref_init(cx, &p->obj, cobj, "spine::SkeletonAnimation");
|
2015-07-30 18:50:00 +08:00
|
|
|
}
|
|
|
|
} while(0);
|
|
|
|
|
|
|
|
if (cobj) {
|
|
|
|
if (JS_HasProperty(cx, obj, "_ctor", &ok) && ok)
|
|
|
|
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), "_ctor", args);
|
|
|
|
|
|
|
|
args.rval().set(OBJECT_TO_JSVAL(obj));
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
JS_ReportError(cx, "js_cocos2dx_spine_SkeletonAnimation_ctor : wrong number of arguments");
|
|
|
|
return false;
|
|
|
|
}
|
2015-05-05 10:50:19 +08:00
|
|
|
|
|
|
|
|
|
|
|
extern JSObject *jsb_spine_SkeletonRenderer_prototype;
|
|
|
|
|
2015-07-30 18:50:00 +08:00
|
|
|
|
2015-05-05 10:50:19 +08:00
|
|
|
void js_register_cocos2dx_spine_SkeletonAnimation(JSContext *cx, JS::HandleObject global) {
|
|
|
|
jsb_spine_SkeletonAnimation_class = (JSClass *)calloc(1, sizeof(JSClass));
|
|
|
|
jsb_spine_SkeletonAnimation_class->name = "SkeletonAnimation";
|
|
|
|
jsb_spine_SkeletonAnimation_class->addProperty = JS_PropertyStub;
|
|
|
|
jsb_spine_SkeletonAnimation_class->delProperty = JS_DeletePropertyStub;
|
|
|
|
jsb_spine_SkeletonAnimation_class->getProperty = JS_PropertyStub;
|
|
|
|
jsb_spine_SkeletonAnimation_class->setProperty = JS_StrictPropertyStub;
|
|
|
|
jsb_spine_SkeletonAnimation_class->enumerate = JS_EnumerateStub;
|
|
|
|
jsb_spine_SkeletonAnimation_class->resolve = JS_ResolveStub;
|
|
|
|
jsb_spine_SkeletonAnimation_class->convert = JS_ConvertStub;
|
|
|
|
jsb_spine_SkeletonAnimation_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
|
|
|
|
|
|
|
|
static JSPropertySpec properties[] = {
|
|
|
|
JS_PS_END
|
|
|
|
};
|
|
|
|
|
|
|
|
static JSFunctionSpec funcs[] = {
|
|
|
|
JS_FN("setStartListener", js_cocos2dx_spine_SkeletonAnimation_setStartListener, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
|
|
JS_FN("setTrackEventListener", js_cocos2dx_spine_SkeletonAnimation_setTrackEventListener, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
|
|
JS_FN("getState", js_cocos2dx_spine_SkeletonAnimation_getState, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
|
|
JS_FN("setTrackCompleteListener", js_cocos2dx_spine_SkeletonAnimation_setTrackCompleteListener, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
|
|
JS_FN("onTrackEntryEvent", js_cocos2dx_spine_SkeletonAnimation_onTrackEntryEvent, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
|
|
JS_FN("setTrackStartListener", js_cocos2dx_spine_SkeletonAnimation_setTrackStartListener, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
|
|
JS_FN("update", js_cocos2dx_spine_SkeletonAnimation_update, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
|
|
JS_FN("setCompleteListener", js_cocos2dx_spine_SkeletonAnimation_setCompleteListener, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
|
|
JS_FN("setTrackEndListener", js_cocos2dx_spine_SkeletonAnimation_setTrackEndListener, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
|
|
JS_FN("setEventListener", js_cocos2dx_spine_SkeletonAnimation_setEventListener, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
|
|
JS_FN("setMix", js_cocos2dx_spine_SkeletonAnimation_setMix, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
|
|
JS_FN("setEndListener", js_cocos2dx_spine_SkeletonAnimation_setEndListener, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
|
|
JS_FN("initialize", js_cocos2dx_spine_SkeletonAnimation_initialize, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
|
|
JS_FN("clearTracks", js_cocos2dx_spine_SkeletonAnimation_clearTracks, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
|
|
JS_FN("clearTrack", js_cocos2dx_spine_SkeletonAnimation_clearTrack, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
|
|
JS_FN("onAnimationStateEvent", js_cocos2dx_spine_SkeletonAnimation_onAnimationStateEvent, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
2015-07-30 18:50:00 +08:00
|
|
|
JS_FN("ctor", js_cocos2dx_spine_SkeletonAnimation_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
2015-05-05 10:50:19 +08:00
|
|
|
JS_FS_END
|
|
|
|
};
|
|
|
|
|
|
|
|
static JSFunctionSpec st_funcs[] = {
|
|
|
|
JS_FN("create", js_cocos2dx_spine_SkeletonAnimation_createWithFile, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
|
|
|
JS_FS_END
|
|
|
|
};
|
|
|
|
|
2015-12-01 12:32:19 +08:00
|
|
|
JS::RootedObject parent_proto(cx, jsb_spine_SkeletonRenderer_prototype);
|
2015-05-05 10:50:19 +08:00
|
|
|
jsb_spine_SkeletonAnimation_prototype = JS_InitClass(
|
|
|
|
cx, global,
|
2015-12-01 12:32:19 +08:00
|
|
|
parent_proto,
|
2015-05-05 10:50:19 +08:00
|
|
|
jsb_spine_SkeletonAnimation_class,
|
|
|
|
js_cocos2dx_spine_SkeletonAnimation_constructor, 0, // constructor
|
|
|
|
properties,
|
|
|
|
funcs,
|
|
|
|
NULL, // no static properties
|
|
|
|
st_funcs);
|
|
|
|
|
2015-12-01 12:32:19 +08:00
|
|
|
JS::RootedObject proto(cx, jsb_spine_SkeletonAnimation_prototype);
|
2016-02-14 14:53:19 +08:00
|
|
|
JS::RootedValue className(cx, std_string_to_jsval(cx, "SkeletonAnimation"));
|
|
|
|
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
|
2015-12-01 12:32:19 +08:00
|
|
|
jsb_register_class<spine::SkeletonAnimation>(cx, jsb_spine_SkeletonAnimation_class, proto, parent_proto);
|
2015-07-14 13:41:48 +08:00
|
|
|
anonEvaluate(cx, global, "(function () { sp.SkeletonAnimation.extend = cc.Class.extend; })()");
|
2015-05-05 10:50:19 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void register_all_cocos2dx_spine(JSContext* cx, JS::HandleObject obj) {
|
|
|
|
// Get the ns
|
|
|
|
JS::RootedObject ns(cx);
|
|
|
|
get_or_create_js_obj(cx, obj, "sp", &ns);
|
|
|
|
|
|
|
|
js_register_cocos2dx_spine_SkeletonRenderer(cx, ns);
|
|
|
|
js_register_cocos2dx_spine_SkeletonAnimation(cx, ns);
|
|
|
|
}
|
|
|
|
|