1
2
|
void
CCNode::setScale(
float
scale)
void
CCNode::setScale(
float
scaleX,
float
scaleY)
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
JSBool js_cocos2dx_Node_setScale(JSContext *cx, uint32_t argc, jsval *vp)
{
jsval *argv = JS_ARGV(cx, vp);
JSBool ok = JS_TRUE;
JSObject *obj = NULL;
cocos2d::Node* cobj = NULL;
obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cobj = (cocos2d::Node *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, JS_FALSE,
"js_cocos2dx_Node_setScale : Invalid Native Object"
);
do
{
if
(argc == 2) {
double
arg0;
ok &= JS_ValueToNumber(cx, argv[0], &arg0);
if
(!ok) { ok = JS_TRUE;
break
; }
double
arg1;
ok &= JS_ValueToNumber(cx, argv[1], &arg1);
if
(!ok) { ok = JS_TRUE;
break
; }
cobj->setScale(arg0, arg1);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return
JS_TRUE;
}
}
while
(0);
do
{
if
(argc == 1) {
double
arg0;
ok &= JS_ValueToNumber(cx, argv[0], &arg0);
if
(!ok) { ok = JS_TRUE;
break
; }
cobj->setScale(arg0);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return
JS_TRUE;
}
}
while
(0);
JS_ReportError(cx,
"js_cocos2dx_Node_setScale : wrong number of arguments"
);
return
JS_FALSE;
}
|
1
2
3
4
5
6
7
8
9
10
11
|
setPosition:
function
(newPosOrxValue, yValue) {
var
locPosition =
this
._position;
if
(arguments.length == 2) {
locPosition._x = newPosOrxValue;
locPosition._y = yValue;
}
else
if
(arguments.length == 1) {
locPosition._x = newPosOrxValue.x;
locPosition._y = newPosOrxValue.y;
}
this
.setNodeDirty();
},
|