mirror of https://github.com/axmolengine/axmol.git
make rotated rect draw correctly
This commit is contained in:
parent
ac7ddad4ac
commit
f41f00fcb2
|
@ -663,9 +663,12 @@ void DrawNode::drawDot(const Vec2 &pos, float radius, const Color4F &color)
|
|||
_dirty = true;
|
||||
}
|
||||
|
||||
void DrawNode::drawRect(const Vec2 &lb, const Vec2 <, const Vec2 &rt, const Vec2& rb, const Color4F &color)
|
||||
void DrawNode::drawRect(const Vec2 &p1, const Vec2 &p2, const Vec2 &p3, const Vec2& p4, const Color4F &color)
|
||||
{
|
||||
drawRect(lb, rt, color);
|
||||
drawLine(Vec2(p1.x, p1.y), Vec2(p2.x, p2.y), color);
|
||||
drawLine(Vec2(p2.x, p2.y), Vec2(p3.x, p3.y), color);
|
||||
drawLine(Vec2(p3.x, p3.y), Vec2(p4.x, p4.y), color);
|
||||
drawLine(Vec2(p4.x, p4.y), Vec2(p1.x, p1.y), color);
|
||||
}
|
||||
|
||||
void DrawNode::drawSegment(const Vec2 &from, const Vec2 &to, float radius, const Color4F &color)
|
||||
|
|
|
@ -80,7 +80,7 @@ public:
|
|||
/** draw a dot at a position, with a given radius and color */
|
||||
void drawDot(const Vec2 &pos, float radius, const Color4F &color);
|
||||
|
||||
void drawRect(const Vec2 &lb, const Vec2 <, const Vec2 &rt, const Vec2& rb, const Color4F &color);
|
||||
void drawRect(const Vec2 &p1, const Vec2 &p2, const Vec2 &p3, const Vec2& p4, const Color4F &color);
|
||||
|
||||
void drawSolidRect(const Vec2 &origin, const Vec2 &destination, const Color4F &color);
|
||||
|
||||
|
|
|
@ -278,6 +278,8 @@ DrawNodeTest::DrawNodeTest()
|
|||
// draw a rectangle
|
||||
draw->drawRect(Vec2(23,23), Vec2(7,7), Color4F(1,1,0,1));
|
||||
|
||||
draw->drawRect(Vec2(15,30), Vec2(30,15), Vec2(15,0), Vec2(0,15), Color4F(CCRANDOM_0_1(), CCRANDOM_0_1(), CCRANDOM_0_1(), 1));
|
||||
|
||||
// draw a circle
|
||||
draw->drawCircle(VisibleRect::center() + Vec2(140,0), 100, CC_DEGREES_TO_RADIANS(90), 50, true, 1.0f, 2.0f, Color4F(1.0, 0.0, 0.0, 0.5));
|
||||
|
||||
|
|
Loading…
Reference in New Issue