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


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

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


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

/** If the bounding mesh exists, update its vertices to match the bounding box of the 2D node. */
void CC3Billboard::updateBoundingMesh()
{
	if (m_pMesh) 
	{
		CCRect bRect = getBillboardBoundingRect();
		GLfloat xMin = bRect.getMinX();
		GLfloat xMax = bRect.getMaxX();
		GLfloat yMin = bRect.getMinX();
		GLfloat yMax = bRect.getMaxY();
		m_pMesh->setVertexLocation( cc3v(xMax, yMax, 0.0), 0 );
		m_pMesh->setVertexLocation( cc3v(xMin, yMax, 0.0), 1 );
		m_pMesh->setVertexLocation( cc3v(xMax, yMin, 0.0), 2 );
		m_pMesh->setVertexLocation( cc3v(xMin, yMin, 0.0), 3 );
	}
}
开发者ID:HerdiandKun,项目名称:cocos3d-x,代码行数:16,代码来源:CC3Billboard.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: collisionBoundingBox

CCRect Player::collisionBoundingBox() {
	CCRect collisionBox = this->boundingBox();
	CCPoint diff = ccpSub(this->desiredPosition, this->getPosition());
	CCRect returnBoundingBox;
	returnBoundingBox.setRect(collisionBox.getMinX() + diff.x, collisionBox.getMinY() + diff.y, collisionBox.getMaxX()-collisionBox.getMinX(), collisionBox.getMaxY()-collisionBox.getMinY());
	return returnBoundingBox;
	//  return CCRect::intersectsRect(this->boundingBox, 2, 0);
}
开发者ID:dps999,项目名称:mario,代码行数:8,代码来源:Player.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: 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

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

示例15: command

bool Tank::command(enumOrder order)
{
	float stepX = 0.0f;
	float stepY = 0.0f;
	float fRotation = getRotation();

	switch (order)
	{
	case cmdNothing:
		break;
	case cmdGoUP:
		stepY = 1.0f;
		fRotation = 0.0f;
		break;
	case cmdGoDown:
		stepY = -1.0f;
		fRotation = 180.0f;
		break;
	case cmdGoLeft:
		stepX = -1.0f;
		fRotation = 270.0f;
		break;
	case cmdGoRight:
		stepX = 1.0f;
		fRotation = 90.0f;
		break;
	case cmdFire:
		//调用子弹开火
		return mBullet->fire();
	default:
		break;
	}

	//根据运行方向旋转坦克
	setRotation(fRotation);

	CCRect rect = this->boundingBox();
	mMovedRect = CCRectMake(rect.getMinX() + stepX,
		rect.getMinY() + stepY, rect.size.width, rect.size.height);
	//检测地图上的碰撞
	if (!mTileMapInfo->collisionTest(mMovedRect))
	{
		IsBlock = false;
		return true;
	}
	//如果碰撞了就不要移动,设置为阻塞状态
	mMovedRect = rect;
	IsBlock = true;

	return false;
}
开发者ID:jun199004,项目名称:Tank,代码行数:51,代码来源:Tank.cpp


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