Cornell Cocos
Cornell Extensions to Cocos2d
CUWireNode.h
1 //
2 // CUWireNode.h
3 // Cornell Extensions to Cocos2D
4 //
5 // This module provides a scene graph node for wireframes. Wireframes are lines, not
6 // solid shapes. They have no thickness. They are primarily useful for debugging.
7 //
8 // This class infinitely better than the horrible DrawNode, which is outside the Cocos2d
9 // render pipeline, and hence incredibly slow. You should avoid that class whenever
10 // possible.
11 //
12 // Author: Walker White
13 // Version: 11/15/15
14 //
15 #ifndef __CU_WIRENODE_H__
16 #define __CU_WIRENODE_H__
17 
18 
19 #include <string>
20 #include "CUPoly2.h"
21 #include "CUTexturedNode.h"
22 
23 NS_CC_BEGIN
24 
25 #pragma mark -
26 #pragma mark WireNode
27 
75 class CC_DLL WireNode : public TexturedNode {
76 
77 #pragma mark Internal Helpers
78 private:
80  CC_DISALLOW_COPY_AND_ASSIGN(WireNode);
81 
82 protected:
89  void generateRenderData() override;
90 
91 
92 public:
93 #pragma mark Static Constructors
94 
101  static WireNode* create();
102 
115  static WireNode* createWithVertices(float* vertices, int size, int offset=0);
116 
128  static WireNode* createWithPoly(const Poly2& poly);
129 
139  static WireNode* createWithRect(const Rect& rect);
140 
149  static WireNode* createWithLine(const Vec2 &origin, const Vec2 &dest);
150 
162  static WireNode* createWithEllipse(const Vec2& center, const Size& size, unsigned int segments);
163 
164 
165 
166 #pragma mark Attribute Accessors
167 
175  virtual std::string getDescription() const override;
176 
177 
178 #pragma mark Rendering Methods
179 
192  virtual void draw(Renderer *renderer, const Mat4 &transform, uint32_t flags) override;
193 
194 
195 CC_CONSTRUCTOR_ACCESS:
196 #pragma mark Hidden Constructors
197 
202  WireNode();
203 
210  virtual ~WireNode(void) { }
211 };
212 
213 NS_CC_END
214 
215 #endif /* defined(__CU_WIRENODE_H__) */
Definition: CUTexturedNode.h:71
virtual void generateRenderData()
Definition: CUTexturedNode.h:146
virtual ~WireNode(void)
Definition: CUWireNode.h:210
Definition: CUWireNode.h:75
Definition: CUPoly2.h:53