axmol/extensions/fairygui/display/FUILabel.h

57 lines
1.6 KiB
C
Raw Normal View History

2020-08-04 12:31:33 +08:00
#ifndef __FUILABEL_H__
#define __FUILABEL_H__
#include "cocos2d.h"
#include "FairyGUIMacros.h"
#include "TextFormat.h"
NS_FGUI_BEGIN
2022-08-08 18:02:17 +08:00
class FUILabel : public ax::Label
2020-08-04 12:31:33 +08:00
{
public:
FUILabel();
virtual ~FUILabel();
CREATE_FUNC(FUILabel);
std::string_view getText() const { return getString(); }
void setText(std::string_view value);
2020-08-04 12:31:33 +08:00
TextFormat* getTextFormat() const { return _textFormat; }
void applyTextFormat();
2022-08-08 18:02:17 +08:00
void setUnderlineColor(const ax::Color3B& value);
2022-12-11 15:58:55 +08:00
#if defined(AX_VERSION)
bool setBMFontFilePath(std::string_view bmfontFilePath,
const ax::Rect& imageRect = ax::Rect::ZERO,
bool imageRotated = false,
float fontSize = 0) override;
#else
bool setBMFontFilePath(std::string_view bmfontFilePath,
const ax::Vec2& imageOffset = ax::Vec2::ZERO,
float fontSize = 0) override;
#endif
2020-08-04 12:31:33 +08:00
void setGrayed(bool value);
2022-12-11 15:58:55 +08:00
2020-08-04 12:31:33 +08:00
protected:
/*
2022-12-11 15:58:55 +08:00
cocos2d的源码2d/CCLabel.h672updateBMFontScale函数打上virtual修饰符
FontFnt类型的代码使FontFntFontFnt只支持从外部文件中载入配置BMFontConfiguration是定义在cpp里的
2020-08-04 12:31:33 +08:00
*/
virtual void updateBMFontScale() override;
private:
TextFormat* _textFormat;
std::string _fontName;
int _fontSize;
bool _bmFontCanTint;
bool _grayed;
};
NS_FGUI_END
#endif