47 #ifndef __CU_BUTTON_H__
48 #define __CU_BUTTON_H__
49 #include <cugl/assets/CUJsonValue.h>
50 #include <cugl/2d/CUNode.h>
51 #include <cugl/2d/CUPolygonNode.h>
52 #include <cugl/math/CUColor4.h>
53 #include <unordered_map>
103 typedef std::function<void(const std::string& name, bool down)>
Listener;
124 std::string _downchild;
139 #pragma mark Constructors
165 virtual void dispose()
override;
176 CUAssertLog(
false,
"This node does not support the empty initializer");
190 bool init(
const std::shared_ptr<Node>& up) {
205 bool init(
const std::shared_ptr<Node>& up,
Color4 down);
219 bool init(
const std::shared_ptr<Node>& up,
const std::shared_ptr<Node>& down);
243 #pragma mark Static Constructors
254 static std::shared_ptr<Button>
alloc(
const std::shared_ptr<Node>& up) {
255 std::shared_ptr<Button> node = std::make_shared<Button>();
256 return (node->init(up) ? node :
nullptr);
270 static std::shared_ptr<Button>
alloc(
const std::shared_ptr<Node>& up,
Color4 down) {
271 std::shared_ptr<Button> node = std::make_shared<Button>();
272 return (node->init(up,down) ? node :
nullptr);
287 static std::shared_ptr<Button>
alloc(
const std::shared_ptr<Node>& up,
const std::shared_ptr<Node>& down) {
288 std::shared_ptr<Button> node = std::make_shared<Button>();
289 return (node->init(up,down) ? node :
nullptr);
313 const std::shared_ptr<JsonValue>& data) {
314 std::shared_ptr<Button> result = std::make_shared<Button>();
315 if (!result->initWithData(loader,data)) { result =
nullptr; }
316 return std::dynamic_pointer_cast<
Node>(result);
319 #pragma mark Button Attributes
365 void setPushable(
const std::vector<Vec2>& vertices);
376 #pragma mark Button State
458 #pragma mark Listeners
Definition: CUPoly2.h:115
static const Color4 GRAY
Definition: CUColor4.h:1124
Definition: CUSceneLoader.h:77
Definition: CUColor4.h:1084
Definition: CUAction.h:51