当前位置: 首页>>代码示例>>C++>>正文


C++ CCRect::getMaxY方法代码示例

本文整理汇总了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;
}
开发者ID:harveyyang,项目名称:DragonBones_Learn,代码行数:54,代码来源:Cocos2dxAtlasNode.cpp

示例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;
}
开发者ID:boruis,项目名称:cocos2dx-classical,代码行数:13,代码来源:CCControlUtils.cpp

示例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;

}
开发者ID:munhra,项目名称:platform-game-engine,代码行数:13,代码来源:CollisionEngine.cpp

示例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();
		}
	}
}
开发者ID:dalechngame,项目名称:mygame,代码行数:49,代码来源:ItemTortoiseFly.cpp

示例5: intersectsRect

bool CCRect::intersectsRect(const CCRect& rect) const
{
    return !(     getMaxX() < rect.getMinX() ||
             rect.getMaxX() <      getMinX() ||
                  getMaxY() < rect.getMinY() ||
             rect.getMaxY() <      getMinY());
}
开发者ID:code-acmer,项目名称:p02,代码行数:7,代码来源:CCGeometry.cpp

示例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;
    }
}
开发者ID:DoubleHH,项目名称:FlappyBird,代码行数:32,代码来源:GameLayer.cpp

示例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;
		}
	}
	
}
开发者ID:dalechngame,项目名称:mygame,代码行数:35,代码来源:ItemLadderLR.cpp

示例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;
}
开发者ID:LitQoo,项目名称:SportsWorldCupOriginal,代码行数:16,代码来源:JoinMembers.cpp

示例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;
}
开发者ID:khjl12345,项目名称:CrossApp,代码行数:30,代码来源:CAScrollView.cpp

示例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);
    }
}
开发者ID:flashsong,项目名称:firstTest,代码行数:29,代码来源:PersonView.cpp

示例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;
}
开发者ID:guinao,项目名称:CallofDefense,代码行数:17,代码来源:ZombieManager.cpp

示例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()));
	}
开发者ID:xungong91,项目名称:PandaTiao,代码行数:18,代码来源:GGameLayerBase.cpp

示例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;
}
开发者ID:guinao,项目名称:CallofDefense,代码行数:9,代码来源:ZombieManager.cpp

示例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);
	
}
开发者ID:guinao,项目名称:CallofDefense,代码行数:12,代码来源:ZombieManager.cpp

示例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;
}
开发者ID:cjv123,项目名称:JvGameForCocos2dx,代码行数:12,代码来源:JvSprite.cpp


注:本文中的CCRect::getMaxY方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。