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

Method drawAllv2

tests/cpp-tests/Source/DrawNodeTest/DrawNodeTest.cpp:3355–3508  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3353}
3354
3355void DrawNodeAxmolTest2::drawAllv2(DrawNode* drawNode, bool drawOrder)
3356{
3357 drawNode->properties.setDrawOrder(drawOrder);
3358
3359 drawNode->drawPoint(Vec2(size.width / 2 - 120, size.height / 2 - 120), 10,
3360 Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1));
3361
3362 drawNode->drawPoint(Vec2(size.width / 2 + 120, size.height / 2 + 120), 10,
3363 Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1));
3364
3365 // drawNode 4 small points
3366 Vec2 position[] = {Vec2(60, 60), Vec2(70, 70), Vec2(60, 70), Vec2(70, 60)};
3367 drawNode->drawPoints(position, 4, 5, Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1));
3368
3369 // drawNode a line
3370 drawNode->drawLine(Vec2(0, 0), Vec2(size.width, size.height), Color4F(1.0, 0.0, 0.0, 0.5));
3371
3372 // drawNode a rectangle
3373 drawNode->drawRect(Vec2(23, 23), Vec2(7, 7), Color4F::RED);
3374
3375 drawNode->drawRect(Vec2(15, 30), Vec2(30, 15), Vec2(15, 0), Vec2(0, 15),
3376 Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1));
3377
3378 // drawNode a circle
3379 drawNode->drawCircle(VisibleRect::center() + Vec2(140, 0), 100, AX_DEGREES_TO_RADIANS(90), 30, true, 1.0f, 2.0f,
3380 Color4F(1.0f, 0.0f, 0.0f, 0.5f));
3381
3382 drawNode->drawCircle(VisibleRect::center() - Vec2(140, 0), 50, AX_DEGREES_TO_RADIANS(90), 30, false,
3383 Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f));
3384
3385 // drawNode some beziers
3386 drawNode->drawQuadBezier(Vec2(size.width - 150, size.height - 150), Vec2(size.width - 70, size.height - 10),
3387 Vec2(size.width - 10, size.height - 10), 10,
3388 Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 0.5f));
3389
3390 drawNode->drawQuadBezier(Vec2(0.0f, size.height), Vec2(size.width / 2, size.height / 2),
3391 Vec2(size.width, size.height), 50,
3392 Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 0.5f));
3393
3394 drawNode->drawCubicBezier(VisibleRect::center(), Vec2(VisibleRect::center().x + 30, VisibleRect::center().y + 50),
3395 Vec2(VisibleRect::center().x + 60, VisibleRect::center().y - 50), VisibleRect::right(),
3396 100, Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 0.5f));
3397
3398 drawNode->drawCubicBezier(Vec2(size.width - 250, 40.0f), Vec2(size.width - 70, 100.0f),
3399 Vec2(size.width - 30, 250.0f), Vec2(size.width - 10, size.height - 50), 10,
3400 Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 0.5f));
3401
3402 auto array = PointArray::create(20);
3403 array->addControlPoint(Vec2(0.0f, 0.0f));
3404 array->addControlPoint(Vec2(80.0f, 80.0f));
3405 array->addControlPoint(Vec2(size.width - 80, 80.0f));
3406 array->addControlPoint(Vec2(size.width - 80, size.height - 80));
3407 array->addControlPoint(Vec2(80.0f, size.height - 80));
3408 array->addControlPoint(Vec2(80.0f, 80.0f));
3409 array->addControlPoint(Vec2(size.width / 2, size.height / 2));
3410 drawNode->drawCardinalSpline(array, 0.5f, 50, Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 0.5f));
3411
3412 auto array2 = PointArray::create(20);

Callers

nothing calls this directly

Calls 15

createFunction · 0.85
setDrawOrderMethod · 0.80
drawPointMethod · 0.80
drawPointsMethod · 0.80
drawCircleMethod · 0.80
drawQuadBezierMethod · 0.80
drawCubicBezierMethod · 0.80
drawCardinalSplineMethod · 0.80
drawCatmullRomMethod · 0.80
drawPolyMethod · 0.80
drawDotMethod · 0.80
drawSolidPolyMethod · 0.80

Tested by

no test coverage detected