本文整理汇总了C++中cocos2d::Rect::getMaxX方法的典型用法代码示例。如果您正苦于以下问题:C++ Rect::getMaxX方法的具体用法?C++ Rect::getMaxX怎么用?C++ Rect::getMaxX使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cocos2d::Rect
的用法示例。
在下文中一共展示了Rect::getMaxX方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: placePointToRect
cocos2d::Vec2 placePointToRect(const cocos2d::Vec2& point, const cocos2d::Rect& rect)
{
cocos2d::Vec2 result = point;
{
if (point.x < rect.getMinX())
{
result.x = rect.getMinX();
}
}
{
if (point.y < rect.getMinY())
{
result.y = rect.getMinY();
}
}
{
if (point.x > rect.getMaxX())
{
result.x = rect.getMaxX();
}
}
{
if (point.y > rect.getMaxY())
{
result.y = rect.getMaxY();
}
}
return result;
}
示例2: isRectInsideRect
tRectInRectResult isRectInsideRect(const cocos2d::Rect & lhs, const cocos2d::Rect & rhs)
{
bool bMinX = lhs.getMinX() >= rhs.getMinX();
bool bMinY = lhs.getMinY() >= rhs.getMinY();
bool bMaxX = lhs.getMaxX() <= rhs.getMaxX();
bool bMaxY = lhs.getMaxY() <= rhs.getMaxY();
return tRectInRectResult(bMinX, bMinY, bMaxX, bMaxY);
}
示例3: letBetween
cocos2d::Vec2 rect_adjustPointInside(const cocos2d::Rect& rect, const cocos2d::Vec2& pt)
{
cocos2d::Point result;
result.x = letBetween(pt.x, rect.getMinX(), rect.getMaxX());
result.y = letBetween(pt.y, rect.getMinY(), rect.getMaxY());
return result;
}
示例4: placeRectToRect
cocos2d::Rect placeRectToRect(const cocos2d::Rect& placedRect, const cocos2d::Rect& placeToRect)
{
cocos2d::Rect result = placedRect;
bool bCanBePlacedInside = isRectCanBePlacesInsideRect(placedRect, placeToRect);
if (true == bCanBePlacedInside)
{
auto rectInsideResult = isRectInsideRect(placedRect, placeToRect);
if (false == rectInsideResult.bResult)
{
result.origin = placedRect.origin;
if (false == rectInsideResult.bMinX || false == rectInsideResult.bMinY)
{
Vec2 movePoint(placedRect.getMinX(), placedRect.getMinY());
movePoint = placePointToRect(movePoint, placeToRect) - movePoint;
result.origin += movePoint;
result = placeRectToRect(result, placeToRect);
}
else if (false == rectInsideResult.bMaxX || false == rectInsideResult.bMaxY)
{
Vec2 movePoint(placedRect.getMaxX(), placedRect.getMaxY());
movePoint = placePointToRect(movePoint, placeToRect) - movePoint;
result.origin += movePoint;
result = placeRectToRect(result, placeToRect);
}
}
}
return result;
}
示例5: A
cocos2d::Vec2 GameLayer::getIntersection_NPC_and_SPELayerRect(cocos2d::Rect rect ,cocos2d::Point p)
{
/*
D---------C
| |
A---------B
*/
Vec2 A(rect.getMinX(),rect.getMinY());
Vec2 B(rect.getMaxX(),rect.getMinY());
Vec2 C(rect.getMaxX(),rect.getMaxY());
Vec2 D(rect.getMinX(),rect.getMaxY());
Vec2 PlayerP = getChildByTag(kTagPlayer)->getPosition();
Vec2 npcP = p;
Vec2 point;
if ( Vec2::isSegmentIntersect(A, B, PlayerP,p)){
point = Vec2::getIntersectPoint(A,B,PlayerP,p);
}
else if (Vec2::isSegmentIntersect(B, C, PlayerP, p)){
point = Vec2::getIntersectPoint(B,C, PlayerP, p);
}
else if (Vec2::isSegmentIntersect(C, D, PlayerP, p)){
point = Vec2::getIntersectPoint(C, D, PlayerP, p);
}
else if (Vec2::isSegmentIntersect(A, D, PlayerP, p)){
point = Vec2::getIntersectPoint(A, D, PlayerP, p);
}
return point;
}
示例6: calculateCircleByRect
nav::Circle DelaunayAlgorithm::calculateCircleByRect(const cocos2d::Rect&rect)
{
CCASSERT(rect.size.width > 0 && rect.size.height > 0, "create circle must rect");
cocos2d::Point center(rect.getMidX(), rect.getMidY());
cocos2d::Point topright(rect.getMaxX(), rect.getMaxY());
float distance = center.getDistance(topright);
nav::Circle circle(center, distance);
return circle;
}
示例7: SetArea
void BlueParticles::SetArea(cocos2d::Rect rect, bool draw)
{
m_area = rect;
m_area.origin += getPosition();
if (draw)
{
cocos2d::DrawNode* draw = cocos2d::DrawNode::create();
draw->drawRect(cocos2d::Vec2::ZERO, cocos2d::Vec2(m_area.size.width, m_area.size.height), cocos2d::Color4F(1.0f, 0.0f, 0.0f, 0.5f));
addChild(draw);
}
cocos2d::Rect textRect = cocos2d::Rect(rect.getMidX(), rect.getMidY(), rect.getMaxX() - rect.getMinX(), rect.getMaxY() - rect.getMinY());
this->setTextureRect(rect);
cocos2d::Texture2D::TexParams params = cocos2d::Texture2D::TexParams();
params.magFilter = GL_LINEAR;
params.minFilter = GL_LINEAR;
params.wrapS = GL_REPEAT;
params.wrapT = GL_REPEAT;
getTexture()->setTexParameters(params);
}
示例8: addOval
void Path::addOval(const cocos2d::Rect& oval) {
moveTo(oval.getMaxX(), oval.getMidY());
arcTo(oval.getMidX(), oval.getMidY(), oval.size.width/2, oval.size.height/2, 0.0f, 360.0_to_rad, 0.0f);
closePath();
}