mirror of
https://github.com/geode-sdk/geode.git
synced 2024-11-30 03:15:38 -05:00
e9304c60ac
* Added dynamic borders * Removed an ambiguous size
54 lines
No EOL
1.9 KiB
C++
54 lines
No EOL
1.9 KiB
C++
#pragma once
|
|
|
|
#include <Geode/DefaultInclude.hpp>
|
|
#include <cocos2d.h>
|
|
|
|
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:
|
|
cocos2d::CCSize m_size;
|
|
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();
|
|
};
|
|
} |