mirror of https://github.com/axmolengine/axmol.git
issue #1555: Minor fixes.
This commit is contained in:
parent
18273e06e3
commit
0223c0d70a
|
@ -47,27 +47,26 @@ void CCPhysicsSprite::setPosition(const cocos2d::CCPoint &pos) {
|
||||||
|
|
||||||
|
|
||||||
float CCPhysicsSprite::getRotation() {
|
float CCPhysicsSprite::getRotation() {
|
||||||
return (_ignoreBodyRotation ? m_fRotation : -CC_RADIANS_TO_DEGREES(cpBodyGetAngle(_body)));
|
return (_ignoreBodyRotation ? CCSprite::getRotation() : -CC_RADIANS_TO_DEGREES(cpBodyGetAngle(_body)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCPhysicsSprite::setRotation(float rotation) {
|
void CCPhysicsSprite::setRotation(float rotation) {
|
||||||
if(_ignoreBodyRotation){
|
if(_ignoreBodyRotation){
|
||||||
m_fRotation = rotation;
|
CCSprite::setRotation(rotation);
|
||||||
} else {
|
} else {
|
||||||
cpBodySetAngle(_body, -CC_DEGREES_TO_RADIANS(rotation));
|
cpBodySetAngle(_body, -CC_DEGREES_TO_RADIANS(rotation));
|
||||||
m_fRotation = -CC_DEGREES_TO_RADIANS(rotation);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cocos2d::CCAffineTransform CCPhysicsSprite::nodeToParentTransform() {
|
cocos2d::CCAffineTransform CCPhysicsSprite::nodeToParentTransform() {
|
||||||
cpVect rot = (_ignoreBodyRotation ? cpvforangle(-CC_DEGREES_TO_RADIANS(m_fRotation)) : _body->rot);
|
cpVect rot = (_ignoreBodyRotation ? cpvforangle(-CC_DEGREES_TO_RADIANS(m_fRotationX)) : _body->rot);
|
||||||
float x = _body->p.x + rot.x*-m_tAnchorPointInPoints.x - rot.y*-m_tAnchorPointInPoints.y;
|
float x = _body->p.x + rot.x*-m_obAnchorPointInPoints.x - rot.y*-m_obAnchorPointInPoints.y;
|
||||||
float y = _body->p.y + rot.y*-m_tAnchorPointInPoints.x + rot.x*-m_tAnchorPointInPoints.y;
|
float y = _body->p.y + rot.y*-m_obAnchorPointInPoints.x + rot.x*-m_obAnchorPointInPoints.y;
|
||||||
|
|
||||||
if(m_bIgnoreAnchorPointForPosition){
|
if(m_bIgnoreAnchorPointForPosition){
|
||||||
x += m_tAnchorPointInPoints.x;
|
x += m_obAnchorPointInPoints.x;
|
||||||
y += m_tAnchorPointInPoints.y;
|
y += m_obAnchorPointInPoints.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (m_tTransform = cocos2d::__CCAffineTransformMake(rot.x, rot.y, -rot.y, rot.x, x, y));
|
return (m_sTransform = cocos2d::__CCAffineTransformMake(rot.x, rot.y, -rot.y, rot.x, x, y));
|
||||||
}
|
}
|
||||||
|
|
|
@ -851,13 +851,13 @@ JSBool js_cocos2dx_CCScheduler_unscheduleAllSelectorsForTarget(JSContext *cx, ui
|
||||||
if(! arr) return JS_FALSE;
|
if(! arr) return JS_FALSE;
|
||||||
for(unsigned int i = 0; i < arr->count(); ++i) {
|
for(unsigned int i = 0; i < arr->count(); ++i) {
|
||||||
if(arr->objectAtIndex(i)) {
|
if(arr->objectAtIndex(i)) {
|
||||||
arg0->getScheduler()->unscheduleAllSelectorsForTarget(arr->objectAtIndex(i));
|
arg0->getScheduler()->unscheduleAllForTarget(arr->objectAtIndex(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} while (0);
|
} while (0);
|
||||||
|
|
||||||
cobj->unscheduleAllSelectorsForTarget(arg0);
|
cobj->unscheduleAllForTarget(arg0);
|
||||||
return JS_TRUE;
|
return JS_TRUE;
|
||||||
}
|
}
|
||||||
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1);
|
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1);
|
||||||
|
|
Loading…
Reference in New Issue