Ejemplo n.º 1
0
void ParallaxContainer::addChild(Node *child, int z, const Vec2& ratio, const Vec2& offset, const Vec2& autoScroll)
{
    CCASSERT( child != nullptr, "Argument must be non-nil");
    PointObject *obj = PointObject::create(ratio, offset, autoScroll);
    obj->setChild(child);
    ccArrayAppendObjectWithResize(_parallaxArray, (Ref*)obj);

    Node::addChild(child, z, child->getTag());
}
 void CCParallaxScrollNode::addChild(CCSprite *node, int z, const CCPoint &r, const CCPoint &p, const CCPoint &s, const CCPoint &v)
 {
     node->setAnchorPoint(ccp(0,0));
     CCParallaxScrollOffset *obj = CCParallaxScrollOffset::scrollWithNode(node, r, p, s, v);
     ccArrayAppendObjectWithResize(scrollOffsets, obj);
     if (batch) {
         batch->addChild(node, z);
     } else {
         ((CCNode*)this)->addChild(node, z);
     }
 }
Ejemplo n.º 3
0
void ParallaxNode::addChild(Node *child, int z, const Vec2& ratio, const Vec2& offset)
{
    CCASSERT( child != nullptr, "Argument must be non-nil");
    PointObject *obj = PointObject::create(ratio, offset);
    obj->setChild(child);
    ccArrayAppendObjectWithResize(_parallaxArray, (Ref*)obj);

    Vec2 pos = this->absolutePosition();
    pos.x = -pos.x + pos.x * ratio.x + offset.x;
    pos.y = -pos.y + pos.y * ratio.y + offset.y;
    child->setPosition(pos);

    Node::addChild(child, z, child->getName());
}
Ejemplo n.º 4
0
void CCArray::addObject(CCObject* object)
{
    ccArrayAppendObjectWithResize(data, object);
}