#pragma once #include #include namespace geode { class GEODE_DLL Border : public cocos2d::CCLayerColor { public: struct Padding { float top; float right; float bottom; float left; }; static Border* create(cocos2d::CCNode* node, const cocos2d::ccColor4B& backgroundColor); static Border* create(cocos2d::CCNode* node, const cocos2d::ccColor4B& backgroundColor, const cocos2d::CCSize& size); static Border* create(cocos2d::CCNode* node, const cocos2d::ccColor4B& backgroundColor, const cocos2d::CCSize& size, const cocos2d::CCPoint& padding); void setPadding(const cocos2d::CCPoint& padding); void setPadding(float x, float y); void setPadding(float padding); Padding getPadding(); void setPaddingX(float x); float getPaddingX(); void setPaddingY(float y); float getPaddingY(); void setPaddingTop(float top); float getPaddingTop(); void setPaddingRight(float right); float getPaddingRight(); void setPaddingBottom(float bottom); float getPaddingBottom(); void setPaddingLeft(float left); float getPaddingLeft(); void setBackgroundColor(const cocos2d::ccColor4B& color); cocos2d::ccColor4B getBackgroundColor(); void setNode(CCNode* node); CCNode* getNode(); void setSize(const cocos2d::CCSize& size); void setZOrder(int zOrder) override; void resetZOrder(); protected: Padding m_padding; bool m_customZOrder; Border(const cocos2d::CCPoint& padding = { 0, 0 }); bool init(const cocos2d::ccColor4B& backgroundColor, const cocos2d::CCSize& size); bool init(CCNode* node, const cocos2d::ccColor4B& backgroundColor, const cocos2d::CCSize& size); private: void updatePadding(); }; }