void Planta::draw(void) { // ccDrawPoly(vs, 4+fase*2, true); int i; int fasestodraw=((fase>3)?3:fase); for (i=0;i<=fasestodraw;i++) { ccDrawSolidPoly(&(draw_vs[4*i]), 4, ccc4f(0, 0.7+0.1*i, 0, 1)); } }
void draw() { if(this->getOpacity() <= 0) return; #if CC_TARGET_PLATFORM != CC_PLATFORM_WINRT glLineWidth(1); #endif CCPoint filledVertices[] = { ccp(0,0), ccp(0,Options::CAMERA_HEIGHT), ccp(Options::CAMERA_WIDTH,Options::CAMERA_HEIGHT), ccp(Options::CAMERA_WIDTH, 0)}; ccDrawSolidPoly(filledVertices, 4, ccc4f(0.0f, 0.0f, 0, this->getOpacity() / 255.0) ); }
void ccDrawSolidRect( CCPoint origin, CCPoint destination, ccColor4F color ) { CCPoint vertices[] = { origin, ccp(destination.x, origin.y), destination, ccp(origin.x, destination.y) }; ccDrawSolidPoly(vertices, 4, color ); }
void PauseGameLayer::draw(void) { cocos2d::CCSize size = cocos2d::CCDirector::sharedDirector()->getWinSize(); const CCPoint glPoint[] = { ccp(-1.0f * size.width, 1.0f * size.height), // top left ccp(-1.0f * size.width, -1.0f * size.height), // bottom left ccp( 1.0f * size.width, -1.0f * size.height), // bottom right ccp( 1.0f * size.width, 1.0f * size.height) // top right }; ccDrawSolidPoly(glPoint, 4, ccc4f(0, 0, 0, 0.3f)); }
void BWDrawLayer::draw() { ccDrawColor4B(0,255,0,255); const int nNum = _vDrawPos.size(); Point * PosArray = new Point[nNum]; for(int i=0;i<nNum;++i) { PosArray[i] = _vDrawPos[i]; } ccDrawSolidPoly(PosArray, nNum, Color4F(0,0,0,255) ); }
void OzgCCUtility::ccDrawSolidCircle(const CCPoint& center, float radius, unsigned int segments, ccColor4F color) { const float coef = 2.0f * (float)M_PI / segments; CCPoint *vertices = (CCPoint*)calloc(segments + 1, sizeof(CCPoint)); for(unsigned int i = 0;i <= segments; i++) { float rads = i * coef; GLfloat j = radius * cosf(rads) + center.x; GLfloat k = radius * sinf(rads) + center.y; vertices[i].x = j; vertices[i].y = k; } ccDrawSolidPoly(vertices, segments, color); free(vertices); }
void CCPolygonShape::drawProc(void) { const CCPoint center = getDrawPosition(); for (unsigned int i = 0; i < m_numberOfVertices; ++i) { m_verticesDraw[i].x = m_vertices[i].x + center.x; m_verticesDraw[i].y = m_vertices[i].y + center.y; } if (m_fill) { ccDrawSolidPoly(m_verticesDraw, m_numberOfVertices, m_color); } else { ccDrawColor4F(m_color.r, m_color.g, m_color.b, m_color.a); ccDrawPoly(m_verticesDraw, m_numberOfVertices, m_close); } }
void GWDiv::draw( void ) { CCPoint pos = getPosition(); CCSize size = getContentSize(); int x = pos.x; int y = pos.y; /* 本身节点已经被设置了坐标,而绘几何图形时,是以本身节点为基准的, 也就是说,几何图形相当于节点的子控件,所以几何图形的坐标为(0, 0)即可 */ x = 0; y = 0; //CCLOG("x = %d, width = %f, height = %f", x, size.width, size.height); /* 以中点为对齐点 */ CCPoint filledVertices[] = { ccp(x - size.width / 2, y + size.height / 2), ccp(x + size.width / 2, y + size.height / 2), ccp(x + size.width / 2, y - size.height / 2), ccp(x - size.width / 2, y - size.height / 2), }; ccDrawSolidPoly(filledVertices, 4, ccc4f(0.5f, 0.5f, 1, 1 ) ); CCPoint filledVertices2[] = { ccp(x, y), ccp(x + size.width, y), ccp(x + size.width, y - size.height), ccp(x, y - size.height), }; //ccDrawSolidPoly(filledVertices2, 4, ccc4f(0.9f, 0.5f, 1, 1 ) ); CCPoint filledVertices3[] = { ccp(x, y), ccp(x + size.width, y), ccp(x + size.width, y + size.height), ccp(x, y + size.height), }; //ccDrawSolidPoly(filledVertices3, 4, ccc4f(0.1f, 0.5f, 1, 1 ) ); }
void ComDraw::drawSolidPoly(const CCPoint *poli, unsigned int numberOfPoints, string color) { ccDrawSolidPoly(poli, numberOfPoints, changeColor(color, 1.f)); }
void ccDrawSolidRoundRect(CCPoint origin, CCPoint destination, float cornerRadius, ccColor4B color) { // ensure origin is left bottom CCPoint bl = origin; CCPoint tr = destination; if(bl.x > tr.x) { bl.x = MIN(origin.x, destination.x); tr.x = MAX(origin.x, destination.x); } if(bl.y > tr.y) { bl.y = MIN(origin.y, destination.y); tr.y = MAX(origin.y, destination.y); } // four center of corners CCPoint tlCenter = ccp(bl.x + cornerRadius, tr.y - cornerRadius); CCPoint trCenter = ccp(tr.x - cornerRadius, tr.y - cornerRadius); CCPoint blCenter = ccp(bl.x + cornerRadius, bl.y + cornerRadius); CCPoint brCenter = ccp(tr.x - cornerRadius, bl.y + cornerRadius); // populate vertices CCPoint vertices[] = { // left edge ccp(bl.x, bl.y + cornerRadius), ccp(bl.x, tr.y - cornerRadius), // top left corner ccpAdd(tlCenter, ccpDegree(170) * cornerRadius), ccpAdd(tlCenter, ccpDegree(160) * cornerRadius), ccpAdd(tlCenter, ccpDegree(150) * cornerRadius), ccpAdd(tlCenter, ccpDegree(140) * cornerRadius), ccpAdd(tlCenter, ccpDegree(130) * cornerRadius), ccpAdd(tlCenter, ccpDegree(120) * cornerRadius), ccpAdd(tlCenter, ccpDegree(110) * cornerRadius), ccpAdd(tlCenter, ccpDegree(100) * cornerRadius), // top edge ccp(bl.x + cornerRadius, tr.y), ccp(tr.x - cornerRadius, tr.y), // right top corner ccpAdd(trCenter, ccpDegree(80) * cornerRadius), ccpAdd(trCenter, ccpDegree(70) * cornerRadius), ccpAdd(trCenter, ccpDegree(60) * cornerRadius), ccpAdd(trCenter, ccpDegree(50) * cornerRadius), ccpAdd(trCenter, ccpDegree(40) * cornerRadius), ccpAdd(trCenter, ccpDegree(30) * cornerRadius), ccpAdd(trCenter, ccpDegree(20) * cornerRadius), ccpAdd(trCenter, ccpDegree(10) * cornerRadius), // right edge ccp(tr.x, tr.y - cornerRadius), ccp(tr.x, bl.y + cornerRadius), // bottom right corner ccpAdd(brCenter, ccpDegree(-10) * cornerRadius), ccpAdd(brCenter, ccpDegree(-20) * cornerRadius), ccpAdd(brCenter, ccpDegree(-30) * cornerRadius), ccpAdd(brCenter, ccpDegree(-40) * cornerRadius), ccpAdd(brCenter, ccpDegree(-50) * cornerRadius), ccpAdd(brCenter, ccpDegree(-60) * cornerRadius), ccpAdd(brCenter, ccpDegree(-70) * cornerRadius), ccpAdd(brCenter, ccpDegree(-80) * cornerRadius), // bottom edge ccp(tr.x - cornerRadius, bl.y), ccp(bl.x + cornerRadius, bl.y), // bottom left corner ccpAdd(blCenter, ccpDegree(-100) * cornerRadius), ccpAdd(blCenter, ccpDegree(-110) * cornerRadius), ccpAdd(blCenter, ccpDegree(-120) * cornerRadius), ccpAdd(blCenter, ccpDegree(-130) * cornerRadius), ccpAdd(blCenter, ccpDegree(-140) * cornerRadius), ccpAdd(blCenter, ccpDegree(-150) * cornerRadius), ccpAdd(blCenter, ccpDegree(-160) * cornerRadius), ccpAdd(blCenter, ccpDegree(-170) * cornerRadius) }; ccDrawSolidPoly(vertices, 40, ccc4FFromccc4B(color)); }