本文整理汇总了C++中CCRect::getMaxY方法的典型用法代码示例。如果您正苦于以下问题:C++ CCRect::getMaxY方法的具体用法?C++ CCRect::getMaxY怎么用?C++ CCRect::getMaxY使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCRect
的用法示例。
在下文中一共展示了CCRect::getMaxY方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CCLOG
bool Cocos2dxAtlasNode::initWithTextureAtlas( CCTextureAtlas* textureAtlas , unsigned int quadIndex , const CCRect &sourceRect)
{
m_nQuadIndex = quadIndex;
m_tColorUnmodified = ccWHITE;
m_bIsOpacityModifyRGB = true;
m_tBlendFunc.src = CC_BLEND_SRC;
m_tBlendFunc.dst = CC_BLEND_DST;
m_pTextureAtlas = textureAtlas;
if (! m_pTextureAtlas)
{
CCLOG("cocos2d: Could not initialize Cocos2dxAtlasNode. Invalid Texture.");
return false;
}
m_pTextureAtlas->retain();
this->updateBlendFunc();
this->updateOpacityModifyRGB();
// shader stuff
setShaderProgram(CCShaderCache::sharedShaderCache()->programForKey(kCCShader_PositionTexture_uColor));
m_nUniformColor = glGetUniformLocation( getShaderProgram()->getProgram(), "u_color");
cocos2d::ccV3F_C4B_T2F_Quad & quad = textureAtlas->getQuads()[quadIndex];
quad.bl.vertices.x = sourceRect.getMinX();
quad.bl.vertices.y = sourceRect.getMinY();
quad.bl.vertices.z = 0;
quad.br.vertices.x = sourceRect.getMaxX();
quad.br.vertices.y = sourceRect.getMinY();
quad.br.vertices.z = 0;
quad.tl.vertices.x = sourceRect.getMinX();
quad.tl.vertices.y = sourceRect.getMaxY();
quad.tl.vertices.z = 0;
quad.tr.vertices.x = sourceRect.getMaxX();
quad.tr.vertices.y = sourceRect.getMaxY();
quad.tr.vertices.z = 0;
//*(cocos2d::CCPoint*)&quad.bl.vertices = CCPointApplyAffineTransform(*(cocos2d::CCPoint*)&(quad.bl.vertices), matrix);
//*(cocos2d::CCPoint*)&quad.br.vertices = CCPointApplyAffineTransform(*(cocos2d::CCPoint*)&(quad.br.vertices), matrix);
//*(cocos2d::CCPoint*)&quad.tl.vertices = CCPointApplyAffineTransform(*(cocos2d::CCPoint*)&(quad.tl.vertices), matrix);
//*(cocos2d::CCPoint*)&quad.tr.vertices = CCPointApplyAffineTransform(*(cocos2d::CCPoint*)&(quad.tr.vertices), matrix);
//quad.bl.vertices.y = -quad.bl.vertices.y;
//quad.br.vertices.y = -quad.br.vertices.y;
//quad.tl.vertices.y = -quad.tl.vertices.y;
//quad.tr.vertices.y = -quad.tr.vertices.y;
return true;
}
示例2: CCRectUnion
CCRect CCControlUtils::CCRectUnion(const CCRect& src1, const CCRect& src2)
{
CCRect result;
float x1 = MIN(src1.getMinX(), src2.getMinX());
float y1 = MIN(src1.getMinY(), src2.getMinY());
float x2 = MAX(src1.getMaxX(), src2.getMaxX());
float y2 = MAX(src1.getMaxY(), src2.getMaxY());
result.origin=ccp(x1,x2);
result.size=CCSizeMake(x2-x1, y2-y1);
return result;
}
示例3: CCRectIntersection
CCRect CollisionEngine::CCRectIntersection(CCRect r1, CCRect r2) {
CCRect intersection;
intersection = CCRectMake(std::max(r1.getMinX(), r2.getMinX()),
std::max(r1.getMinY(), r2.getMinY()), 0, 0);
intersection.size.width = std::min(r1.getMaxX(), r2.getMaxX())
- intersection.getMinX();
intersection.size.height = std::min(r1.getMaxY(), r2.getMaxY())
- intersection.getMinY();
return intersection;
}
示例4: collision
void ItemTortoiseFly::collision()
{
if (_bGodMode || _mario->_status == Mario::DEAD || _mario->_bGodMode)
{
return;
}
CCRect rcItem = boundingBox();
CCRect rcMario = _mario->boundingBox();
if (rcItem.intersectsRect(rcMario))
{
if (_status == NORMAL)
{
if (_mario->_status == Mario::FLY && _mario->_speedUp <= 0 && rcMario.getMinY() > rcItem.getMaxY() - rcItem.size.height / 2)
{
_status = DROPPING;
updateStatus();
}
else
{
_mario->die(false);
}
}
else if (_status == DROPPING)
{
// ... nothing to do
// 设计中,乌龟下降的速度应该大于mario下降的速度,所以不应该有碰撞
}
else if (_status == ONLAND)
{
if (_mario->_status == Mario::FLY && _mario->_speedUp <= 0 && rcMario.getMinY() > rcItem.getMaxY() - rcItem.size.height / 2)
{
_status = SLEEP;
updateStatus();
}
else
{
_mario->die(false);
}
}
else if (_status == SLEEP)
{
if (_bGodMode) return;
_status = CRAZY;
updateStatus();
}
}
}
示例5: intersectsRect
bool CCRect::intersectsRect(const CCRect& rect) const
{
return !( getMaxX() < rect.getMinX() ||
rect.getMaxX() < getMinX() ||
getMaxY() < rect.getMinY() ||
rect.getMaxY() < getMinY());
}
示例6: fixCollision
void GameLayer::fixCollision(COLL_STATE state, CCNode *role, cocos2d::CCRect collisionBox) {
CCRect roleBox = role->boundingBox();
switch (state) {
case COLL_STATE_LEFT: {
float fixedX = role->getPositionX();
fixedX += collisionBox.getMaxX() - roleBox.getMinX();
role->setPositionX(fixedX);
break;
}
case COLL_STATE_RIGHT: {
float fixedX = role->getPositionX();
fixedX -= roleBox.getMaxX() - collisionBox.getMinX();
role->setPositionX(fixedX);
break;
}
case COLL_STATE_TOP: {
float fixedY = role->getPositionY();
fixedY -= roleBox.getMaxY() - collisionBox.getMinY();
role->setPositionY(fixedY);
break;
}
case COLL_STATE_BOTTOM: {
float fixedY = role->getPositionY();
fixedY += collisionBox.getMaxY() - roleBox.getMinY();
role->setPositionY(fixedY);
break;
}
default:
break;
}
}
示例7: collision
void ItemLadderLR::collision()
{
CCRect rcMario = _mario->boundingBox();
CCRect rcItem = boundingBox();
if (rcItem.intersectsRect(rcMario))
{
// 脑袋撞上了
if (_mario->_speedUp > 0)
{
_mario->_speedDown = 10;
_mario->_speedUp = 0;
}
else
{
// 刚落地
if (_mario->_status ==Mario::FLY)
{
_mario->_onLadder = true;
_marioOnThisLadder = true;
_mario->setPositionY(rcItem.getMaxY());
}
}
}
else
{
if (_marioOnThisLadder)
{
_marioOnThisLadder = false;
_mario->_onLadder = false;
}
}
}
示例8: AABB
bool JoinMembers::AABB(CCRect a, CCRect b)
{
//접하면 충돌로 봄.
//x축에대하여
if( a.getMaxX() < b.getMinX() ||
a.getMinX() > b.getMaxX() )
return false;
//y축에대하여
if(a.getMaxY() < b.getMinY() ||
a.getMinY() > b.getMaxY() )
return false;
return true;
}
示例9: isScrollWindowNotOutSide
bool CAScrollView::isScrollWindowNotOutSide()
{
CCSize size = this->getBounds().size;
CCRect rect = m_pContainer->getFrame();
if (rect.getMinX() > 0.5f)
{
return true;
}
if ((rect.getMaxX() - size.width) < -0.5f)
{
return true;
}
float y_max = this->isHeaderRefreshing() ? _px(128) : 0.0f;
float y_min = (this->isFooterRefreshing() ? _px(128) : 0.0f) - size.height;
if (rect.getMinY() + y_max > 0.5f)
{
return true;
}
if (rect.getMaxY() + y_min < -0.5f)
{
return true;
}
return false;
}
示例10: createUI
//-----------------------------------------------------------------------------------------------------------------------------
void PersonView::createUI(void)
{
mInfo->hp = mInfo->maxHp = mConfig->hp();
mInfo->defense = mConfig->defe();
mInfo->attack = mConfig->att();
mInfo->maxattack = mConfig->maxatt();
mInfo->attackDelay = (float)mConfig->delay() / 1000;
CCArmature* armature = CCArmature::create(mConfig->name().c_str());
setAvatar(armature);
//if (id == 3)
//{
// CCBone* bone = armature->getBone("staff");
// CCSpriteDisplayData displayData;
// displayData.setParam("Pastor-weapon-pastor_staff_1.png");
// bone->addDisplay(&displayData, 1);
// bone->changeDisplayByIndex(1, true);
//}
if (mBloodBar == NULL)
{
mBloodBar = BloodBar::create();
CCRect trect = CCRectApplyAffineTransform(armature->boundingBox(), armature->nodeToParentTransform()); // 获取模型的大小
mBloodBar->setPositionY(trect.getMaxY());
addChild(mBloodBar, 1);
}
}
示例11: isCollide
static bool isCollide(const CCRect r1, const CCRect r2)
{
bool bRet = false;
if(r1.intersectsRect(r2))
{
double area1 = (r1.getMaxX()-r1.getMinX())*(r1.getMaxY()-r1.getMinY());
double area2 = (r2.getMaxX()-r2.getMinX())*(r2.getMaxY()-r2.getMinY());
float maxX = min(r1.getMaxX(), r2.getMaxX());
float minX = max(r1.getMinX(), r2.getMinX());
float maxY = min(r1.getMaxY(), r2.getMaxY());
float minY = max(r1.getMinY(), r2.getMinY());
double interarea = (maxX-minX) * (maxY-minY);
bRet = interarea * 5 > max(area1, area2);
}
return bRet;
}
示例12: draw
void GGameLayerBase::draw()
{
CCLayer::draw();
//return;
glLineWidth(1.5);
CCRect dataRect;
CCArray* arraychildren= _spriteLayer->getChildren();
CCObject *obj=NULL;
CCARRAY_FOREACH(arraychildren,obj)
{
ActionSprite *sprite=(ActionSprite*)obj;
ccDrawColor4B(255, 0, 0, 255);
dataRect=sprite->GetHitbox();
ccDrawRect(dataRect.origin,ccp(dataRect.getMaxX(),dataRect.getMaxY()));
ccDrawColor4B(0, 255, 0, 255);
dataRect=sprite->GetAttackBox();
ccDrawRect(dataRect.origin,ccp(dataRect.getMaxX(),dataRect.getMaxY()));
}
示例13: inVisibleRigion
static bool inVisibleRigion(const CCRect& rect)
{
CCSize size = CCDirector::sharedDirector()->getVisibleSize();
return rect.getMinX() < size.width
&& rect.getMaxX() > 0
&& rect.getMinY() < size.height
&& rect.getMaxY() > 0;
}
示例14: printRect
static void printRect(const CCRect& rect)
{
char msg[128];
sprintf(msg, "%f, %f, %f, %f",
rect.getMinX(),
rect.getMinY(),
rect.getMaxX(),
rect.getMaxY());
CCLOG(msg);
}
示例15: updatePosToJvGame
void JvSprite::updatePosToJvGame()
{
CCRect boundingrect = boundingBox();
float cocospointX = (float)boundingrect.getMinX();
float cocospointY = (float)boundingrect.getMaxY();
JvPoint cocospoint(cocospointX,cocospointY);
JvPoint jvgamePoint = JvU::cocos2dPoint_to_JvGamePoint(cocospoint,JvG::stateP->getStateLayer()->getContentSize().height);
mJvObject->x = jvgamePoint.x;
mJvObject->y = jvgamePoint.y;
mJvObject->width = boundingrect.size.width;
mJvObject->height = boundingrect.size.height;
}