2022-08-01 11:18:03 -04:00
|
|
|
#pragma once
|
|
|
|
|
2022-10-13 05:56:23 -04:00
|
|
|
#include <cocos2d.h>
|
|
|
|
|
|
|
|
namespace cocos2d::extension {
|
|
|
|
class CCScale9Sprite;
|
|
|
|
}
|
2022-08-01 11:18:03 -04:00
|
|
|
|
|
|
|
namespace geode {
|
2022-10-30 14:59:20 -04:00
|
|
|
class GEODE_DLL IconButtonSprite : public cocos2d::CCSprite, public cocos2d::CCLabelProtocol {
|
2022-08-01 11:18:03 -04:00
|
|
|
protected:
|
|
|
|
cocos2d::extension::CCScale9Sprite* m_bg = nullptr;
|
|
|
|
cocos2d::CCLabelBMFont* m_label = nullptr;
|
|
|
|
cocos2d::CCNode* m_icon = nullptr;
|
|
|
|
|
|
|
|
bool init(
|
2022-10-30 14:59:20 -04:00
|
|
|
char const* bg, bool bgIsFrame, cocos2d::CCNode* icon, char const* text,
|
|
|
|
char const* font
|
2022-08-01 11:18:03 -04:00
|
|
|
);
|
|
|
|
|
|
|
|
void updateLayout();
|
|
|
|
|
|
|
|
IconButtonSprite() = default;
|
|
|
|
IconButtonSprite(IconButtonSprite&&) = delete;
|
|
|
|
IconButtonSprite& operator=(IconButtonSprite&&) = delete;
|
2022-10-30 14:59:20 -04:00
|
|
|
|
2022-08-01 11:18:03 -04:00
|
|
|
public:
|
|
|
|
static IconButtonSprite* create(
|
2022-10-30 14:59:20 -04:00
|
|
|
char const* bg, cocos2d::CCNode* icon, char const* text, char const* font
|
2022-08-01 11:18:03 -04:00
|
|
|
);
|
|
|
|
static IconButtonSprite* createWithSpriteFrameName(
|
2022-10-30 14:59:20 -04:00
|
|
|
char const* bg, cocos2d::CCNode* icon, char const* text, char const* font
|
2022-08-01 11:18:03 -04:00
|
|
|
);
|
|
|
|
|
2022-10-30 14:59:20 -04:00
|
|
|
void setBG(char const* bg, bool isFrame);
|
2022-08-01 11:18:03 -04:00
|
|
|
|
|
|
|
void setIcon(cocos2d::CCNode* icon);
|
|
|
|
cocos2d::CCNode* getIcon() const;
|
|
|
|
|
2022-10-30 14:59:20 -04:00
|
|
|
void setString(char const* label) override;
|
|
|
|
char const* getString() override;
|
2024-03-24 15:31:42 -04:00
|
|
|
|
|
|
|
void setColor(cocos2d::ccColor3B const& color) override;
|
|
|
|
void setOpacity(GLubyte opacity) override;
|
2022-08-01 11:18:03 -04:00
|
|
|
};
|
|
|
|
}
|