Example code:
void MyLayer::draw()
{
CCPoint p1 = ccp(x1,y1); CCPoint p2 = ccp(x2,y2);
ccColor4F color;
color.a = 1.0;
color.r = 0;
color.g = 0;
color.b = 0;
ccDrawSolidRect(p1,p2, color);
ccDrawColor4B(255, 255, 255, 255);
ccDrawRect(p1,p2);
}
|
p1 being the bottom left corner of the rectangle and p2 being the top right.
In order for this to be called, the function needs to be override the "draw" function of the parent.
No comments:
Post a Comment