Cocos2d / CCDrawNode - How to draw a line?
I see there is functionality for drawing circles, polyhedrons, points and segments. I don't see any for drawing AB line (with a given thickness) like ccDrawLine () (which seems to be deprecated).
I need to draw a "network" between connected nodes. I have some code to draw a network, however ccDrawLine does not support aliases and opacity like CCDrawNode does. In addition, batch processing is not supported without manual intervention.
Do you have suggestions? Do I need to do the math to draw a bipolar rectangular line at right angles between points?
UPDATE: Based on the comments below ... I have an idea how to make a "line" from 0.0 to 10.0 with a thickness of 2, I would have to make a rectangular nick at {0,0.5}, {10,0.5}, {10, -0.5}, {0, -0.5} ... I can calculate the points of a triangular in a clockwise direction to easily make a polyangular out of it. So I could even do horizontal ones easily. But how do you do it between {4.5}, {10.7}? Would you make a normal rectangular shape and apply a transformation matrix to it? Or would you still count every 4 points and then make 2 triangular out of it?
UPDATE: Maybe it would be better to use a scaled "linear" sprite ?! For example: Stackoverflow
UPDATE: How about a tape? Will this work? For example: StackOverflow question.
Not sure if tape will work for a "network" of points, though ...
EXPLANATION:
Imagine this image, but with straight lines and no intersections ... Something like this:
(source: relenet.com )
UPDATE: It looks like my forum post was posted last night, right before it crashed ... http://www.cocos2d-iphone.org/forum/topic/224498
source to share
A line is a line segment. You can take it from here ...;)
Update:
CCDrawNode can draw segments . Segments are lines with specific start and end points.
source to share