Cocos2d-x of the Drawing circle

Source: Internet
Author: User

Customizing the method

Circle.h

1 //2 //Circle.h3 //L01drawingapi4 //5 //Created by Mac OS 10.9.3 on 15-3-30.6 //7 //8 9 #ifndef __l01drawingapi__circle__Ten #define__l01drawingapi__circle__ One  A#include <iostream> -#include <cocos2d.h> -  the using namespacecocos2d; -  - namespaceBobo { -      +     classCircle: Publicnode{ -  +      Public: A          at         Virtual BOOLinit (); -         Virtual voidDraw (); - Create_func (Circle); -          -     }; - } in  - #endif/* Defined (__l01drawingapi__circle__) */

Circle.cpp

1 //2 //Circle.cpp3 //L01drawingapi4 //5 //Created by Mac OS 10.9.3 on 15-3-30.6 //7 //8 9#include"Circle.h"Ten  One namespaceBobo { A      -     BOOLCircle::init () { -         return true; the     } -      -     voidCircle::d Raw () { -          +         //float ScaleX, float ScaleY refers to the scaling of the X, Y axis -         //drawprimitives::d rawcircle (const cocos2d::P oint &center, float radius, +         //float angle, unsigned int segments, A         //bool Drawlinetocenter, float ScaleX, at         //float ScaleY); -          -         //Draw a circle, (center, RADIUS, angle (in radians, now 360 degrees), -         //number of edges, whether to draw a line connected to the center of the circle) -         //the number of sides is just a few sides of the shape -         //drawprimitives::d rawcircle (Point (0, 0), M_PI * 2, 3, true); in         //drawprimitives::d rawcircle (Point (0, 0), M_PI * 2, 5, true); -Drawprimitives::d rawcircle (Point (0,0), -, M_PI *2, -,true); to     } +}

In the bool Helloworld::init ()

Auto C = bobo::circle::create ();

C->setposition (Point (400, 100));

AddChild (c);

Cocos2d-x of the Drawing circle

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.