void SlingSprite::draw() { CCSprite::draw(); ccDrawColor4F(1,1,1,1); ccDrawCircle(CCPoint(0,0),_radius, 0,_radius*2.0 , false); ccDrawCircle(CCPoint(0,0),1,0,_radius*2.0,false); }
void GridLayer::DrawGridLines() { // Draw the lines for(int idx = 0; idx < _pixelLines.size(); idx++) { ccDrawColor4B(20, 20, 128, 90); ccDrawCircle(_pixelLines[idx].start, 2, 0, 16, false, 1.0, 1.0); ccDrawCircle(_pixelLines[idx].end, 2, 0, 16, false, 1.0, 1.0); ccDrawLine(ccp(_pixelLines[idx].start.x,_pixelLines[idx].start.y), ccp(_pixelLines[idx].end.x,_pixelLines[idx].end.y) ); } }
KDvoid GestureShapeLayer::draw ( KDvoid ) { // Set line width. ccLineWidth ( 4.0f ); // Set point size ccPointSize ( 16 ); // Set color to blue ccDrawColor4B ( 255, 0, 0, 255 ); // We either draw a circle or a series of lines if ( m_bDrawCircle ) { // Draw a circle using circleRect information ccDrawCircle ( m_tCircleRect.origin, m_tCircleRect.size.cx, 0.0f, 100, KD_FALSE ); } else if ( m_bDrawLines ) { // Draw all lines for ( KDuint i = 0; i < m_pLines->count ( ); i++ ) { GestureLine* pLine = (GestureLine*) m_pLines->objectAtIndex ( i ); ccDrawLine ( pLine->getPoint1 ( ), pLine->getPoint2 ( ) ); } } // Restore original values ccLineWidth ( 1 ); ccDrawColor4B ( 255, 255, 255, 255 ); ccPointSize ( 1 ); }
void Planet::drawSelection() { ccDrawColor4B(255, 255, 255, 255); glLineWidth(3); ccDrawCircle(getPosition(), _radius, CC_DEGREES_TO_RADIANS(360), 50, false); }
KDvoid Waypoint::draw ( KDvoid ) { // Uncomment to draw waypoint circles and lines between them. For debug purpose only. ccDrawColor4B ( 128, 128, 0, 64 ); CCPoint tLocalCenter = CCNode::convertToNodeSpace ( this->getPosition ( ) ); ccDrawCircle ( tLocalCenter, 6, 360, 30, KD_FALSE ); ccDrawCircle ( tLocalCenter, 2, 360, 30, KD_FALSE ); if ( m_pNextWaypoint ) { CCPoint tNextWpPos = CCNode::convertToNodeSpace ( m_pNextWaypoint->getPosition ( ) ); ccDrawLine ( tLocalCenter, tNextWpPos ); } CCNode::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 SectorLayer::draw() { float r = 0.1; CCSize size = CCDirector::sharedDirector()->getWinSize(); ccDrawColor4F(1, 1, 1, 1); glLineWidth(2); ccDrawCircle(ccp(0,0), r*size.width/2, 360, 50, false); float l,w,h; w = size.width; h = size.height; l = sqrt(w*w + h*h); ccDrawColor4F(1.0,1.0,1.0,1.0); for(int i = 0; i < 6; i++) { ccDrawLine(ccp(r*size.width/2*cos(i*M_PI/3),r*size.width/2*sin(i*M_PI/3)), ccp(l*cos(i*M_PI/3),l*sin(i*M_PI/3))); } glLineWidth(1); }
void drawTItems(Track *track,CCPoint * timelineTrackRatio,CCSize * timeLineSize,float * addtionalDistance) { float trackHeight=track->getHeight(); float itemThickness=10.f; glLineWidth(itemThickness); float radius=timeLineSize->height/6; float newX,newY; for (int i=0;i < track->_items.size();i++) { if(track->_items[i]->getClassName()=="StarItem" && track->_items[i]->isVisible()) { newX=(track->_items[i]->getPositionX() + *addtionalDistance)* timelineTrackRatio->x; newY=timeLineSize->height/2 + trackHeight; // ccDrawCircle(track->_items[i]->getPosition(),10,CC_DEGREES_TO_RADIANS(90),180,false,1.5f,1.5f); ccDrawColor4F(0.5f,0.1f,0.0f,0.1f); ccDrawCircle(ccp(newX,newY),radius,CC_DEGREES_TO_RADIANS(90),180,false,1.5f,1.5f); } } }
void DrawPrimitivesTest::draw() { CCLayer::draw(); CCSize s = CCDirector::sharedDirector()->getWinSize(); // draw a simple line // The default state is: // Line Width: 1 // color: 255,255,255,255 (white, non-transparent) // Anti-Aliased glEnable(GL_LINE_SMOOTH); ccDrawLine( CCPointMake(0, 0), CCPointMake(s.width, s.height) ); // line: color, width, aliased // glLineWidth > 1 and GL_LINE_SMOOTH are not compatible // GL_SMOOTH_LINE_WIDTH_RANGE = (1,1) on iPhone glDisable(GL_LINE_SMOOTH); glLineWidth( 5.0f ); /*glColor4ub(255,0,0,255);*/ glColor4f(1.0, 0.0, 0.0, 1.0); ccDrawLine( CCPointMake(0, s.height), CCPointMake(s.width, 0) ); // TIP: // If you are going to use always the same color or width, you don't // need to call it before every draw // // Remember: OpenGL is a state-machine. // draw big point in the center glPointSize(64); /*glColor4ub(0,0,255,128);*/ glColor4f(0.0, 0.0, 1.0, 0.5); ccDrawPoint( CCPointMake(s.width / 2, s.height / 2) ); // draw 4 small points CCPoint points[] = { CCPointMake(60,60), CCPointMake(70,70), CCPointMake(60,70), CCPointMake(70,60) }; glPointSize(4); /*glColor4ub(0,255,255,255);*/ glColor4f(0.0, 1.0, 1.0, 1.0); ccDrawPoints( points, 4); // draw a green circle with 10 segments glLineWidth(16); /*glColor4ub(0, 255, 0, 255);*/ glColor4f(0.0, 1.0, 0.0, 1.0); ccDrawCircle( CCPointMake(s.width/2, s.height/2), 100, 0, 10, false); // draw a green circle with 50 segments with line to center glLineWidth(2); /*glColor4ub(0, 255, 255, 255);*/ glColor4f(0.0, 1.0, 1.0, 1.0); ccDrawCircle( CCPointMake(s.width/2, s.height/2), 50, CC_DEGREES_TO_RADIANS(90), 50, true); // open yellow poly /*glColor4ub(255, 255, 0, 255);*/ glColor4f(1.0, 1.0, 0.0, 1.0); glLineWidth(10); CCPoint vertices[] = { CCPointMake(0,0), CCPointMake(50,50), CCPointMake(100,50), CCPointMake(100,100), CCPointMake(50,100) }; ccDrawPoly( vertices, 5, false); // closed purble poly /*glColor4ub(255, 0, 255, 255);*/ glColor4f(1.0, 0.0, 1.0, 1.0); glLineWidth(2); CCPoint vertices2[] = { CCPointMake(30,130), CCPointMake(30,230), CCPointMake(50,200) }; ccDrawPoly( vertices2, 3, true); // draw quad bezier path ccDrawQuadBezier(CCPointMake(0,s.height), CCPointMake(s.width/2,s.height/2), CCPointMake(s.width,s.height), 50); // draw cubic bezier path ccDrawCubicBezier(CCPointMake(s.width/2, s.height/2), CCPointMake(s.width/2+30,s.height/2+50), CCPointMake(s.width/2+60,s.height/2-50),CCPointMake(s.width, s.height/2),100); // restore original values glLineWidth(1); /*glColor4ub(255,255,255,255);*/ glColor4f(1.0, 1.0, 1.0, 1.0); glPointSize(1); }
void CC_DLL ccDrawCircle( const CCPoint& center, float radius, float angle, unsigned int segments, bool drawLineToCenter, bool fill) { ccDrawCircle(center, radius, angle, segments, drawLineToCenter, 1.0f, 1.0f, fill); }
//virtual void SpellDiagramNode::draw() { CCNode::draw(); float ptSz = 5; ccDrawInit(); ccPointSize(ptSz); glLineWidth(ptSz); //ccDrawColor4B(0, 0, 256, 256); ccDrawColor4F(0.0f, 0.0f, 1.0f, 1.0f); //ccDrawLine(ccp(0,0), ccp(100, 100)); Json::Value& lines = m_spellDiagrams[m_type]["lines"]; for( int i=0; i< lines.size(); i++) { std::string type = lines[i].get("type", "circle").asString(); if( type.compare("circle") == 0 ) { ccDrawCircle(ccp(0,0), size/2, 0, 32, false); }else if( type.compare("bezier") == 0 ) { Json::Value& pts = lines[i]["points"]; ccDrawCubicBezier(ccp(size*pts[0u].asDouble(), size*pts[1].asDouble()), ccp(size*pts[2].asDouble(), size*pts[3].asDouble()), ccp(size*pts[4].asDouble(), size*pts[5].asDouble()), ccp(size*pts[6].asDouble(), size*pts[7].asDouble()), 32); }else if( type.compare("line") == 0 ) { Json::Value& pts = lines[i]["points"]; ccDrawLine(ccp(size*pts[0u].asDouble(), size*pts[1].asDouble()), ccp(size*pts[2].asDouble(), size*pts[3].asDouble()) ); } } /* if( m_type == SD_08_FORTRESS ) { //square shape ccDrawLine(ccp(-size/2 - ptSz/2, size/2), ccp(size/2 + ptSz/2, size/2)); //top ccDrawLine(ccp(-size/2 - ptSz/2, -size/2), ccp(size/2 + ptSz/2, -size/2)); //btm ccDrawLine(ccp(size/2, size/2), ccp(size/2 , -size/2)); //right ccDrawLine(ccp(-size/2, size/2), ccp(-size/2 , -size/2)); //left } if( m_type == SD_06_LESSER_TRIQUESTRA || m_type == SD_11_LEAF || m_type == SD_13_GREATER_TRIQUETRA ) { float topY = tA.y; float botY = tB.y; float midY = 0; CCPoint lcp1 = ccp(size*0.1666, -size*0.2167); CCPoint lcp2 = ccp(size*0.3335, size*0.1233); ccDrawCubicBezier(tC, lcp1, lcp2, tA, 32); //left CCPoint rcp1 = ccp(-size*0.1666, -size*0.2167); CCPoint rcp2 = ccp(-size*0.3335, size*0.1233); ccDrawCubicBezier(tB, rcp1, rcp2, tA, 32); //right CCPoint bcp1 = ccp(-size*0.25, size*0.286); CCPoint bcp2 = ccp( size*0.25, size*0.286); ccDrawCubicBezier(tC, bcp1, bcp2, tB, 32); //bottom } if( m_type == SD_07_COMPASS || m_type == SD_03_ADEPTS_CIRCLE ) { ccDrawLine(ccp(0, size/2), ccp(0, -size/2)); } if( m_type == SD_05_SERPENTS_EYE ) { //shorter verticle line for eye ccDrawLine( seT, seB); } if( m_type == SD_11_LEAF ) { //offset verticle line for leaf ccDrawLine(leT, leB); } if( m_type == SD_09_DRAGONS_EYE ) { //shorter eye CCPoint t = ccp(0, size*0.38); CCPoint b = ccp(0, -size*0.38); CCPoint rcp1 = ccp(size/3,size/5); CCPoint rcp2 = ccp(size/3,-size/5); ccDrawCubicBezier(t, rcp1, rcp2, b, 32); CCPoint lcp1 = ccp(-size/3,size/5); CCPoint lcp2 = ccp(-size/3,-size/5); ccDrawCubicBezier(t, lcp1, lcp2, b, 32); } if( m_type == SD_10_SEEING_EYE ) { //shorter eye ccDrawCubicBezier(ccp(-size/2, 0), ccp(-size/3, size/4), ccp(size/3,size/4), ccp(size/2,0), 32); ccDrawCubicBezier(ccp(-size/2, 0), ccp(-size/3, -size/4), ccp(size/3,-size/4), ccp(size/2,0), 32); } if( m_type == SD_07_COMPASS ) { //horizontal line ccDrawLine(ccp(-size/2, 0), ccp(size/2, 0)); } */ }
void Ball::draw(){ ccDrawCircle(CCPointZero, r, 360, 3, true); setRotation(getRotation()+10); }
void CCCircleShape::drawProc(void) { ccDrawCircle(getDrawPosition(), m_radius, m_angle, m_segments, m_drawLineToCenter, m_scaleX, m_scaleY); }
void CircleObject::draw() { glLineWidth(2.0); ccDrawColor4B(128, 128, 128, 255); ccDrawCircle(m_center, m_radius, 0, 100, 0); }
void Circle::draw(){ ccDrawCircle(ccp(0, 0), r, 0, 50, true); }