mirror of https://github.com/axmolengine/axmol.git
Update DrawPrimitivesTest.cpp
fix #137 and try to "explain" the behavior of setLineWidth() om DrawNode object
This commit is contained in:
parent
9a82fb08c0
commit
4fb2e1aa65
|
@ -218,26 +218,40 @@ string DrawNodeTest::subtitle() const
|
||||||
//
|
//
|
||||||
Issue11942Test::Issue11942Test()
|
Issue11942Test::Issue11942Test()
|
||||||
{
|
{
|
||||||
auto draw = DrawNode::create();
|
// DrawNode 0 ------------------------------------------
|
||||||
addChild(draw, 10);
|
auto draw0 = DrawNode::create();
|
||||||
|
addChild(draw0, 10);
|
||||||
|
|
||||||
// draw a circle
|
// draw a circle thickness 10
|
||||||
draw->setLineWidth(1);
|
draw0->setLineWidth(10);
|
||||||
draw->drawCircle(VisibleRect::center() - Vec2(140.0f, 0.0f), 50, AX_DEGREES_TO_RADIANS(90), 30, false,
|
draw0->drawCircle(VisibleRect::center() - Vec2(140.0f, 40.0f), 50, AX_DEGREES_TO_RADIANS(90), 30, false,
|
||||||
Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1));
|
Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1));
|
||||||
draw->setLineWidth(10);
|
draw0->setLineWidth(1); // thickness 10 will replaced with thickness 1 (also for all 'same' draw commands before!)
|
||||||
draw->drawCircle(VisibleRect::center() + Vec2(140.0f, 0.0f), 50, AX_DEGREES_TO_RADIANS(90), 30, false,
|
draw0->drawCircle(VisibleRect::center() - Vec2(140.0f, -40.0f), 50, AX_DEGREES_TO_RADIANS(90), 30, false,
|
||||||
|
Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1));
|
||||||
|
|
||||||
|
|
||||||
|
// DrawNode 1 ------------------------------------------
|
||||||
|
auto draw1 = DrawNode::create();
|
||||||
|
addChild(draw1, 10);
|
||||||
|
|
||||||
|
// draw a second circle thickness 1
|
||||||
|
draw1->setLineWidth(1);
|
||||||
|
draw1->drawCircle(VisibleRect::center() + Vec2(140.0f, 40.0f), 50, AX_DEGREES_TO_RADIANS(90), 30, false,
|
||||||
Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1));
|
Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1));
|
||||||
|
draw1->setLineWidth(10); // thickness 1 will replaced with thickness 10 (also for all 'same' draw commands before!)
|
||||||
|
draw1->drawCircle(VisibleRect::center() + Vec2(140.0f, -40.0f), 50, AX_DEGREES_TO_RADIANS(90), 30, false,
|
||||||
|
Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
string Issue11942Test::title() const
|
string Issue11942Test::title() const
|
||||||
{
|
{
|
||||||
return "GitHub Issue #11942";
|
return "GitHub Issue #11942 (axmol #137)";
|
||||||
}
|
}
|
||||||
|
|
||||||
string Issue11942Test::subtitle() const
|
string Issue11942Test::subtitle() const
|
||||||
{
|
{
|
||||||
return "drawCircle() with width";
|
return "setLineWidth() change the WHOLE DrawNode object 'line with'";
|
||||||
}
|
}
|
||||||
|
|
||||||
Issue829Test::Issue829Test()
|
Issue829Test::Issue829Test()
|
||||||
|
|
Loading…
Reference in New Issue