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


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

本文整理汇总了C++中CCRect::getMaxX方法的典型用法代码示例。如果您正苦于以下问题:C++ CCRect::getMaxX方法的具体用法?C++ CCRect::getMaxX怎么用?C++ CCRect::getMaxX使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CCRect的用法示例。


在下文中一共展示了CCRect::getMaxX方法的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: 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

示例3: 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

示例4: collision

void ItemFireString::collision()
{
	if (_mario->_dead) return;
	// »ñÈ¡fireStringÏ߶Î
	struct Line
	{
		CCPoint pt1;
		CCPoint pt2;
	} lineFireString;

	CCRect rcItem = boundingBox();
	int angle = getRotation();
	angle %= 360;
	if (angle > 270)
	{
		lineFireString.pt1 = ccp(rcItem.getMinX(), rcItem.getMinY());
		lineFireString.pt2 = ccp(rcItem.getMaxX(), rcItem.getMaxY());
	}
	else if (angle > 180)
	{
		lineFireString.pt1 = ccp(rcItem.getMinX(), rcItem.getMaxY());
		lineFireString.pt2 = ccp(rcItem.getMaxX(), rcItem.getMinY());
	}
	else if (angle > 90)
	{
		lineFireString.pt1 = ccp(rcItem.getMinX(), rcItem.getMinY());
		lineFireString.pt2 = ccp(rcItem.getMaxX(), rcItem.getMaxY());
	}
	else
	{
		lineFireString.pt1 = ccp(rcItem.getMinX(), rcItem.getMaxY());
		lineFireString.pt2 = ccp(rcItem.getMaxX(), rcItem.getMinY());
	}


	// MarioÏ߶Î
	Line lineMario[2];
	CCRect rcMario = _mario->boundingBox();
	lineMario[0].pt1 = ccp(rcMario.getMinX(), rcMario.getMinY());
	lineMario[0].pt2 = ccp(rcMario.getMaxX(), rcMario.getMaxY());
	lineMario[1].pt1 = ccp(rcMario.getMaxX(), rcMario.getMinY());
	lineMario[1].pt2 = ccp(rcMario.getMinX(), rcMario.getMaxY());

	for (int i = 0; i < 2; ++i)
	{
		if (ccpSegmentIntersect(lineMario[i].pt1, lineMario[i].pt2, lineFireString.pt1, lineFireString.pt2))
			_mario->Die(false);
	}

}
开发者ID:hcy12321,项目名称:Cocos2dx2TestsMario,代码行数:50,代码来源:ItemFireString.cpp

示例5: 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

示例6: 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

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

示例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: ccTouchBegan

bool GameScene::ccTouchBegan(CCTouch *touch, CCEvent *event) {
	if (getBlocksDestroyed() >= BLOCK_COLUMN * BLOCK_ROW) {
		return false;
	}

	CCNode* lavel = dynamic_cast<CCNode*>(this->getChildByTag(kTagStartLabel));
	if (lavel) {
		this->removeChild(lavel, true);
	}

//	CCLog("ccTouchBegan1");
	//現在ボールが飛んでいなければボールを飛ばす
	if (!isTouched) {
		if (UserSettings::getSESetting())
			SimpleAudioEngine::sharedEngine()->playEffect(MP3_BALLPUSH);
		isTouched = true;
		return true;
	}

	CCPoint location = touch->getLocation();
	CCSprite *bar = dynamic_cast<CCSprite*>(this->getChildByTag(kTagBar));
	if (!bar)
		return false;

	//バーの横幅以内がタップされた場合のみタップイベントを有効にする
	bool b = false;
	CCRect rect = bar->boundingBox();
	if (!rect.containsPoint(location)) {
		b = true;
	} else if (location.x >= rect.getMinX() && location.x <= rect.getMaxX()) {
		b = true;
	}
	return b;

}
开发者ID:sakurabird,项目名称:cocos2dx-BlockShooting,代码行数:35,代码来源:GameScene.cpp

示例10: 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

示例11: 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

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

示例14: update

void Start::update(float dt){

	for (int i=0; i<ggroundNum; i++)
	{
		pGround[i]->setPositionX(pGround[i]->getPositionX() - 3);
		CCRect rcGroundBounding = pGround[i]->boundingBox(); 
		if (rcGroundBounding.getMaxX()<=-1)
		{
			int groundsize = pGround[i]->getContentSize().width;
			pGround[i]->setPositionX(mScreenSize.width+groundsize);
		}
	}

}
开发者ID:51anygo,项目名称:mybird,代码行数:14,代码来源:StartScence.cpp

示例15: UpdateBounding

void UIScrollView::UpdateBounding()
{
	CCRect kRect = boundingBox();
	if(m_kChildren.Size())
	{
		m_f32MinX = VE_MAXFLOAT_F;
		m_f32MaxX = -VE_MAXFLOAT_F;
		m_f32MinY = VE_MAXFLOAT_F;
		m_f32MaxY = -VE_MAXFLOAT_F;
		m_kChildren.BeginIterator();
		while(!m_kChildren.IsEnd())
		{
			UIWidget* pkWidget = m_kChildren.GetIterNode()->m_tContent;
			m_kChildren.Next();
			VE_ASSERT(pkWidget);
			if(pkWidget->GetVisible())
			{
				CCRect kRectWidget = pkWidget->boundingBox();
				kRectWidget.origin.x -= kRectWidget.size.width * pkWidget->GetTouchAnchorPoint().x;
				kRectWidget.origin.y -= kRectWidget.size.height * pkWidget->GetTouchAnchorPoint().y;
				m_f32MinX = VE_MIN(kRectWidget.getMinX(), m_f32MinX);
				m_f32MaxX = VE_MAX(kRectWidget.getMaxX(), m_f32MaxX);
				m_f32MinY = VE_MIN(kRectWidget.getMinY(), m_f32MinY);
				m_f32MaxY = VE_MAX(kRectWidget.getMaxY(), m_f32MaxY);
			}
		}
		m_f32MinY = VE_MIN(m_f32MinY, m_f32MaxY - kRect.size.height);
	}
	else
	{
		m_f32MinX = 0;
		m_f32MaxX = kRect.size.width;
		m_f32MinY = 0;
		m_f32MaxY = kRect.size.height;
	}

	m_f32MoveLeft = m_f32MinX;
	m_f32MoveRight = m_f32MaxX - kRect.size.width;
	m_f32MoveBottom = m_f32MinY;
	m_f32MoveTop = m_f32MaxY - kRect.size.height;

	VeFloat32 f32Rate = m_f32MaxY > m_f32MinY ? kRect.size.height / (m_f32MaxY - m_f32MinY) : 1.0f;
	f32Rate = VE_MIN(f32Rate, 1.0f);
	m_f32ScrollBarLen = VeFloorf(VeFloat32(kRect.size.height) * f32Rate);

	m_bCanScroll = f32Rate < 1.0f;

	UpdateScrollBar();
}
开发者ID:snailwork,项目名称:Texas-cs,代码行数:49,代码来源:UIScrollView.cpp


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