Forum Libraries, Components, and Plugins
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

CCDrawNode.DrawLineList cannot set thickness?

If you want to draw a bunch of lines in one go, colored - maybe blending the colors along the way - you have the DrawLineList method in CocosSharp at your disposal. Like this:
CCV3F_C4B[] verts = new CCV3F_C4B[]
{

// First line:
    new CCV3F_C4B( new CCPoint(0,0), CCColor4B.White),
    new CCV3F_C4B( new CCPoint(30,60), CCColor4B.White),
    // second line, will blend from white to red:
    new CCV3F_C4B( new CCPoint(60,0), CCColor4B.White),
    new CCV3F_C4B( new CCPoint(120,120), CCColor4B.Red)
};`

myDrawNode.DrawLineList(verts);`

However, you cannot set the line thickness for it - it only draws lines with the default 1 pixel thickness. Is there a nice and elegant way to achieve line thickness or do I really have to implement it myself?

Best Answer

  • MatExMatEx NLMember ✭✭
    Accepted Answer

    OK guys, I figured it out. It's actually pretty simple: you just have to make triangles from the line segments, and then you can use the CCDrawNode.DrawTriangleList which can do the color blending thing too.

Answers

  • MatExMatEx NLMember ✭✭
    Accepted Answer

    OK guys, I figured it out. It's actually pretty simple: you just have to make triangles from the line segments, and then you can use the CCDrawNode.DrawTriangleList which can do the color blending thing too.

Sign In or Register to comment.