44 #ifndef __CU_WIRE_NODE_H__
45 #define __CU_WIRE_NODE_H__
48 #include "../math/CUPoly2.h"
49 #include "CUTexturedNode.h"
50 #include "../math/polygon/CUPathOutliner.h"
53 #define WIRE_SEGMENTS 8
118 #pragma mark Constructors
183 #pragma mark Static Constructors
191 static std::shared_ptr<WireNode>
alloc() {
192 std::shared_ptr<WireNode> node = std::make_shared<WireNode>();
193 return (node->init() ? node :
nullptr);
209 std::shared_ptr<WireNode> node = std::make_shared<WireNode>();
210 return (node->init(vertices) ? node :
nullptr);
227 std::shared_ptr<WireNode> node = std::make_shared<WireNode>();
228 return (node->initWithVertices(vertices,traversal) ? node :
nullptr);
243 std::shared_ptr<WireNode> node = std::make_shared<WireNode>();
244 return (node->init(poly) ? node :
nullptr);
257 std::shared_ptr<WireNode> node = std::make_shared<WireNode>();
258 return (node->init(rect) ? node :
nullptr);
270 std::shared_ptr<WireNode> node = std::make_shared<WireNode>();
271 return (node->initWithLine(origin,dest) ? node :
nullptr);
286 unsigned int segments = WIRE_SEGMENTS) {
287 std::shared_ptr<WireNode> node = std::make_shared<WireNode>();
288 return (node->initWithEllipse(center,size,segments) ? node :
nullptr);
292 #pragma mark Attributes
324 virtual void setPolygon(
const std::vector<Vec2>& vertices)
override;
378 void setEllipse(
const Vec2& center,
const Size& size,
unsigned int segments = WIRE_SEGMENTS);
381 #pragma mark Rendering
405 virtual void draw(
const std::shared_ptr<SpriteBatch>& batch,
const Mat4& transform,
Color4 tint)
override;
410 CU_DISALLOW_COPY_AND_ASSIGN(
WireNode);
Definition: CUWireNode.h:107
static std::shared_ptr< WireNode > allocWithRect(const Rect &rect)
Definition: CUWireNode.h:256
bool initWithEllipse(const Vec2 ¢er, const Size &size, unsigned int segments=WIRE_SEGMENTS)
Definition: CUTexturedNode.h:83
void setLine(const Vec2 &origin, const Vec2 &dest)
virtual void draw(const std::shared_ptr< SpriteBatch > &batch, const Mat4 &transform, Color4 tint) override
Definition: CUPoly2.h:115
std::string _classname
Definition: CUTexturedNode.h:87
static std::shared_ptr< WireNode > allocWithVertices(const std::vector< Vec2 > &vertices, PathTraversal traversal)
Definition: CUWireNode.h:225
~WireNode()
Definition: CUWireNode.h:139
PathTraversal getTraversal() const
Definition: CUWireNode.h:312
void setTraversal(PathTraversal traversal)
static PathOutliner _outliner
Definition: CUWireNode.h:111
void setEllipse(const Vec2 ¢er, const Size &size, unsigned int segments=WIRE_SEGMENTS)
static std::shared_ptr< WireNode > allocWithEllipse(const Vec2 ¢er, const Size &size, unsigned int segments=WIRE_SEGMENTS)
Definition: CUWireNode.h:285
PathTraversal _traversal
Definition: CUWireNode.h:114
static std::shared_ptr< WireNode > allocWithLine(const Vec2 &origin, const Vec2 &dest)
Definition: CUWireNode.h:269
WireNode()
Definition: CUWireNode.h:127
static std::shared_ptr< WireNode > alloc()
Definition: CUWireNode.h:191
bool initWithLine(const Vec2 &origin, const Vec2 &dest)
std::string _name
Definition: CUNode.h:187
virtual void setPolygon(const std::vector< Vec2 > &vertices) override
Definition: CUColor4.h:1104
PathTraversal
Definition: CUPathOutliner.h:49
Definition: CUPathOutliner.h:78
static std::shared_ptr< WireNode > allocWithPoly(const Poly2 &poly)
Definition: CUWireNode.h:242
Definition: CUAnimationNode.h:52
static std::shared_ptr< WireNode > allocWithVertices(const std::vector< Vec2 > &vertices)
Definition: CUWireNode.h:208
bool initWithVertices(const std::vector< Vec2 > &vertices, PathTraversal traversal)