MCPcopy Create free account
hub / github.com/axmolengine/axmol / DrawNodePlayground

Method DrawNodePlayground

tests/cpp-tests/Source/DrawNodeTest/DrawNodeTest.cpp:3610–3680  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3608}
3609
3610DrawNodePlayground::DrawNodePlayground()
3611{
3612 static Vec2 vertices[] = {Vec2(0.0f, 0.0f), Vec2(50.0f, 50.0f), Vec2(100.0f, 50.0f), Vec2(100.0f, 100.0f),
3613 Vec2(50.0f, 100.0f)};
3614 int verticesCount = 5;
3615
3616 drawNode->properties.setPosition(Vec2(5, 150));
3617 drawNode->drawPoly(vertices, verticesCount, false, Color4F::GREEN);
3618
3619 auto draw = DrawNode::create();
3620 addChild(draw, 10);
3621 draw->setPosition(70, 150);
3622 draw->drawPoly(vertices, verticesCount, false, Color4F::BLUE);
3623
3624 drawNode->properties.setPosition(Vec2(140, 150));
3625
3626 drawNode->drawPoly(vertices, verticesCount, false, Color4F::RED);
3627
3628 drawNode->properties.setPosition(Vec2(200, 150));
3629
3630 drawNode->drawPoly(vertices, verticesCount, false, Color4F::RED, 3);
3631 drawNode->drawPoly(vertices, verticesCount, false, Color4F::WHITE);
3632
3633 drawNode->properties.setPosition(Vec2(270, 150));
3634
3635 drawNode->drawPoly(vertices, verticesCount, false, Color4F(0.0f, 0.5f, 0.5f, 0.5f), 10);
3636 drawNode->drawPoly(vertices, verticesCount, false, Color4F::BLACK);
3637
3638 float thick = 0.0f;
3639 float y = -90.0f;
3640 drawNode->properties.setPosition(Vec2(270, 100));
3641 for (int i = 0; i < 32; i++)
3642 {
3643 thick += 0.5f;
3644 y += thick + 1;
3645 drawNode->drawLine(Vec2(140, y), Vec2(180, y), Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f),
3646 thick);
3647 }
3648 drawNode->drawPie(Vec2(-220, 150), 20, 0, 100, 300, 1, 1, Color4F::TRANSPARENT, Color4F::BLUE,
3649 DrawNode::DrawMode::Line, 10);
3650
3651 drawNode->properties.setPosition(Vec2(50, -100));
3652 for (int i = 2; i < 30; i++)
3653 {
3654 drawNode->drawCircle(center, 5 * i, AX_DEGREES_TO_RADIANS(90), i, false, 1.0f, 1.0f,
3655 Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f), 0.5f);
3656 }
3657
3658 Vec2* fbHorse = new Vec2[856 / 2];
3659 int n = 0;
3660 Vec2 pos = {100, 210};
3661 float scale = 3.0f;
3662 drawNode->properties.setPosition(Vec2(-90, -160));
3663 for (size_t i = 0; i < sizeof(verticesFB) / sizeof(verticesFB[0]); i += 4)
3664 {
3665 drawNode->drawLine(Vec2(verticesFB[i] * scale, verticesFB[i + 1] * scale) + pos,
3666 Vec2(verticesFB[i + 2] * scale, verticesFB[i + 3] * scale) + pos, Color4F::RED, 0.5f);
3667 }

Callers

nothing calls this directly

Calls 9

createFunction · 0.85
drawPolyMethod · 0.80
drawPieMethod · 0.80
drawCircleMethod · 0.80
drawSolidCircleMethod · 0.80
Vec2Function · 0.50
Color4FFunction · 0.50
setPositionMethod · 0.45
drawLineMethod · 0.45

Tested by

no test coverage detected