本文整理汇总了C++中CCNode::getAnchorPoint方法的典型用法代码示例。如果您正苦于以下问题:C++ CCNode::getAnchorPoint方法的具体用法?C++ CCNode::getAnchorPoint怎么用?C++ CCNode::getAnchorPoint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCNode
的用法示例。
在下文中一共展示了CCNode::getAnchorPoint方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getRelativeRect
CCRect UIWidget::getRelativeRect()
{
CCNode* validNode = getValidNode();
float width = 0.0f;
float height = 0.0f;
float anchorPointX = 0.0f;
float anchorPointY = 0.0f;
CCSize nodeSize = validNode->getContentSize();
width = nodeSize.width*getScaleX();
height = nodeSize.height*getScaleY();
CCPoint nodeAnchorPoint = validNode->getAnchorPoint();
anchorPointX = nodeAnchorPoint.x;
anchorPointY = nodeAnchorPoint.y;
switch (m_WidgetType)
{
case WidgetTypeWidget:
m_relativeRect.origin.x = getPosition().x - width * anchorPointX;
m_relativeRect.origin.y = getPosition().y - height * anchorPointY;
break;
case WidgetTypeContainer:
m_relativeRect.origin.x = getPosition().x;
m_relativeRect.origin.y = getPosition().y;
break;
}
m_relativeRect.size.width = width;
m_relativeRect.size.height = height;
return m_relativeRect;
}
示例2: relayoutAsVertical
void HRootLayer::relayoutAsVertical(CCArray *nodes, CCPoint basePos, int interval) {
for (int i = 0; i < nodes->count(); ++i) {
CCNode *node = (CCNode *)nodes->objectAtIndex(i);
node->setPosition(CCPointMake(basePos.x, basePos.y + node->getAnchorPoint().y * node->getContentSize().height));
basePos.y += node->getContentSize().height + interval;
}
}
示例3: relayoutAsHorizontal
void HRootLayer::relayoutAsHorizontal(CCArray *nodes, CCPoint basePos, int interval) {
for (int i = 0; i < nodes->count(); ++i) {
CCNode *node = (CCNode *)nodes->objectAtIndex(i);
node->setPosition(CCPointMake(basePos.x + node->getAnchorPoint().x * node->getContentSize().width * node->getScaleX(), basePos.y));
basePos.x += node->getContentSize().width * node->getScaleX() + interval;
}
}
示例4: visit
void CCBClippingNode::visit(){
CCNode* hock = this->getChildByTag(htag);
if (hock==NULL) {
getStencil()->setPosition(0, 0);
getStencil()->setScaleX(1);
getStencil()->setScaleY(1);
getStencil()->setRotationX(0);
getStencil()->setRotationY(0);
getStencil()->setSkewX(0);
getStencil()->setSkewY(0);
getStencil()->setAnchorPoint(ccp(0.5, 0.5));
}else{
getStencil()->setPosition(hock->getPositionX(),hock->getPositionY());
getStencil()->setScaleX(hock->getScaleX());
getStencil()->setScaleY(hock->getScaleY());
getStencil()->setRotationX(hock->getRotationX());
getStencil()->setRotationY(hock->getRotationY());
getStencil()->setSkewX(hock->getSkewX());
getStencil()->setSkewY(hock->getSkewY());
getStencil()->setAnchorPoint(hock->getAnchorPoint());
}
CCClippingNode::visit();
}
示例5:
void E002_C010_P230::_setPositionOutParent(CCNode* child, CCNode* newParent)
{
CCNode* parent = (CCNode*)child->getParent();
if (parent && child) {
child->retain();
CCSize parentSize = parent->getContentSize();
CCPoint parentAnchor = parent->getAnchorPoint();
float posX = parent->getPositionX() - parentSize.width*parentAnchor.x + child->getPositionX();
float posY = parent->getPositionY() - parentSize.height*parentAnchor.y + child->getPositionY();
child->removeFromParentAndCleanup(false);
child->setPosition(ccp(posX, posY));
this->addChild(child);
child->release();
}
}