Closed aismann closed 11 months ago
Not recommand use setLineWith because the render backend opengl & metal have diferrent behavior:
I hit this as well and found a workaround by taking the drawSolidCircle
code and calling drawPolygon
instead ofdrawSolidPoly
and passing thickness along:
static void drawCircle(DrawNode &node, const Vec2 ¢er, float radius, float angle, int segments,
float scaleX, float scaleY, const Color4F &color, float thickness) {
const float coef = 2.0f * (float)M_PI / static_cast<float>(segments);
Vec2 *vertices = new (std::nothrow) Vec2[segments];
if (vertices == nullptr)
return;
for (unsigned int i = 0; i < segments; i++) {
float rads = static_cast<float>(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;
}
node.drawPolygon(vertices, segments, Color4F(), thickness, color);
CC_SAFE_DELETE_ARRAY(vertices);
}
Might be of help to someone, or could perhaps become a new helper if it seems useful enough.
Steps to Reproduce: cpp-tests->31:Node:Draw>GitHub Issue #11942 (axmol #137)"
Wrong: Latest build:
Works: Thats a older version