iphone - Draw line or rectangle on cocos2d Layer -


Can you please tell me how to draw line or rectangle on a visual layer using Cocos 2D IOS 4 iPhone What is the best way

So far texture2d has tried, but it is more like a paint brush and it is not so good, trying to draw a line using the draw method, but on the second line pulling a second line Disappeared

Actually want to draw several horizontal, vertical, slant beams. Please suggest. Any code will help a lot.

The code for using texture is given below:

  CGPIT start = edge Start; CGPoint end = edge // Start the render texture [start the goal]; // For additional points, we will draw it easily from the final position and there is a difference in // scale / rotation / offset float distance = CCP distance (start, end) of Sprite; If (distance> 1) {int d = (int) distance; For (int i = 0; i & lt; d; i ++) {float diffax = end.x - start.x; Float dify = end.y - start.y; Boat Delta = (Float) I / Distance; [Brush Setposition: CCP (start.x + (Diffax * Delta), initial + (deli * delta)); [Brush Setscask: 0.3]; // Call to pull the brush, do not call. [Brush travel]; }} // Finnish drawing and refund reference [back end of goal];   

The rendering is not good esp as it affects the scaling quality with skew lines.

Cheers

You can create a different layer and thus draw method Call:

  - Draw {Zero} {CGSize s = [[Directive Share Director] winSize]; Dracrack (CCP (SW / 2, SHT / 2), circle size, 0, 50, not);   

This is for a cycle, but the principle is the same. It's from a project that I did some time ago and it worked then. If anything has changed since, then do not know.

Comments