void WildcardButton::draw() { ccDrawSolidRect(m_borderOrigin, m_borderDestination, m_currentBorderColor); ccDrawSolidRect(m_backgroundOrigin, m_backgroundDestination, m_currentBackgroundColor); ccDrawSolidRect(m_coinBackgroundOrigin, m_backgroundDestination, m_currentCoinBackgroundColor); ccDrawSolidRect(m_coinBorderOrigin, m_coinBorderDestination, m_currentBorderColor); }
void drawTBars(Track *track,CCPoint * timelineTrackRatio,CCSize * timeLineSize,float * addtionalDistance) { float porcentMaxSize=0.2f; float maxSize=track->_entBar[0]->getWidth()*porcentMaxSize; float sizeReductor=0.0f; float barsWidth=track->_entBar[0]->getWidth()*timelineTrackRatio->x; //if(barsWidth>=maxSize) //sizeReductor=track->_entBar[0]->getWidth()- track->_entBar[0]->getWidth()*porcentMaxSize; sizeReductor=track->_entBar[0]->getWidth()*porcentMaxSize; ccColor4F color; float trackHeight=track->getHeight(); float newX,newY; for (int i=0;i<track->_entBar.size();i++) { if(track->_entBar[i]->getClassName()=="Bar") color=ccc4f(0.0f,1.0f,0.0f,0.80f); else if(track->_entBar[i]->getClassName()=="StartBar" || track->_entBar[i]->getClassName()=="EndBar") color=ccc4f(1.0f,1.0f,0.0f,0.80f); else color=ccc4f(0,0.392f,1.0f,0.80f); newX=(track->_entBar[i]->getPositionX()+*addtionalDistance)*timelineTrackRatio->x ; newY=track->_entBar[i]->getHeight()*timelineTrackRatio->y; /*ccDrawSolidRect(ccp(newX + sizeReductor/2,newY + trackHeight),ccp(newX + barsWidth -sizeReductor/2,trackHeight),color);*/ ccDrawSolidRect(ccp(newX + barsWidth/2 -sizeReductor/2,newY + trackHeight),ccp(newX + barsWidth/2 + sizeReductor/2,trackHeight),color); } }
void Enemy::draw(Renderer *renderer, const kmMat4& transform, bool transformUpdated) { Point myPosition = _spritePosition; ccDrawSolidRect(ccp(myPosition.x + HEALTH_BAR_ORIGIN, myPosition.y + 16), ccp(myPosition.x + HEALTH_BAR_ORIGIN + HEALTH_BAR_WIDTH, myPosition.y + 14), ccc4f(1.0, 0, 0, 1.0)); ccDrawSolidRect(ccp(myPosition.x + HEALTH_BAR_ORIGIN, myPosition.y + 16), ccp(myPosition.x + HEALTH_BAR_ORIGIN + (float)(_currentHp * HEALTH_BAR_WIDTH) / _maxHp, myPosition.y + 14), ccc4f(0, 1.0, 0, 1.0)); }
void drawTimeLine(Track * track, CCSize * size) { ccColor4F baseColor=ccc4f(0.117f,0.0f,0.038f,0.6f/*9*/); ccDrawSolidRect(CCPoint(0,track->getContentSize().height),CCPoint(size->width,track->getContentSize().height+size->height),baseColor); float recThickness=4.0f; glLineWidth(recThickness); ccDrawColor4F(baseColor.r,baseColor.g,baseColor.b,0.9); ccDrawRect(ccp(0-recThickness,track->getContentSize().height-recThickness/2),ccp(size->width+recThickness/2 , track->getContentSize().height+size->height+recThickness/2)); }
void RawStencilBufferTest::draw() { CCPoint winPoint = ccpFromSize(CCDirector::sharedDirector()->getWinSize()); CCPoint planeSize = ccpMult(winPoint, 1.0 / _planeCount); glEnable(GL_STENCIL_TEST); CHECK_GL_ERROR_DEBUG(); for (int i = 0; i < _planeCount; i++) { CCPoint stencilPoint = ccpMult(planeSize, _planeCount - i); stencilPoint.x = winPoint.x; CCPoint spritePoint = ccpMult(planeSize, i); spritePoint.x += planeSize.x / 2; spritePoint.y = 0; m_pSprite->setPosition( spritePoint ); this->setupStencilForClippingOnPlane(i); CHECK_GL_ERROR_DEBUG(); ccDrawSolidRect(CCPointZero, stencilPoint, ccc4f(1, 1, 1, 1)); kmGLPushMatrix(); this->transform(); m_pSprite->visit(); kmGLPopMatrix(); this->setupStencilForDrawingOnPlane(i); CHECK_GL_ERROR_DEBUG(); ccDrawSolidRect(CCPointZero, winPoint, _planeColor[i]); kmGLPushMatrix(); this->transform(); m_pSprite->visit(); kmGLPopMatrix(); } glDisable(GL_STENCIL_TEST); CHECK_GL_ERROR_DEBUG(); }
void Ship::draw() { if(m_shipVisible) { //draw a f*****g rectangle if(shipState==ShipState::Norm||shipState==ShipState::Damaged) ccDrawSolidRect({0.f,0.f}, getContentSize(), {1.f, 1.f, 1.f, 1.f}); else ccDrawSolidRect({0.f,0.f}, getContentSize(), {0.f, 0.f, 0.f, 1.f}); } size_t numberOfDecks = this->getNumberOfDecks(); for(int i=0; i<numberOfDecks; i++) { if(decksToShow[i]) { //draw this deck depending on it's state CellState state = deckStates[i]; switch(state) { case CellState::Hit: { //draw a sprite over it try{ deckBurningSprites.at(i)->setVisible(true); if(shipState==ShipState::Destroyed) { deckBurningSprites.at(i)->setVisible(false); m_shipVisible = true; } } catch(std::exception& ex) { std::cout<<ex.what(); } } default: ;//do nothing } } } CCSprite::draw(); }
void DebugDraw::draw(Renderer *renderer, const Mat4& transform, uint32_t flags) { int c = m_lines->size(); for (int i = 0; i < c; i++) { DebugLine line = m_lines->at(i); ccDrawColor4B(line.r, line.g, line.b, 255); ccDrawLine(line.pt1, line.pt2); } c = m_points->size(); for (int i = 0; i < c; i++) { DebugPoint pt = m_points->at(i); ccDrawColor4B(pt.r, pt.g, pt.b, 255); ccDrawPoint(pt.pt); } c = m_circles->size(); for (int i = 0; i < c; i++) { DebugCircle ci = m_circles->at(i); ccDrawColor4B(ci.r, ci.g, ci.b, 255); ccDrawCircle(ci.pt, ci.radius, 0, 100, false, 1, 1); } c = m_rects->size(); for (int i = 0; i < c; i++) { DebugRect ci = m_rects->at(i); ccDrawSolidRect(ci.pt1, ci.pt2, ci.color); } /* // size chart int totalLines = (m_visibleRectRightTop.x - m_visibleRectLeftBottom.x ) / 10; int colorIndex = 0; for (int i = m_visibleRectLeftBottom.x; i < m_visibleRectRightTop.x; i+= 10) { switch (colorIndex) { case 0: ccDrawColor4B(255, 255, 255, 255); break; case 1: ccDrawColor4B(255, 0, 0, 255); break; case 2: ccDrawColor4B(0, 255, 0, 255); break; case 3: ccDrawColor4B(0, 0, 255, 255); break; } colorIndex += (colorIndex == 3) ? -3 : 1; ccDrawLine(ccp (i, 0), ccp (i, i/m_visibleRectRightTop.x * m_visibleRectRightTop.y)); } */ }
void Gleed2DLayer::draw() { SpriteBatchNode::draw(); ccDrawInit(); int numItem=_layerInfo->Items->count(); for(int i=0;i<numItem;i++) { Gleed2DItem * item=(Gleed2DItem *)_layerInfo->Items->getObjectAtIndex(i); switch (item->_itemType) { case GLEED2D_ITEM_CIRCLE: { Gleed2DCircleItem * circleItem=(Gleed2DCircleItem *)item; ccDrawColor4B(circleItem->FillColor.r,circleItem->FillColor.g,circleItem->FillColor.b,circleItem->FillColor.a); ccDrawSolidCircle(Point(circleItem->Position.x,-(circleItem->Position.y)) ,circleItem->Radius ,0 ,25 ); }break; case GLEED2D_ITEM_RECTANGLE: { Gleed2DRectangleItem * rectItem=(Gleed2DRectangleItem *)item; ccDrawColor4B(rectItem->FillColor.r,rectItem->FillColor.g,rectItem->FillColor.b,rectItem->FillColor.a); ccDrawSolidRect(Point(rectItem->Position.x,-(rectItem->Position.y)) ,Point(rectItem->Position.x+rectItem->Width,-(rectItem->Position.y)-rectItem->Height) ,Color4F(rectItem->FillColor)); }break; case GLEED2D_ITEM_PATH: { Gleed2DPathItem * pathItem=(Gleed2DPathItem *)item; int numPoint=pathItem->WorldPoints.size()-1; ccDrawColor4B(pathItem->LineColor.r,pathItem->LineColor.g,pathItem->LineColor.b,pathItem->LineColor.a); float old_width; glGetFloatv(GL_LINE_WIDTH,&old_width); glLineWidth(pathItem->LineWidth); for(int i=0;i<numPoint;i++) { ccDrawLine(Point(pathItem->WorldPoints[i].x,-(pathItem->WorldPoints[i].y)) ,Point(pathItem->WorldPoints[i+1].x,-(pathItem->WorldPoints[i+1].y))); } glLineWidth(old_width); }break; default: break; } } ccDrawFree(); }
void RectangleNode::draw() { CC_NODE_DRAW_SETUP(); if (m_bSolid) { ccDrawSolidRect(CCPointZero, m_obContentSize, m_sColor); } else { ccDrawColor4F(m_sColor.r, m_sColor.g, m_sColor.b, m_sColor.a); ccDrawRect(CCPointZero, m_obContentSize); } }
void CCRectShape::drawProc(void) { const CCPoint center = getDrawPosition(); float w = m_size.width / 2; float h = m_size.height / 2; if (m_fill) { ccDrawSolidRect(ccp(center.x - w, center.y + h), ccp(center.x + w, center.y - h), m_color); } else { ccDrawColor4F(m_color.r, m_color.g, m_color.b, m_color.a); ccDrawRect(ccp(center.x - w, center.y + h), ccp(center.x + w, center.y - h)); } }
void CCRectNode::draw() { const ccColor3B& tColor(getColor()); CCPoint tOrigin(isIgnoreAnchorPointForPosition() ? CCPointZero : getAnchorPointInPoints()); CCPoint tDestination(ccpShift(tOrigin, getContentSize())); if (m_bFill) { ccColor4F tColor4F(ccc4FFromccc3B(tColor)); tColor4F.a = getOpacity() / 255.0f; ccDrawSolidRect(tOrigin, tDestination, tColor4F); } else { ccDrawColor4B(tColor.r, tColor.g, tColor.b, getOpacity()); ccDrawRect(tOrigin, tDestination); } }
void RawStencilBufferTest6::setupStencilForClippingOnPlane(GLint plane) { GLint planeMask = 0x1 << plane; glStencilMask(planeMask); glStencilFunc(GL_NEVER, 0, planeMask); glStencilOp(GL_REPLACE, GL_KEEP, GL_KEEP); ccDrawSolidRect(CCPointZero, ccpFromSize(CCDirector::sharedDirector()->getWinSize()), ccc4f(1, 1, 1, 1)); glStencilFunc(GL_NEVER, planeMask, planeMask); glStencilOp(GL_REPLACE, GL_KEEP, GL_KEEP); glDisable(GL_DEPTH_TEST); glDepthMask(GL_FALSE); #if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_LINUX) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) glEnable(GL_ALPHA_TEST); glAlphaFunc(GL_GREATER, _alphaThreshold); #else CCGLProgram *program = CCShaderCache::sharedShaderCache()->programForKey(kCCShader_PositionTextureColorAlphaTest); GLint alphaValueLocation = glGetUniformLocation(program->getProgram(), kCCUniformAlphaTestValue); program->setUniformLocationWith1f(alphaValueLocation, _alphaThreshold); m_pSprite->setShaderProgram(program); #endif glFlush(); }
void Layout::stencilClippingVisit() { if (!_clippingStencil || !_clippingStencil->isVisible()) { CCNode::visit(); return; } if (g_sStencilBits < 1) { CCNode::visit(); return; } static GLint layer = -1; if (layer + 1 == g_sStencilBits) { static bool once = true; if (once) { char warning[200] = {0}; snprintf(warning, sizeof(warning), "Nesting more than %d stencils is not supported. Everything will be drawn without stencil for this node and its childs.", g_sStencilBits); CCLOG("%s", warning); once = false; } CCNode::visit(); return; } layer++; GLint mask_layer = 0x1 << layer; GLint mask_layer_l = mask_layer - 1; GLint mask_layer_le = mask_layer | mask_layer_l; GLboolean currentStencilEnabled = GL_FALSE; GLuint currentStencilWriteMask = ~0; GLenum currentStencilFunc = GL_ALWAYS; GLint currentStencilRef = 0; GLuint currentStencilValueMask = ~0; GLenum currentStencilFail = GL_KEEP; GLenum currentStencilPassDepthFail = GL_KEEP; GLenum currentStencilPassDepthPass = GL_KEEP; currentStencilEnabled = glIsEnabled(GL_STENCIL_TEST); glGetIntegerv(GL_STENCIL_WRITEMASK, (GLint *)¤tStencilWriteMask); glGetIntegerv(GL_STENCIL_FUNC, (GLint *)¤tStencilFunc); glGetIntegerv(GL_STENCIL_REF, ¤tStencilRef); glGetIntegerv(GL_STENCIL_VALUE_MASK, (GLint *)¤tStencilValueMask); glGetIntegerv(GL_STENCIL_FAIL, (GLint *)¤tStencilFail); glGetIntegerv(GL_STENCIL_PASS_DEPTH_FAIL, (GLint *)¤tStencilPassDepthFail); glGetIntegerv(GL_STENCIL_PASS_DEPTH_PASS, (GLint *)¤tStencilPassDepthPass); glEnable(GL_STENCIL_TEST); CHECK_GL_ERROR_DEBUG(); glStencilMask(mask_layer); GLboolean currentDepthWriteMask = GL_TRUE; glGetBooleanv(GL_DEPTH_WRITEMASK, ¤tDepthWriteMask); glDepthMask(GL_FALSE); glStencilFunc(GL_NEVER, mask_layer, mask_layer); glStencilOp(GL_ZERO, GL_KEEP, GL_KEEP); kmGLMatrixMode(KM_GL_MODELVIEW); kmGLPushMatrix(); kmGLLoadIdentity(); kmGLMatrixMode(KM_GL_PROJECTION); kmGLPushMatrix(); kmGLLoadIdentity(); ccDrawSolidRect(CCPoint(-1,-1), CCPoint(1,1), ccc4f(1, 1, 1, 1)); kmGLMatrixMode(KM_GL_PROJECTION); kmGLPopMatrix(); kmGLMatrixMode(KM_GL_MODELVIEW); kmGLPopMatrix(); glStencilFunc(GL_NEVER, mask_layer, mask_layer); glStencilOp(GL_REPLACE, GL_KEEP, GL_KEEP); kmGLPushMatrix(); transform(); _clippingStencil->visit(); kmGLPopMatrix(); glDepthMask(currentDepthWriteMask); glStencilFunc(GL_EQUAL, mask_layer_le, mask_layer_le); glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); CCNode::visit(); glStencilFunc(currentStencilFunc, currentStencilRef, currentStencilValueMask); glStencilOp(currentStencilFail, currentStencilPassDepthFail, currentStencilPassDepthPass); glStencilMask(currentStencilWriteMask); if (!currentStencilEnabled) { glDisable(GL_STENCIL_TEST); } layer--; }
void Game::drawStatusBar(const CCSize& visibleSize) { ccDrawSolidRect(VisibleRect::leftTop(), ccp(VisibleRect::rightTop().x, VisibleRect::rightTop().y - visibleSize.height / 7), ccc4f(52.0f / 255.0f, 152.0f / 255.0f, 219.0f / 255.0f, 1.0f)); }
void Game::drawInventory(const CCSize& visibleSize) { ccDrawSolidRect(VisibleRect::leftBottom(), ccp(VisibleRect::rightBottom().x, VisibleRect::rightBottom().y + visibleSize.height / 8), ccc4f(1.0f, 1.0f, 1.0f, 1.0f)); }
bool CCTubeGridTile::initWithType(int type, bool backGround,TileColor color) { CCRenderTexture* pRt = CCRenderTexture::create(tileWidth,tileHeight); if (backGround) { pRt->begin(); float flineWidth = 0.3; ccDrawSolidRect(ccp(flineWidth,flineWidth),ccp(tileWidth-flineWidth, tileHeight-flineWidth),tileBackgroundColor); pRt->end(); } if(!initWithTexture(pRt->getSprite()->getTexture()))return false; //do image initialization with type CCPoint childPosWithOffset = ccp(tileWidth/2, tileHeight/2); ChildTubeSprite* podChild1 = NULL; ChildTubeSprite* podChild2 = NULL; this->type = type; m_canGetFireLocation = false; if (TILETYPE_LINE_ONE_HORIZONTAL == type|| TILETYPE_LINE_ONE_VERTICAL == type|| TILETYPE_LINE_TWO_HORIZONTALONTOP == type|| TILETYPE_LINE_TWO_VERTICALONTOP == type) { genericType = GENERIC_TYPE_LINE; initLine1(color); if (TILETYPE_LINE_TWO_HORIZONTALONTOP == type|| TILETYPE_LINE_TWO_VERTICALONTOP == type) { initLine2(color); } } else { genericType = GENERIC_TYPE_CURVE; initCurve1(color); if (TILETYPE_CURVE_TWO_BOTTONLEFT_TOPRIGHT == type|| TILETYPE_CURVE_TWO_TOPLEFT_BOTTONRIGHT == type) { initCurve2(color); } } switch (type) { case TILETYPE_VOID: { //create the void tile render texture m_rtVoid = CCRenderTexture::create(tileWidth,tileHeight); m_rtVoid->begin(); ccColor4F colorVoid = {0,0,0 ,1.0f}; ccDrawSolidRect(ccp(0,0),ccp(tileWidth, tileHeight),colorVoid); m_rtVoid->end(); setTexture(m_rtVoid->getSprite()->getTexture()); break; } case TILETYPE_NOTUBE: { break; } case TILETYPE_CURVE_ONE_BOTTONLEFT: { podChild1 = ChildTubeSprite::createWithTexture(m_rtCurve->getSprite()->getTexture()); podChild1->setPosition(childPosWithOffset); podChild1->setRotation(-90); podChild1->setTag(TAG_CURVE_BOTTONLEFT); addChild(podChild1,Z_CHILD1); break; } case TILETYPE_CURVE_ONE_BOTTONRIGHT: { podChild1 = ChildTubeSprite::createWithTexture(m_rtCurve->getSprite()->getTexture()); podChild1->setPosition(childPosWithOffset); podChild1->setRotation(-180); podChild1->setTag(TAG_CURVE_BOTTONRIGHT); addChild(podChild1,Z_CHILD1); break; } case TILETYPE_CURVE_ONE_TOPLEFT: { podChild1 = ChildTubeSprite::createWithTexture(m_rtCurve->getSprite()->getTexture()); podChild1->setPosition(childPosWithOffset); podChild1->setTag(TAG_CURVE_TOPLEFT); addChild(podChild1,Z_CHILD1); break; } case TILETYPE_CURVE_ONE_TOPRIGHT: { podChild1 = ChildTubeSprite::createWithTexture(m_rtCurve->getSprite()->getTexture()); podChild1->setPosition(childPosWithOffset); podChild1->setRotation(90); podChild1->setTag(TAG_CURVE_TOPRIGHT); addChild(podChild1,Z_CHILD1); break; } case TILETYPE_CURVE_TWO_TOPLEFT_BOTTONRIGHT: { podChild1 = ChildTubeSprite::createWithTexture(m_rtCurve->getSprite()->getTexture()); podChild1->setPosition(childPosWithOffset); podChild1->setTag(TAG_CURVE_TOPLEFT); addChild(podChild1,Z_CHILD1); podChild2 = ChildTubeSprite::createWithTexture(m_rtCurve2->getSprite()->getTexture()); podChild2->setPosition(childPosWithOffset); podChild2->setRotation(180); podChild2->setTag(TAG_CURVE_BOTTONRIGHT); addChild(podChild2,Z_CHILD2); break; } case TILETYPE_CURVE_TWO_BOTTONLEFT_TOPRIGHT: { podChild1 = ChildTubeSprite::createWithTexture(m_rtCurve->getSprite()->getTexture()); podChild1->setPosition(childPosWithOffset); podChild1->setRotation(-90); podChild1->setTag(TAG_CURVE_BOTTONLEFT); addChild(podChild1,Z_CHILD1); podChild2 = ChildTubeSprite::createWithTexture(m_rtCurve2->getSprite()->getTexture()); podChild2->setPosition(childPosWithOffset); podChild2->setRotation(90); podChild2->setTag(TAG_CURVE_TOPRIGHT); addChild(podChild2,Z_CHILD2); break; } case TILETYPE_LINE_ONE_HORIZONTAL: { podChild1 = ChildTubeSprite::createWithTexture(m_rtLine->getSprite()->getTexture()); podChild1->setPosition(childPosWithOffset); podChild1->setRotation(-90); podChild1->setTag(TAG_LINE_HORIZONTAL); addChild(podChild1,Z_CHILD1); break; } case TILETYPE_LINE_ONE_VERTICAL: { podChild1 = ChildTubeSprite::createWithTexture(m_rtLine->getSprite()->getTexture()); podChild1->setPosition(childPosWithOffset); podChild1->setTag(TAG_LINE_VERTICAL); addChild(podChild1,Z_CHILD1); break; } case TILETYPE_LINE_TWO_HORIZONTALONTOP: { podChild1 = ChildTubeSprite::createWithTexture(m_rtLine->getSprite()->getTexture()); podChild1->setPosition(childPosWithOffset); podChild1->setTag(TAG_LINE_VERTICAL); addChild(podChild1,Z_CHILD1); podChild2 = ChildTubeSprite::createWithTexture(m_rtLine2->getSprite()->getTexture()); podChild2->setPosition(childPosWithOffset); podChild2->setRotation(-90); podChild2->setTag(TAG_LINE_HORIZONTAL); addChild(podChild2,Z_CHILD2); break; } case TILETYPE_LINE_TWO_VERTICALONTOP: { podChild1 = ChildTubeSprite::createWithTexture(m_rtLine->getSprite()->getTexture()); podChild1->setPosition(childPosWithOffset); podChild1->setRotation(-90); podChild1->setTag(TAG_LINE_HORIZONTAL); addChild(podChild1,Z_CHILD1); podChild2 = ChildTubeSprite::createWithTexture(m_rtLine2->getSprite()->getTexture()); podChild2->setPosition(ccp(tileWidth/2,tileHeight/2)); podChild2->setTag(TAG_LINE_VERTICAL); addChild(podChild2,Z_CHILD2); break; } default: break; } //////solve the not match glitch if (podChild1) { podChild1->setScale(tile_rt_scale); } if (podChild2) { podChild2->setScale(tile_rt_scale); } /////////////////////// //set the render texture if (genericType == GENERIC_TYPE_LINE) { if (podChild1) { podChild1->setRenderTexture(m_rtLine); } if (podChild2) { podChild2->setRenderTexture(m_rtLine2); } } else { if (podChild1) { podChild1->setRenderTexture(m_rtCurve); } if (podChild2) { podChild2->setRenderTexture(m_rtCurve2); } } //decide tubeCount if (TILETYPE_VOID == type||TILETYPE_NOTUBE == type) { m_remainTubes = 0; } else if (TILETYPE_LINE_TWO_VERTICALONTOP == type ||TILETYPE_LINE_TWO_HORIZONTALONTOP == type || TILETYPE_CURVE_TWO_BOTTONLEFT_TOPRIGHT == type ||TILETYPE_CURVE_TWO_TOPLEFT_BOTTONRIGHT == type ) { m_remainTubes = 2; } else { m_remainTubes = 1; } return true; }
void MCViewportLayer::draw(void) { CCLayer::draw(); bool MC_SHOW_OBJECTS = true; bool MC_SHOW_VISIONS = false; bool MC_SHOW_ENTRANCES = true; bool MC_SHOW_SEMITRANSPARENTS = false; bool MC_SHOW_BARRIERS = false; bool MC_SHOW_SKILLS = true; if (1) { CCObject *obj; MCRoleEntity *roleEntity; MCRole *role; CCPoint mapOffset = map->getPosition(); /* objects */ if (MC_SHOW_OBJECTS) { CCARRAY_FOREACH(objects, obj) { role = (MCRole *) obj; roleEntity = role->getEntity(); MCOBB obb = roleEntity->getOBB(); CCRect aabb; CCPoint dp; /* AABB */ aabb = CCRectMake(obb.center.x - obb.extents.width, obb.center.y - obb.extents.height, obb.width, obb.height); aabb.origin = ccpAdd(aabb.origin, mapOffset); dp = ccp(aabb.origin.x + aabb.size.width, aabb.origin.y + aabb.size.height); ccDrawSolidRect(aabb.origin, dp, ccc4f(0.6, 0.6, 0.6, 0.4)); /* draw viewport */ if (MC_SHOW_VISIONS) { if (role->getAI()) { #if (MC_COLLISION_USE_OBB == 1) MCOBB vpOBB = role->getAI()->getVision()->getOBB(); CCRect aabb = vpOBB.getAABB(); aabb.origin = ccpAdd(aabb.origin, mapOffset); CCPoint dp = ccp(aabb.origin.x + vpOBB.width, aabb.origin.y + vpOBB.height); #else CCRect aabb = role->getAI()->getVision()->getFrame(); aabb.origin = ccpAdd(aabb.origin, mapOffset); CCPoint dp = ccp(aabb.origin.x + aabb.size.width, aabb.origin.y + aabb.size.height); #endif ccDrawSolidRect(aabb.origin, dp, ccc4f(0.9, 0.2, 0.1, 0.4)); } } } }
void ComDraw::drawSolidRect(CCPoint origin, CCPoint destination, string color, double fog) { ccDrawSolidRect(origin, destination, changeColor(color, fog)); }