 |
CUGL 1.3
Cornell University Game Library
|
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;
141 #pragma mark Constructors
167 virtual void dispose()
override;
178 CUAssertLog(
false,
"This node does not support the empty initializer");
192 bool init(
const std::shared_ptr<Node>& up) {
207 bool init(
const std::shared_ptr<Node>& up,
Color4 down);
221 bool init(
const std::shared_ptr<Node>& up,
const std::shared_ptr<Node>& down);
245 #pragma mark Static Constructors
256 static std::shared_ptr<Button>
alloc(
const std::shared_ptr<Node>& up) {
257 std::shared_ptr<Button> node = std::make_shared<Button>();
258 return (node->init(up) ? node :
nullptr);
272 static std::shared_ptr<Button>
alloc(
const std::shared_ptr<Node>& up,
Color4 down) {
273 std::shared_ptr<Button> node = std::make_shared<Button>();
274 return (node->init(up,down) ? node :
nullptr);
289 static std::shared_ptr<Button>
alloc(
const std::shared_ptr<Node>& up,
const std::shared_ptr<Node>& down) {
290 std::shared_ptr<Button> node = std::make_shared<Button>();
291 return (node->init(up,down) ? node :
nullptr);
315 const std::shared_ptr<JsonValue>& data) {
316 std::shared_ptr<Button> result = std::make_shared<Button>();
317 if (!result->initWithData(loader,data)) { result =
nullptr; }
318 return std::dynamic_pointer_cast<Node>(result);
321 #pragma mark Button Attributes
367 void setPushable(
const std::vector<Vec2>& vertices);
378 #pragma mark Button State
460 #pragma mark Listeners
Definition: CUColor4.h:1084
static const Color4 GRAY
Definition: CUColor4.h:1124
Definition: CUSceneLoader.h:77
Definition: CUPoly2.h:109