void drawSolidRect(Vec2 origin, Vec2 destination, Color4F color) { Vec2 vertices[] = { origin, Vec2(destination.x, origin.y), destination, Vec2(origin.x, destination.y) }; drawSolidPoly(vertices, 4, color ); }
void DrawNode::drawSolidRect(const Vec2 &origin, const Vec2 &destination, const Color4F &color) { Vec2 vertices[] = { origin, Vec2(destination.x, origin.y), destination, Vec2(origin.x, destination.y) }; drawSolidPoly(vertices, 4, color ); }
void drawSolidRect( Point origin, Point destination, Color4F color ) { Point vertices[] = { origin, Point(destination.x, origin.y), destination, Point(origin.x, destination.y) }; drawSolidPoly(vertices, 4, color ); }
void DrawNode::drawSolidCircle(const Vec2& center, float radius, float angle, unsigned int segments, float scaleX, float scaleY, const Color4F &color) { const float coef = 2.f * (float)M_PI/segments; Vec2* vertices = (Vec2*)CC_ALLOCA(segments * sizeof(Vec2)); if (!vertices) return; for (auto i = 0u; i < segments; ++i) { float rads = i*coef; float j = radius * cosf(rads + angle) * scaleX + center.x; float k = radius * sinf(rads + angle) * scaleY + center.y; vertices[i].x = j; vertices[i].y = k; } drawSolidPoly(vertices, segments, color); }
void DrawNode::drawSolidCircle(const Vec2& center, float radius, float angle, unsigned int segments, float scaleX, float scaleY, const Color4F &color) { const float coef = 2.0f * (float)M_PI/segments; Vec2 *vertices = new (std::nothrow) Vec2[segments]; if( ! vertices ) return; for(unsigned int i = 0;i < segments; i++) { float rads = i*coef; GLfloat j = radius * cosf(rads + angle) * scaleX + center.x; GLfloat k = radius * sinf(rads + angle) * scaleY + center.y; vertices[i].x = j; vertices[i].y = k; } drawSolidPoly(vertices, segments, color); CC_SAFE_DELETE_ARRAY(vertices); }
void drawSolidCircle( const KKPoint& center, float radius, float angle, unsigned int segments) { const float coef = 2.0f * (float)M_PI/segments; GLfloat *vertices = (GLfloat*)calloc( sizeof(GLfloat)*2*(segments+2), 1); if( ! vertices ) return; for(unsigned int i = 0;i <= segments; i++) { float rads = i*coef; GLfloat j = radius * cosf(rads + angle) + center.x; GLfloat k = radius * sinf(rads + angle) + center.y; vertices[i*2] = j; vertices[i*2+1] = k; } vertices[(segments+1)*2] = center.x; vertices[(segments+1)*2+1] = center.y; drawSolidPoly((KKPoint *)vertices, segments); free( vertices ); }
void drawSolidRect(const KKPoint& origin, const KKPoint& dest) { KKPoint vertices[] = {origin, KKPoint(dest.x, origin.y), dest, KKPoint(origin.x, dest.y)}; drawSolidPoly(vertices, 4); }