Common Cocos2d-x plotting Functions

Source: Internet
Author: User
1. Commonly used graphic functions are as follows. 1ccDrawColor4B (GLubyter, GLubyteg, GLubyteb, GLubytea): sets the painting color. Parameter 1: Red weight. Parameter 2: green component. Parameter 3: blue component. Parameter 4: transparency. 2 glLineWidth (GLfloatwidth): Set the line width. Parameter: width

1. Commonly used graphic functions are as follows. 1 ccDrawColor4B (GLubyte r, GLubyte g, GLubyte B, GLubyte a) function: Set the painting color. Parameter 1: Red weight. Parameter 2: green component. Parameter 3: blue component. Parameter 4: transparency. 2 glLineWidth (GLfloat width): Set the line width. Parameter: width

1. Commonly used graphic functions are as follows.

<1> ccDrawColor4B (GLubyte r, GLubyte g, GLubyte B, GLubyte)

Purpose:Set the painting color.

Parameter 1:Red weight.

Parameter 2:Green component.

Parameter 3:Blue component.

Parameter 4:Transparency.

<2> glLineWidth (GLfloat width)

Purpose:Set the line width.

Parameters:Width value.

<3> ccDrawLine (const CCPoint & origin, const CCPoint & destination)

Purpose:Draw a straight line.

Parameter 1:Start coordinate.

Parameter 2:End coordinate.

<4> ccPointSize (GLfloat pointSize)

Purpose:Set the size of each vertex.

Parameters:Point size.

<5> ccDrawPoint (const CCPoint & point)

Purpose:Draw a vertex.

Parameters:Coordinates of the vertex.

<6> ccDrawCircle (const CCPoint & center, float radius, float angle, unsigned int segments, bool drawLineToCenter)

Purpose:Draw a circle.

Parameter 1: Center Coordinate.

Parameter 2:Radius length.

Parameter 3:The angle of the circle.

Parameter 4:Angle.

Parameter 5:Number of points.

<7> ccDrawPoly (const CCPoint * poli, unsigned int numberOfPoints, bool closePolygon)

Purpose:Draw a hollow polygon.

Parameter 1:Vertex array.

Parameter 2:Point quantity.

Parameter 3:Whether to automatically close the polygon.

<8> ccDrawSolidRect (CCPoint origin, CCPoint destination, ccColor4F color)

Purpose:Draw a filled rectangle.

Parameter 1:Vertex array.

Parameter 2:Point quantity.

Parameter 3:The color of the rectangle.

<9> ccDrawRect (CCPoint origin, CCPoint destination)

Purpose:Draw a hollow rectangle.

Parameter 1:Vertex array.

Parameter 2:Point quantity.

<10> ccdrawquadbezr (const CCPoint & origin, const CCPoint & control, const CCPoint & destination, unsigned int segments)

Purpose:Draw the besell curve.

Parameter 1:Start Point.

Parameter 2:Control Point.

Parameter 3:End Point.

Parameter 4:Number of vertices.

<11> ccdrawcubes (conts CCPoint & origin, const CCPoint & control1, const CCPoint & control2, const CCPoint & destination, unsigned int segments)

Purpose:Draw a three-dimensional besell curve.

Parameter 1:Start Point.

Parameter 2:Control Point 1.

Parameter 3:Control Point 2.

Parameter 4:End Point.

Parameter 5:Number of vertices.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.