void CCRect::setRect(float x, float y, float width, float height) { // CGRect can support width<0 or height<0 // CCAssert(width >= 0.0f && height >= 0.0f, "width and height of Rect must not less than 0."); origin.x = x; origin.y = y; size.width = width; size.height ...
CCRect是cocos2dx中的一块矩形区域 常用于碰撞检测及渲染时限定纹理的大小 CCRect rect=spr.boundingBox(); CCRect rect=CCRect(0,0,spr.width,spr.height); CCRect rect=CCRect(spr->boundingBox().origin.x,spr->boundingBox().origin.y,spr.size().width,spr.size().height); //boundingBox().origi...
代码和下面差不多,可参考下面代码: CCRect MonsterSprite::atlasRect() { CCSize temp_size = this->getContentSize(); return CCRectMake( -temp_size.width/2, -temp_size.height/2, temp_size.width, temp_size.height ); } bool MonsterSprite::containsTouchLocation( CCTouch *pTouch ) { CCPoint ...
CCRectCCControlUtils::CCRectUnion(constCCRect& src1,constCCRect& src2) {CCRectresult;floatx1 = MIN(src1.getMinX(), src2.getMinX());floaty1 = MIN(src1.getMinY(), src2.getMinY());floatx2 = MAX(src1.getMaxX(), src2.getMaxX());floaty2 = MAX(src1.getMaxY(), src2.getMaxY()...
mVisibleRect =CCRect(0,0,0,257);break; } } mProgressSpr->setPosition(ccp(35, mProgressBgSpr->getContentSize().height +10)); mProgressSpr->setAnchorPoint(ccp(0,0.5)); mProgressSpr->setTextureRect(mVisibleRect);this->addChild(mProgressSpr); ...
关于CCRect 一直有一个误区,因为之前处理的公司引擎是屏幕坐标系 导致觉得CCRect的坐标起始值(x,y),习惯性的认为就是左上角的点。 但是,真正的x,y值,是跟x轴与y轴相对应的。
- (CGRect)toCGRect; @end 可能有更新: googlecode链接地址:http://code.google.com/p/iphone-common-codes-ccteam/source/browse/trunk/CCFC/files/CCRect.h github地址:https://github.com/cxsjabc/iphone-common-codes-ccteam/tree/master/CCFC/files/CCRect.h...
rect1 = CCRect(sRect.origin.x + sRect.size.width *0.45, sRect.origin.y + sRect.size.height *0.75, sRect.size.width *0.1, sRect.size.height *0.15);if(!rect.intersectsRect(rect1)) { over =false; }else{ CCLOG("44444 rect1 = (%.1f, %.1f, %.1f, %.1f)", rect1.origin.x, ...
NS_CC_BEGIN/** * 测试是否可以将物体限制在线段围成的区域里 */boolLineBlockMap::checkCollide(constCCRect& rect) { CCPoint one = ccp(rect.origin.x,rect.origin.y); CCPoint two = ccp(rect.origin.x + rect.size.width,rect.origin.y); ...
在下文中一共展示了CCRect.Intersection方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。 示例1: GetSeparatingVector ▲点赞 9▼ CCVector2GetSeparatingVector(CCRect first, RectWithDirection second){//返回一个向量,是pl...