cocos2d / cocos2d-html5

Cocos2d for Web Browsers. Built using JavaScript.
https://www.cocos.com
3.07k stars 902 forks source link

In many cases we need to draw Rounded Rectangle but currently there a… #3548

Open kamleshsharma opened 6 years ago

kamleshsharma commented 6 years ago

…re no such API available in cc.DrawNode class, So I have written a new method in cc.DrawNode class called as drawRoundRect for drawing rounded rectanglen which accepts arguments such as height , width , background color, border width, border color, radius and type. I am using this method to draw rounded rectangle in my game that is on production for past 2 years and it works well when compile it for andriod as well Simple useage: var myRoundRect = new cc.DrawNode(); myRoundRect.drawRoundRect(300,100,cc.color(255,0,0), 5, cc.color(255,255,255), 50);

image

see image for output reference.

Thanks

Dimon4eg commented 6 years ago

Cool! I think also the same should be added to cocos2d-x repo using C++.