mirror of https://github.com/axmolengine/axmol.git
Fix fairygui compilation
This commit is contained in:
parent
6c3d2d13f0
commit
31ed6d97a9
|
@ -768,9 +768,12 @@ void UIPackage::loadMovieClip(PackageItem* item)
|
|||
void UIPackage::loadFont(PackageItem* item)
|
||||
{
|
||||
item->bitmapFont = BitmapFont::create();
|
||||
FontAtlas* fontAtlas = new FontAtlas(*item->bitmapFont);
|
||||
item->bitmapFont->_fontAtlas = fontAtlas;
|
||||
|
||||
auto bitmapFont = item->bitmapFont;
|
||||
#if defined(ADXE_VERSION)
|
||||
auto fontAtlas = bitmapFont->resetFontAtlas(bitmapFont->newFontAtlas());
|
||||
#else
|
||||
auto fontAtlas = bitmapFont->resetFontAtlas(bitmapFont->createFontAtlas());
|
||||
#endif
|
||||
ByteBuffer* buffer = item->rawData;
|
||||
|
||||
buffer->seek(0, 0);
|
||||
|
|
|
@ -16,8 +16,22 @@ public:
|
|||
static BitmapFont* create();
|
||||
|
||||
virtual int* getHorizontalKerningForTextUTF32(const std::u32string& text, int &outNumLetters) const override;
|
||||
virtual cocos2d::FontAtlas *createFontAtlas() override { return _fontAtlas; }
|
||||
void releaseAtlas() { _fontAtlas->release(); }
|
||||
# if defined(ADXE_VERSION)
|
||||
virtual cocos2d::FontAtlas* newFontAtlas() override { return new cocos2d::FontAtlas(this); }
|
||||
#else
|
||||
virtual cocos2d::FontAtlas* createFontAtlas() override { return new cocos2d::FontAtlas(*this); }
|
||||
#endif
|
||||
cocos2d::FontAtlas* resetFontAtlas(cocos2d::FontAtlas* fontAtlas)
|
||||
{
|
||||
if (_fontAtlas != fontAtlas)
|
||||
{
|
||||
CC_SAFE_RELEASE(_fontAtlas);
|
||||
_fontAtlas = fontAtlas;
|
||||
}
|
||||
return _fontAtlas;
|
||||
}
|
||||
cocos2d::FontAtlas* getFontAtlas() const { return _fontAtlas; }
|
||||
void releaseAtlas() { resetFontAtlas(nullptr); }
|
||||
void setFontSize(float fontSize) {}
|
||||
int getOriginalFontSize()const { return _originalFontSize; }
|
||||
bool isResizable() { return _resizable; }
|
||||
|
|
|
@ -143,7 +143,7 @@ bool FUILabel::setBMFontFilePath(const std::string& bmfontFilePath, const Vec2&
|
|||
_bmFontCanTint = bmFont->canTint();
|
||||
|
||||
_currentLabelType = LabelType::BMFONT;
|
||||
setFontAtlas(bmFont->createFontAtlas());
|
||||
setFontAtlas(bmFont->getFontAtlas());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue