1
2
3
4
5
6
7
8
9
10
11
12
|
@H_502_74@
// "create" in JS
// cc.MenuItemImage.create( normalImage,selectedImage,[disabledImage],callback_fn,[this]
JSBool js_cocos2dx_CCMenuItemImage_create(JSContext *cx,uint32_t argc,jsval *vp)
{
if
(argc >= 2 && argc <= 5) {
jsval *argv = JS_ARGV(cx,vp);
JSStringWrapper arg0(argv[0]);
JSStringWrapper arg1(argv[1]);
JSStringWrapper arg2;
bool
thirdArgIsString =
true
;
jsval jsCallback = JSVAL_VOID;
jsval jsThis = JSVAL_VOID;
int
last = 2;
(argc >= 3) {
thirdArgIsString = argv[2].isString();
(thirdArgIsString) {
arg2.set(argv[2],cx);
last = 3;
}
}
cocos2d::MenuItemImage* ret = cocos2d::MenuItemImage::create(arg0.get(),arg1.get(),std::string(arg2.get()));
(argc >= 3) {
(!thirdArgIsString) {
//cc.MenuItemImage.create( normalImage,[this] )
jsCallback = argv[last++];
(argc == 4) {
jsThis = argv[last];
}
}
else
{
(argc >= 4) {
jsCallback = argv[last++];
(argc == 5) {
jsThis = argv[last];
}
}
}
}
JSObject *obj = bind_menu_item<cocos2d::MenuItemImage>(cx,ret,jsCallback,jsThis);
JS_SET_RVAL(cx,vp,OBJECT_TO_JSVAL(obj));
return
JS_TRUE;
}
JS_ReportError(cx,
"Invalid number of arguments. Expecting: 2 <= args <= 5"
);
JS_FALSE;
}
(argc >= 3) {
(!thirdArgIsString) {
jsCallback = argv[last++];
(argc == 4) {
jsThis = argv[last];
}
}
{
(argc >= 4) {
jsCallback = argv[last++];
(argc == 5) {
jsThis = argv[last];
}
}
}
}