Add (missing) parameter 'drawLineToCenter' to 'drawSolidCircle(...)' (#2160)

* Add parameter drawLineToCenter to drawSolidCircle

* fix  drawSolidTringle/drawTriangle

* Update axlua_base_auto.cpp
This commit is contained in:
aismann 2024-09-17 16:09:05 +02:00 committed by GitHub
parent 96be23ebd4
commit c488380170
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 204 additions and 153 deletions

View File

@ -704,14 +704,16 @@ void DrawNode::drawSolidCircle(const Vec2& center,
float scaleY,
const Color4B& fillColor,
float thickness,
const Color4B& borderColor)
const Color4B& borderColor,
bool drawLineToCenter)
{
if (thickness < 0.0f)
{
AXLOGW("{}: thickness < 0, changed to 0", __FUNCTION__);
thickness = 0.0f;
}
_drawCircle(center, radius, angle, segments, false, scaleX, scaleY, borderColor, fillColor, true, thickness);
_drawCircle(center, radius, angle, segments, drawLineToCenter, scaleX, scaleY, borderColor, fillColor, true,
thickness);
}
void DrawNode::drawSolidCircle(const Vec2& center,
@ -744,20 +746,16 @@ void DrawNode::drawSolidCircle(const Vec2& center,
_drawCircle(center, radius, angle, segments, false, 1.0f, 1.0f, Color4B(), color, true);
}
void DrawNode::drawTriangle(const Vec2* _vertices3, const Color4B& color, float thickness)
void DrawNode::drawTriangle(const Vec2* _vertices3, const Color4B& color)
{
_drawTriangle(_vertices3, Color4B::TRANSPARENT, color, false, thickness);
_drawTriangle(_vertices3, Color4B::TRANSPARENT, color, false, 0.0f);
}
void DrawNode::drawTriangle(const Vec2& p1, const Vec2& p2, const Vec2& p3, const Color4B& color, float thickness)
void DrawNode::drawTriangle(const Vec2& p1, const Vec2& p2, const Vec2& p3, const Color4B& color)
{
if (thickness <= 0.0f)
{
AXLOGW("{}: thickness <= 0", __FUNCTION__);
return;
}
Vec2 _vertices3[3] = {p1, p2, p3};
_drawTriangle(_vertices3, Color4B::TRANSPARENT, color, false, thickness);
_drawTriangle(_vertices3, Color4B::TRANSPARENT, color, false, 0.0f);
}
void DrawNode::drawSolidTriangle(const Vec2* _vertices3,
@ -1256,7 +1254,7 @@ void DrawNode::_drawCircle(const Vec2& center,
{
const float coef = 2.0f * (float)M_PI / segments;
int count = (drawLineToCenter) ? 3 : 2;
int count = (drawLineToCenter) ? 3 : 2;
Vec2* _vertices = new Vec2[segments + count];
float rsX = radius * scaleX;
@ -1272,18 +1270,11 @@ void DrawNode::_drawCircle(const Vec2& center,
if (drawLineToCenter)
_vertices[++segments] = center;
if (solid)
{
_drawPolygon(_vertices, segments + 1, fillColor, borderColor, false, thickness, true);
}
else
{
if (drawLineToCenter)
_drawPoly(_vertices, segments + 1, false, borderColor, thickness, true);
else
_drawPoly(_vertices, segments + 1, false, borderColor, thickness, true);
}
_drawPoly(_vertices, segments + 1, false, borderColor, thickness, true);
AX_SAFE_DELETE_ARRAY(_vertices);
}
@ -1295,9 +1286,9 @@ void DrawNode::_drawTriangle(const Vec2* _vertices3,
{
unsigned int vertex_count = 3;
if (thickness != 1.0f)
if (thickness != 0.0f)
{
_drawPolygon(_vertices3, vertex_count, Color4B::BLUE, Color4B::BLUE, true, thickness, true);
_drawPolygon(_vertices3, vertex_count, fillColor, borderColor, true, thickness, true);
}
else
{

View File

@ -355,6 +355,7 @@ public:
* @param fillColor The color will fill in polygon.
* @param thickness The border of line width.
* @param borderColor The border of line color.
* @param drawLineToCenter Whether or not draw the line from the origin to center.
* @js NA
*/
void drawSolidCircle(const Vec2& center,
@ -365,7 +366,8 @@ public:
float scaleY,
const Color4B& fillColor,
float thickness,
const Color4B& borderColor);
const Color4B& borderColor,
bool drawLineToCenter = false);
/** Draws a solid circle given the center, radius and number of segments.
* @param center The circle center point.
@ -501,9 +503,9 @@ public:
* @js NA
*/
void drawTriangle(const Vec2* vertices3, const Color4B& color, float thickness = 1.0f);
void drawTriangle(const Vec2* vertices3, const Color4B& color);
void drawTriangle(const Vec2& p1, const Vec2& p2, const Vec2& p3, const Color4B& color, float thickness = 1.0f);
void drawTriangle(const Vec2& p1, const Vec2& p2, const Vec2& p3, const Color4B& color);
void drawSolidTriangle(const Vec2* vertices3,
const Color4B& fillColor,

View File

@ -52627,6 +52627,54 @@ int lua_ax_base_DrawNode_drawSolidCircle(lua_State* tolua_S)
}
}while(0);
ok = true;
do{
if (argc == 10) {
ax::Vec2 arg0;
ok &= luaval_to_vec2(tolua_S, 2, &arg0, "ax.DrawNode:drawSolidCircle");
if (!ok) { break; }
double arg1;
ok &= luaval_to_number(tolua_S, 3,&arg1, "ax.DrawNode:drawSolidCircle");
if (!ok) { break; }
double arg2;
ok &= luaval_to_number(tolua_S, 4,&arg2, "ax.DrawNode:drawSolidCircle");
if (!ok) { break; }
unsigned int arg3;
ok &= luaval_to_uint32(tolua_S, 5,&arg3, "ax.DrawNode:drawSolidCircle");
if (!ok) { break; }
double arg4;
ok &= luaval_to_number(tolua_S, 6,&arg4, "ax.DrawNode:drawSolidCircle");
if (!ok) { break; }
double arg5;
ok &= luaval_to_number(tolua_S, 7,&arg5, "ax.DrawNode:drawSolidCircle");
if (!ok) { break; }
ax::Color4B arg6;
ok &=luaval_to_color4b(tolua_S, 8, &arg6, "ax.DrawNode:drawSolidCircle");
if (!ok) { break; }
double arg7;
ok &= luaval_to_number(tolua_S, 9,&arg7, "ax.DrawNode:drawSolidCircle");
if (!ok) { break; }
ax::Color4B arg8;
ok &=luaval_to_color4b(tolua_S, 10, &arg8, "ax.DrawNode:drawSolidCircle");
if (!ok) { break; }
bool arg9;
ok &= luaval_to_boolean(tolua_S, 11,&arg9, "ax.DrawNode:drawSolidCircle");
if (!ok) { break; }
cobj->drawSolidCircle(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
lua_settop(tolua_S, 1);
return 1;
}
}while(0);
ok = true;
do{
if (argc == 5) {
ax::Vec2 arg0;
@ -53133,34 +53181,6 @@ int lua_ax_base_DrawNode_drawTriangle(lua_State* tolua_S)
}
}while(0);
ok = true;
do{
if (argc == 5) {
ax::Vec2 arg0;
ok &= luaval_to_vec2(tolua_S, 2, &arg0, "ax.DrawNode:drawTriangle");
if (!ok) { break; }
ax::Vec2 arg1;
ok &= luaval_to_vec2(tolua_S, 3, &arg1, "ax.DrawNode:drawTriangle");
if (!ok) { break; }
ax::Vec2 arg2;
ok &= luaval_to_vec2(tolua_S, 4, &arg2, "ax.DrawNode:drawTriangle");
if (!ok) { break; }
ax::Color4B arg3;
ok &=luaval_to_color4b(tolua_S, 5, &arg3, "ax.DrawNode:drawTriangle");
if (!ok) { break; }
double arg4;
ok &= luaval_to_number(tolua_S, 6,&arg4, "ax.DrawNode:drawTriangle");
if (!ok) { break; }
cobj->drawTriangle(arg0, arg1, arg2, arg3, arg4);
lua_settop(tolua_S, 1);
return 1;
}
}while(0);
ok = true;
do{
if (argc == 2) {
const ax::Vec2* arg0;
@ -53177,26 +53197,6 @@ int lua_ax_base_DrawNode_drawTriangle(lua_State* tolua_S)
}
}while(0);
ok = true;
do{
if (argc == 3) {
const ax::Vec2* arg0;
ok &= luaval_to_object<const ax::Vec2>(tolua_S, 2, "ax.Vec2",&arg0, "ax.DrawNode:drawTriangle");
if (!ok) { break; }
ax::Color4B arg1;
ok &=luaval_to_color4b(tolua_S, 3, &arg1, "ax.DrawNode:drawTriangle");
if (!ok) { break; }
double arg2;
ok &= luaval_to_number(tolua_S, 4,&arg2, "ax.DrawNode:drawTriangle");
if (!ok) { break; }
cobj->drawTriangle(arg0, arg1, arg2);
lua_settop(tolua_S, 1);
return 1;
}
}while(0);
ok = true;
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ax.DrawNode:drawTriangle",argc, 2);
return 0;

View File

@ -1353,7 +1353,6 @@ DrawNodeTests::DrawNodeTests()
ADD_TEST_CASE(DrawNodeThicknessStressTest);
ADD_TEST_CASE(DrawNodeIssueTester);
}
DrawNodeBaseTest::DrawNodeBaseTest()
@ -2591,7 +2590,7 @@ void DrawNodeMethodsTest::drawAll()
Vec2 p3 = pts->getControlPointAtIndex(i);
drawNode->properties.setPosition(Vec2(-100, -100));
drawNode->drawQuadBezier(p1, p2, p3, 30, Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f),
drawNode->drawQuadBezier(p1, p2, p3, 30, Color4B::RED,
sliderValue[sliderType::Thickness]);
}
@ -2602,7 +2601,7 @@ void DrawNodeMethodsTest::drawAll()
Vec2 p3 = pts2->getControlPointAtIndex(i);
drawNode->properties.setPosition(Vec2(-100, -100));
drawNode->drawQuadBezier(p1, p2, p3, 30, Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f),
drawNode->drawQuadBezier(p1, p2, p3, 30, Color4B::GREEN,
sliderValue[sliderType::Thickness]);
}
@ -2625,7 +2624,7 @@ void DrawNodeMethodsTest::drawAll()
Vec2 p3 = pts->getControlPointAtIndex(i++);
Vec2 p4 = pts->getControlPointAtIndex(i);
drawNode->properties.setPosition(Vec2(-100, -100));
drawNode->drawCubicBezier(p1, p2, p3, p4, 120, Color4F::ORANGE, sliderValue[sliderType::Thickness]);
drawNode->drawCubicBezier(p1, p2, p3, p4, 120, Color4F::RED, sliderValue[sliderType::Thickness]);
}
for (int i = 0; i < 360;)
@ -2635,13 +2634,14 @@ void DrawNodeMethodsTest::drawAll()
Vec2 p3 = pts2->getControlPointAtIndex(i++);
Vec2 p4 = pts2->getControlPointAtIndex(i);
drawNode->properties.setPosition(Vec2(-100, -100));
drawNode->drawCubicBezier(p1, p2, p3, p4, 120, Color4F::ORANGE, sliderValue[sliderType::Thickness]);
drawNode->drawCubicBezier(p1, p2, p3, p4, 120, Color4F::GREEN, sliderValue[sliderType::Thickness]);
}
break;
}
case drawMethodes::CardinalSpline:
{
auto array = ax::PointArray::create(7);
array->addControlPoint(Vec2(0.0f, 0.0f));
array->addControlPoint(Vec2(80.0f, 80.0f));
@ -2660,8 +2660,9 @@ void DrawNodeMethodsTest::drawAll()
array2->addControlPoint(Vec2(size.width / 2, 80.0f));
drawNode->drawCardinalSpline(array2, 5.0f, 120, Color4F::ORANGE, sliderValue[sliderType::Thickness]);
drawNode->drawCardinalSpline(pts, 0.1f, 360, Color4F::RED, 5.0f);
drawNode->drawCardinalSpline(pts2, 0.1f, 360, Color4F::GREEN, 2.0f);
drawNode->properties.setPosition(Vec2(-100, -100));
drawNode->drawCardinalSpline(pts, 0.001f, 360, Color4F::RED, sliderValue[sliderType::Thickness]);
drawNode->drawCardinalSpline(pts2, 0.001f, 360, Color4F::GREEN, sliderValue[sliderType::Thickness]);
break;
}
@ -2685,8 +2686,9 @@ void DrawNodeMethodsTest::drawAll()
array->addControlPoint(Vec2(size.width / 2, size.height / 2));
drawNode->drawCatmullRom(array, 20, Color4F::MAGENTA, sliderValue[sliderType::Thickness]);
drawNode->drawCatmullRom(pts, 360, Color4F::RED, 5.0f);
drawNode->drawCatmullRom(pts2, 360, Color4F::GREEN, 2.0f);
drawNode->properties.setPosition(Vec2(-100, -100));
drawNode->drawCatmullRom(pts, 360, Color4F::RED, sliderValue[sliderType::Thickness]);
drawNode->drawCatmullRom(pts2, 360, Color4F::GREEN, sliderValue[sliderType::Thickness]);
break;
}
@ -2810,13 +2812,39 @@ void DrawNodeMethodsTest::drawAll()
}
case drawMethodes::Triangle:
{
drawNode->properties.setScale(Vec2(3, 3));
for (int i = 0; i < 10; i++)
static Vec2 triangle[] = {Vec2(AXRANDOM_MINUS1_1(), AXRANDOM_MINUS1_1()) * 30,
Vec2(AXRANDOM_MINUS1_1(), AXRANDOM_MINUS1_1()) * 30,
Vec2(AXRANDOM_MINUS1_1(), AXRANDOM_MINUS1_1()) * 30};
drawNode->properties.setPosition(center);
drawNode->properties.setScale(Vec2(10, 10));
// for (int i = 0; i < 10; i++)
{
drawNode->drawTriangle(Vec2(AXRANDOM_0_1() * 50 + 100, AXRANDOM_0_1() * 50 + 100),
Vec2(AXRANDOM_MINUS1_1() * 50, AXRANDOM_MINUS1_1() * 50),
Vec2(AXRANDOM_0_1() * 50 + 100, AXRANDOM_0_1() * 50 + 100),
Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f));
drawNode->drawTriangle(Vec2(AXRANDOM_MINUS1_1(), AXRANDOM_MINUS1_1()) * 20,
Vec2(AXRANDOM_MINUS1_1(), AXRANDOM_MINUS1_1()) * 20,
Vec2(AXRANDOM_MINUS1_1(), AXRANDOM_MINUS1_1()) * 20, Color4B::RED);
drawNode->drawTriangle(triangle, Color4B::GREEN);
}
break;
}
case drawMethodes::SolidTriangle:
{
static Vec2 triangle[] = {Vec2(AXRANDOM_MINUS1_1(), AXRANDOM_MINUS1_1()) * 30,
Vec2(AXRANDOM_MINUS1_1(), AXRANDOM_MINUS1_1()) * 30,
Vec2(AXRANDOM_MINUS1_1(), AXRANDOM_MINUS1_1()) * 30};
drawNode->properties.setPosition(center);
drawNode->properties.setScale(Vec2(10, 10));
// for (int i = 0; i < 10; i++)
{
drawNode->drawSolidTriangle(Vec2(AXRANDOM_MINUS1_1(), AXRANDOM_MINUS1_1()) * 20,
Vec2(AXRANDOM_MINUS1_1(), AXRANDOM_MINUS1_1()) * 20,
Vec2(AXRANDOM_MINUS1_1(), AXRANDOM_MINUS1_1()) * 20, Color4B::RED,
Color4B::BLUE, sliderValue[sliderType::Thickness]);
drawNode->properties.setPosition(center-Vec2(200,200));
drawNode->drawSolidTriangle(triangle, Color4B::GREEN, Color4B::BLUE, sliderValue[sliderType::Thickness]);
}
break;
}
@ -2846,20 +2874,38 @@ void DrawNodeMethodsTest::drawAll()
}
case drawMethodes::SolidCircle:
{
for (int i = 100; i > 1; i--)
{
drawNode->drawSolidCircle(
VisibleRect::center(), 3 * i, AX_DEGREES_TO_RADIANS(90), AXRANDOM_0_1() * 20.f + 20.f, 1.0f, 1.0f,
Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f), sliderValue[sliderType::Thickness],
Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 0.5f));
static Vec2 pos =
Vec2(AXRANDOM_MINUS1_1() * VisibleRect::rightTop().x, AXRANDOM_MINUS1_1() * VisibleRect::rightTop().y);
Vec2 pos = Vec2(-100, -100) + Vec2(AXRANDOM_MINUS1_1() * VisibleRect::rightTop().x,
AXRANDOM_MINUS1_1() * VisibleRect::rightTop().y);
drawNode->drawSolidCircle(
VisibleRect::center() + pos, AXRANDOM_0_1() * 200, AX_DEGREES_TO_RADIANS(AXRANDOM_MINUS1_1() * 90), 10,
1.0f, 1.0f, Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f),
sliderValue[sliderType::Thickness], Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f));
}
float thickness = 2.0f;
drawNode->drawSolidCircle(
VisibleRect::center(), AXRANDOM_0_1() * 200, AX_DEGREES_TO_RADIANS(AXRANDOM_MINUS1_1() * 90), 10, 1.0f,
1.0f, Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f), sliderValue[sliderType::Thickness],
Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f));
drawNode->drawSolidCircle(
VisibleRect::center() + pos, AXRANDOM_0_1() * 200, AX_DEGREES_TO_RADIANS(AXRANDOM_MINUS1_1() * 90), 10,
1.0f, 1.0f, Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f),
sliderValue[sliderType::Thickness], Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f));
drawNode->drawSolidCircle(
VisibleRect::center() - pos, AXRANDOM_0_1() * 200, AX_DEGREES_TO_RADIANS(AXRANDOM_MINUS1_1() * 90), 10,
1.0f, 1.0f, Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f),
sliderValue[sliderType::Thickness], Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f));
// for (int i = 5; i > 1; i--)
//{
// drawNode->drawSolidCircle(
// VisibleRect::center(), 3 * i, AX_DEGREES_TO_RADIANS(90), AXRANDOM_0_1() * 20.f + 20.f, 1.0f, 1.0f,
// Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f), sliderValue[sliderType::Thickness],
// Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 0.5f));
// drawNode->drawSolidCircle(
// VisibleRect::center() + pos, AXRANDOM_0_1() * 200, AX_DEGREES_TO_RADIANS(AXRANDOM_MINUS1_1() * 90),
// 10, 1.0f, 1.0f, Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f),
// sliderValue[sliderType::Thickness], Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f));
//}
break;
}
@ -2992,7 +3038,6 @@ void DrawNodeMethodsTest::drawAll()
}
}
DrawNodeDrawInWrongOrder_Issue1888::DrawNodeDrawInWrongOrder_Issue1888()
{
drawNode->properties.setDrawOrder(true);
@ -3289,64 +3334,75 @@ string DrawNodeAxmolTest2::subtitle() const
DrawNodeIssueTester::DrawNodeIssueTester()
{
static Vec2 vertices[] = {Vec2(0.0f, 0.0f), Vec2(50.0f, 50.0f), Vec2(100.0f, 50.0f), Vec2(100.0f, 100.0f),
Vec2(50.0f, 100.0f)};
int verticesCount = 5;
// static Vec2 vertices[] = {Vec2(0.0f, 0.0f), Vec2(50.0f, 50.0f), Vec2(100.0f, 50.0f), Vec2(100.0f, 100.0f),
// Vec2(50.0f, 100.0f)};
// int verticesCount = 5;
drawNode->properties.setPosition(Vec2(5, 150));
drawNode->setLineWidth(1);
drawNode->drawPoly(vertices, verticesCount, false, Color4F::GREEN);
// drawNode->properties.setPosition(Vec2(5, 150));
// drawNode->setLineWidth(1);
// drawNode->drawPoly(vertices, verticesCount, false, Color4F::GREEN);
auto draw = DrawNode::create();
addChild(draw, 10);
draw->setPosition(70, 150);
draw->drawPoly(vertices, verticesCount, false, Color4F::BLUE);
// auto draw = DrawNode::create();
// addChild(draw, 10);
// draw->setPosition(70, 150);
// draw->drawPoly(vertices, verticesCount, false, Color4F::BLUE);
drawNode->properties.setPosition(Vec2(140, 150));
drawNode->setLineWidth(1);
drawNode->drawPoly(vertices, verticesCount, false, Color4F::RED);
// drawNode->properties.setPosition(Vec2(140, 150));
// drawNode->setLineWidth(1);
// drawNode->drawPoly(vertices, verticesCount, false, Color4F::RED);
drawNode->properties.setPosition(Vec2(200, 150));
drawNode->setLineWidth(1);
drawNode->drawPoly(vertices, verticesCount, false, Color4F::RED, 3);
drawNode->drawPoly(vertices, verticesCount, false, Color4F::WHITE);
// drawNode->properties.setPosition(Vec2(200, 150));
// drawNode->setLineWidth(1);
// drawNode->drawPoly(vertices, verticesCount, false, Color4F::RED, 3);
// drawNode->drawPoly(vertices, verticesCount, false, Color4F::WHITE);
drawNode->properties.setPosition(Vec2(270, 150));
drawNode->setLineWidth(1);
drawNode->drawPoly(vertices, verticesCount, false, Color4F(0.0f, 0.5f, 0.5f, 0.5f), 10);
drawNode->drawPoly(vertices, verticesCount, false, Color4F::BLACK);
// drawNode->properties.setPosition(Vec2(270, 150));
// drawNode->setLineWidth(1);
// drawNode->drawPoly(vertices, verticesCount, false, Color4F(0.0f, 0.5f, 0.5f, 0.5f), 10);
// drawNode->drawPoly(vertices, verticesCount, false, Color4F::BLACK);
float thick = 0.0f;
float y = -90.0f;
drawNode->properties.setPosition(Vec2(270, 100));
for (int i = 0; i < 32; i++)
{
thick += 0.5f;
y += thick + 1;
drawNode->drawLine(Vec2(140, y), Vec2(180, y), Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f),
thick);
}
drawNode->drawPie(Vec2(-220, 150), 20, 0, 100, 300, 1, 1, Color4B::TRANSPARENT, Color4B::BLUE,
DrawNode::DrawMode::Line, 10);
// float thick = 0.0f;
// float y = -90.0f;
// drawNode->properties.setPosition(Vec2(270, 100));
// for (int i = 0; i < 32; i++)
//{
// thick += 0.5f;
// y += thick + 1;
// drawNode->drawLine(Vec2(140, y), Vec2(180, y), Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f),
// thick);
// }
// drawNode->drawPie(Vec2(-220, 150), 20, 0, 100, 300, 1, 1, Color4B::TRANSPARENT, Color4B::BLUE,
// DrawNode::DrawMode::Line, 10);
drawNode->properties.setPosition(Vec2(50, -100));
for (int i = 2; i < 30; i++)
{
drawNode->drawCircle(center, 5 * i, AX_DEGREES_TO_RADIANS(90), i, false, 1.0f, 1.0f,
Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f), 0.5f);
}
// drawNode->properties.setPosition(Vec2(50, -100));
// for (int i = 2; i < 30; i++)
//{
// drawNode->drawCircle(center, 5 * i, AX_DEGREES_TO_RADIANS(90), i, false, 1.0f, 1.0f,
// Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f), 0.5f);
// }
Vec2* fbHorse = new Vec2[856 / 2];
int n = 0;
Vec2 pos = {100, 210};
float scale = 3.0f;
drawNode->properties.setPosition(Vec2(-90, -160));
for (size_t i = 0; i < sizeof(verticesFB) / sizeof(verticesFB[0]); i += 4)
{
drawNode->drawLine(Vec2(verticesFB[i] * scale, verticesFB[i + 1] * scale) + pos,
Vec2(verticesFB[i + 2] * scale, verticesFB[i + 3] * scale) + pos, Color4F::RED, 0.5f);
}
scheduleUpdate();
// Vec2* fbHorse = new Vec2[856 / 2];
// int n = 0;
// Vec2 pos = {100, 210};
// float scale = 3.0f;
// drawNode->properties.setPosition(Vec2(-90, -160));
// for (size_t i = 0; i < sizeof(verticesFB) / sizeof(verticesFB[0]); i += 4)
//{
// drawNode->drawLine(Vec2(verticesFB[i] * scale, verticesFB[i + 1] * scale) + pos,
// Vec2(verticesFB[i + 2] * scale, verticesFB[i + 3] * scale) + pos, Color4F::RED, 0.5f);
// }
drawNode->properties.setPosition(VisibleRect::center() - Vec2(100, 50));
drawNode->drawSolidCircle(Vec2::ZERO, 40, AX_DEGREES_TO_RADIANS(-90), 30, 1.0f, 1.0f, Color4F::GREEN, 6,
Color4F::BLUE, false);
drawNode->drawSolidCircle(Vec2(100, 0), 40, AX_DEGREES_TO_RADIANS(-90), 30, 1.0f, 1.0f, Color4F::RED, 6,
Color4F::BLUE, true);
drawNode->drawCircle(Vec2(100, 100), 40, AX_DEGREES_TO_RADIANS(-90), 30, true, 1.0f, 1.0f, Color4F::GREEN, 6);
drawNode->drawCircle(Vec2(0, 100), 40, AX_DEGREES_TO_RADIANS(-90), 30, false, 1.0f, 1.0f, Color4F::RED, 6);
// scheduleUpdate();
}
void DrawNodeIssueTester::onEnter()

View File

@ -60,6 +60,7 @@ protected:
Points,
Triangle,
Segment,
SolidTriangle,
SolidCircle,
SolidPoly,
SolidRect,
@ -82,6 +83,7 @@ protected:
"drawPoints",
"drawTriangle",
"drawSegment",
"drawSolidTriangle",
"drawSolidCircle",
"drawSolidPoly",
"drawSolidRect",