当前位置: 首页>>代码示例>>C++>>正文


C++ JSB_PRECONDITION2函数代码示例

本文整理汇总了C++中JSB_PRECONDITION2函数的典型用法代码示例。如果您正苦于以下问题:C++ JSB_PRECONDITION2函数的具体用法?C++ JSB_PRECONDITION2怎么用?C++ JSB_PRECONDITION2使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了JSB_PRECONDITION2函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: js_cocos2dx_custom_BinaryReadUtil_close

bool js_cocos2dx_custom_BinaryReadUtil_close(JSContext *cx, uint32_t argc, jsval *vp)
{
    JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
    JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
    js_proxy_t *proxy = jsb_get_js_proxy(obj);
    BinaryReadUtil* cobj = (BinaryReadUtil *)(proxy ? proxy->ptr : NULL);
    JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_custom_BinaryReadUtil_close : Invalid Native Object");
    if (argc == 0) {
        cobj->close();
        args.rval().setUndefined();
        return true;
    }

    JS_ReportError(cx, "js_cocos2dx_custom_BinaryReadUtil_close : wrong number of arguments: %d, was expecting %d", argc, 0);
    return false;
}
开发者ID:longtu207,项目名称:Run,代码行数:16,代码来源:jsb_cocos2dx_custom.cpp

示例2: js_cocos2dx_experimental_video_VideoPlayer_stop

bool js_cocos2dx_experimental_video_VideoPlayer_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::experimental::ui::VideoPlayer* cobj = (cocos2d::experimental::ui::VideoPlayer *)(proxy ? proxy->ptr : NULL);
    JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_experimental_video_VideoPlayer_stop : Invalid Native Object");
    if (argc == 0) {
        cobj->stop();
        args.rval().setUndefined();
        return true;
    }

    JS_ReportError(cx, "js_cocos2dx_experimental_video_VideoPlayer_stop : wrong number of arguments: %d, was expecting %d", argc, 0);
    return false;
}
开发者ID:NicholasLefave,项目名称:Cocos-JS-Memory-Game,代码行数:16,代码来源:jsb_cocos2dx_experimental_video_auto.cpp

示例3: jsval_to_int32

bool jsval_to_int32( JSContext *cx, jsval vp, int32_t *outval )
{
    bool ok = true;
    double dp;
    ok &= JS::ToNumber(cx, JS::RootedValue(cx, vp), &dp);
    if (!ok) {
        LOGD("jsval_to_int32: the argument is not a number");
        return false;
    }
    ok &= !isnan(dp);
    JSB_PRECONDITION2(ok, cx, false, "Error processing arguments");

    *outval = (int32_t)dp;

    return ok;
}
开发者ID:cocoTM,项目名称:xumc_demos,代码行数:16,代码来源:jsb_pluginx_basic_conversions.cpp

示例4: js_PluginAppnextJS_PluginAppnext_isVideoReady

bool js_PluginAppnextJS_PluginAppnext_isVideoReady(JSContext *cx, uint32_t argc, JS::Value *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_PluginAppnextJS_PluginAppnext_isVideoReady : Error processing arguments");
        bool ret = sdkbox::PluginAppnext::isVideoReady(arg0);
        JS::RootedValue jsret(cx);
        jsret = JS::BooleanValue(ret);
        args.rval().set(jsret);
        return true;
    }
    JS_ReportErrorUTF8(cx, "js_PluginAppnextJS_PluginAppnext_isVideoReady : wrong number of arguments");
    return false;
}
开发者ID:sdkbox,项目名称:sdkbox-sample-appnext,代码行数:17,代码来源:PluginAppnextJS.cpp

示例5: js_call_CCDrawLine

JSBool js_call_CCDrawLine(JSContext *cx, uint32_t argc, jsval *vp)
{
	jsval *argv = JS_ARGV(cx, vp);
	JSBool ok = JS_TRUE;
	if (argc == 2) 
	{
		cocos2d::CCPoint arg0;
		cocos2d::CCPoint arg1;
		ok &= jsval_to_ccpoint(cx, argv[0], &arg0);
		ok &= jsval_to_ccpoint(cx, argv[1], &arg1);
		JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
		ccDrawLine(arg0,arg1);
		JS_SET_RVAL(cx, vp, JSVAL_VOID);
		return JS_TRUE;
	}
	return ok;
}
开发者ID:Puppy03,项目名称:ReleaseWin32,代码行数:17,代码来源:js_bindings_libcp.cpp

示例6: jsb_util_crc16

bool jsb_util_crc16(JSContext *cx, uint32_t argc, jsval *vp)
{
    JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
    //JS::RootedString appArgs(cx);
    if (argc == 1) {
        std::string arg0;

        bool ok = jsval_to_std_string(cx, args.get(0), &arg0);
        JSB_PRECONDITION2(ok, cx, false, "jsb_util_crc16 : Error processing arguments");

        args.rval().setInt32(Utils::CRC16(arg0.c_str()));
        return true;
    }

    JS_ReportError(cx, "jsb_util_crc16 : wrong number of arguments");
    return false;
}
开发者ID:wangxingfred,项目名称:SheetX,代码行数:17,代码来源:jsb_util.cpp

示例7: js_PluginGoogleAnalyticsJS_PluginGoogleAnalytics_setDimension

JSBool js_PluginGoogleAnalyticsJS_PluginGoogleAnalytics_setDimension(JSContext *cx, uint32_t argc, jsval *vp)
{
    jsval *argv = JS_ARGV(cx, vp);
    JSBool ok = JS_TRUE;
    if (argc == 2) {
        int arg0;
        std::string arg1;
        ok &= jsval_to_int32(cx, argv[0], (int32_t *)&arg0);
        ok &= jsval_to_std_string(cx, argv[1], &arg1);
        JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
        sdkbox::PluginGoogleAnalytics::setDimension(arg0, arg1);
        JS_SET_RVAL(cx, vp, JSVAL_VOID);
        return JS_TRUE;
    }
    JS_ReportError(cx, "wrong number of arguments");
    return JS_FALSE;
}
开发者ID:sdkbox,项目名称:sdkbox-sample-ga,代码行数:17,代码来源:PluginGoogleAnalyticsJS.cpp

示例8: js_controls_Button_getNormalTextureScaleInSize

bool js_controls_Button_getNormalTextureScaleInSize(JSContext *cx, uint32_t argc, jsval *vp)
{
	JSObject *obj = JS_THIS_OBJECT(cx, vp);
	js_proxy_t *proxy = jsb_get_js_proxy(obj);
	es::Button* cobj = (es::Button *)(proxy ? proxy->ptr : NULL);
	JSB_PRECONDITION2( cobj, cx, false, "js_controls_Button_getNormalTextureScaleInSize : Invalid Native Object");
	if (argc == 0) {
		cocos2d::Size ret = cobj->getNormalTextureScaleInSize();
		jsval jsret = JSVAL_NULL;
		jsret = ccsize_to_jsval(cx, ret);
		JS_SET_RVAL(cx, vp, jsret);
		return true;
	}

	JS_ReportError(cx, "js_controls_Button_getNormalTextureScaleInSize : wrong number of arguments: %d, was expecting %d", argc, 0);
	return false;
}
开发者ID:tovchenko,项目名称:espreso,代码行数:17,代码来源:jsb_controls_auto.cpp

示例9: js_PluginAdColonyJS_PluginAdColony_getVideoCreditBalance

bool js_PluginAdColonyJS_PluginAdColony_getVideoCreditBalance(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_PluginAdColonyJS_PluginAdColony_getVideoCreditBalance : Error processing arguments");
        int ret = sdkbox::PluginAdColony::getVideoCreditBalance(arg0);
        jsval jsret = JSVAL_NULL;
        jsret = int32_to_jsval(cx, ret);
        args.rval().set(jsret);
        return true;
    }
    JS_ReportError(cx, "js_PluginAdColonyJS_PluginAdColony_getVideoCreditBalance : wrong number of arguments");
    return false;
}
开发者ID:yinjimmy,项目名称:sdkbox-samples,代码行数:17,代码来源:PluginAdColonyJS.cpp

示例10: js_PluginAppodealJS_PluginAppodeal_disableNetworkForAdType

bool js_PluginAppodealJS_PluginAppodeal_disableNetworkForAdType(JSContext *cx, uint32_t argc, jsval *vp)
{
    JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
    bool ok = true;
    if (argc == 2) {
        sdkbox::PluginAppodeal::AdType arg0;
        std::string arg1;
        ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0);
        ok &= jsval_to_std_string(cx, args.get(1), &arg1);
        JSB_PRECONDITION2(ok, cx, false, "js_PluginAppodealJS_PluginAppodeal_disableNetworkForAdType : Error processing arguments");
        sdkbox::PluginAppodeal::disableNetworkForAdType(arg0, arg1);
        args.rval().setUndefined();
        return true;
    }
    JS_ReportError(cx, "js_PluginAppodealJS_PluginAppodeal_disableNetworkForAdType : wrong number of arguments");
    return false;
}
开发者ID:sdkbox,项目名称:sdkbox-sample-appodeal,代码行数:17,代码来源:PluginAppodealJS.cpp

示例11: js_PluginLeaderboardJS_PluginLeaderboard_submitScore

JSBool js_PluginLeaderboardJS_PluginLeaderboard_submitScore(JSContext *cx, uint32_t argc, jsval *vp)
{
    jsval *argv = JS_ARGV(cx, vp);
    JSBool ok = JS_TRUE;
    if (argc == 2) {
        std::string arg0;
        int arg1;
        ok &= jsval_to_std_string(cx, argv[0], &arg0);
        ok &= jsval_to_int32(cx, argv[1], (int32_t *)&arg1);
        JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
        sdkbox::PluginLeaderboard::submitScore(arg0, arg1);
        JS_SET_RVAL(cx, vp, JSVAL_VOID);
        return JS_TRUE;
    }
    JS_ReportError(cx, "wrong number of arguments");
    return JS_FALSE;
}
开发者ID:sdkbox,项目名称:sdkbox-sample-playphone,代码行数:17,代码来源:PluginLeaderboardJS.cpp

示例12: js_cocos2dx_spine_Skeleton_getBlendFunc

JSBool js_cocos2dx_spine_Skeleton_getBlendFunc(JSContext *cx, uint32_t argc, jsval *vp)
{
	JSObject *obj = JS_THIS_OBJECT(cx, vp);
	js_proxy_t *proxy = jsb_get_js_proxy(obj);
	spine::Skeleton* cobj = (spine::Skeleton *)(proxy ? proxy->ptr : NULL);
	JSB_PRECONDITION2( cobj, cx, JS_FALSE, "js_cocos2dx_spine_Skeleton_getBlendFunc : Invalid Native Object");
	if (argc == 0) {
		const cocos2d::BlendFunc& ret = cobj->getBlendFunc();
		jsval jsret = JSVAL_NULL;
		#pragma warning NO CONVERSION FROM NATIVE FOR BlendFunc;
		JS_SET_RVAL(cx, vp, jsret);
		return JS_TRUE;
	}

	JS_ReportError(cx, "js_cocos2dx_spine_Skeleton_getBlendFunc : wrong number of arguments: %d, was expecting %d", argc, 0);
	return JS_FALSE;
}
开发者ID:6520874,项目名称:pipiGame,代码行数:17,代码来源:jsb_cocos2dx_spine_auto.cpp

示例13: js_cocos2dx_spine_Skeleton_getBlendFunc

bool js_cocos2dx_spine_Skeleton_getBlendFunc(JSContext *cx, uint32_t argc, jsval *vp)
{
	JSObject *obj = JS_THIS_OBJECT(cx, vp);
	js_proxy_t *proxy = jsb_get_js_proxy(obj);
	spine::Skeleton* cobj = (spine::Skeleton *)(proxy ? proxy->ptr : NULL);
	JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_spine_Skeleton_getBlendFunc : Invalid Native Object");
	if (argc == 0) {
		const cocos2d::BlendFunc& ret = cobj->getBlendFunc();
		jsval jsret = JSVAL_NULL;
		jsret = blendfunc_to_jsval(cx, ret);
		JS_SET_RVAL(cx, vp, jsret);
		return true;
	}

	JS_ReportError(cx, "js_cocos2dx_spine_Skeleton_getBlendFunc : wrong number of arguments: %d, was expecting %d", argc, 0);
	return false;
}
开发者ID:2youyou2,项目名称:cocos2d-js,代码行数:17,代码来源:jsb_cocos2dx_spine_auto.cpp

示例14: js_PluginChartboostJS_PluginChartboost_isAvailable

JSBool js_PluginChartboostJS_PluginChartboost_isAvailable(JSContext *cx, uint32_t argc, jsval *vp)
{
    jsval *argv = JS_ARGV(cx, vp);
    JSBool ok = JS_TRUE;
    if (argc == 1) {
        std::string arg0;
        ok &= jsval_to_std_string(cx, argv[0], &arg0);
        JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments");
        bool ret = sdkbox::PluginChartboost::isAvailable(arg0);
        jsval jsret;
        jsret = BOOLEAN_TO_JSVAL(ret);
        JS_SET_RVAL(cx, vp, jsret);
        return JS_TRUE;
    }
    JS_ReportError(cx, "wrong number of arguments");
    return JS_FALSE;
}
开发者ID:wanghuan1115,项目名称:sdkbox-chartboost-sample,代码行数:17,代码来源:PluginChartboostJS.cpp

示例15: js_PluginAdColonyJS_PluginAdColony_setUserMetadata

bool js_PluginAdColonyJS_PluginAdColony_setUserMetadata(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_PluginAdColonyJS_PluginAdColony_setUserMetadata : Error processing arguments");
        sdkbox::PluginAdColony::setUserMetadata(arg0, arg1);
        args.rval().setUndefined();
        return true;
    }
    JS_ReportError(cx, "js_PluginAdColonyJS_PluginAdColony_setUserMetadata : wrong number of arguments");
    return false;
}
开发者ID:yinjimmy,项目名称:sdkbox-samples,代码行数:17,代码来源:PluginAdColonyJS.cpp


注:本文中的JSB_PRECONDITION2函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。