Cocos2d-x之绘制填充圆形

Cocos2d-x之绘制填充圆形

自定义的方法

SCircle.h

 1 //
 2 //  SCircle.h
 3 //  L01DrawingAPI
 4 //
 5 //  Created by Mac OS 10.9.3 on 15-3-30.
 6 //
 7 //
 8 
 9 #ifndef __L01DrawingAPI__SCircle__
10 #define __L01DrawingAPI__SCircle__
11 
12 #include <iostream>
13 #include <cocos2d.h>
14 
15 USING_NS_CC;
16 
17 namespace bobo {
18     
19     class SCircle:public Node{
20         
21     public:
22         
23         virtual bool init();
24         virtual void draw();
25         CREATE_FUNC(SCircle);
26     };
27 }
28 
29 #endif /* defined(__L01DrawingAPI__SCircle__) */

 

SCircle.cpp

 1 //
 2 //  SCircle.cpp
 3 //  L01DrawingAPI
 4 //
 5 //  Created by Mac OS 10.9.3 on 15-3-30.
 6 //
 7 //
 8 
 9 #include "SCircle.h"
10 
11 
12 namespace bobo {
13     
14     bool SCircle::init(){
15         return true;
16     }
17     
18     void SCircle::draw(){
19         
20         DrawPrimitives::drawSolidCircle(Point(0, 0), 50, M_PI * 2, 50);
21     }
22 }

 

 

bool HelloWorld::init()

 

auto sc = bobo::SCircle::create();

    sc->setPosition(Point(500, 100));

    addChild(sc);

 

posted @ 2015-03-30 08:12  silent-bobo  阅读(585)  评论(0编辑  收藏  举报