本文整理汇总了C++中Label::autorelease方法的典型用法代码示例。如果您正苦于以下问题:C++ Label::autorelease方法的具体用法?C++ Label::autorelease怎么用?C++ Label::autorelease使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Label
的用法示例。
在下文中一共展示了Label::autorelease方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: create
Label* Label::create()
{
Label *ret = new Label();
if (!ret)
return nullptr;
ret->autorelease();
return ret;
}
示例2: create
Label* Label::create()
{
Label* widget = new Label();
if (widget && widget->init())
{
widget->autorelease();
return widget;
}
CC_SAFE_DELETE(widget);
return NULL;
}
示例3: createWithCharMap
Label* Label::createWithCharMap(const std::string& charMapFile, int itemWidth, int itemHeight, int startCharMap)
{
Label *ret = new Label();
if (!ret)
return nullptr;
if (ret->setCharMap(charMapFile,itemWidth,itemHeight,startCharMap))
{
ret->autorelease();
return ret;
}
else
{
delete ret;
return nullptr;
}
}
示例4: createWithAtlas
Label* Label::createWithAtlas(FontAtlas *atlas, TextHAlignment alignment, int lineSize)
{
Label *ret = new Label(atlas, alignment);
if (!ret)
return 0;
if( ret->init() )
{
ret->autorelease();
return ret;
}
else
{
delete ret;
return 0;
}
return ret;
}
示例5: createWithBMFont
Label* Label::createWithBMFont(const std::string& bmfontFilePath, const std::string& text,const TextHAlignment& alignment /* = TextHAlignment::LEFT */, int lineWidth /* = 0 */, const Point& imageOffset /* = Point::ZERO */)
{
Label *ret = new Label(nullptr,alignment);
if (!ret)
return nullptr;
if (ret->setBMFontFilePath(bmfontFilePath,imageOffset))
{
ret->setMaxLineWidth(lineWidth);
ret->setString(text);
ret->autorelease();
return ret;
}
else
{
delete ret;
return nullptr;
}
}
示例6: createWithTTF
Label* Label::createWithTTF(const TTFConfig& ttfConfig, const std::string& text, TextHAlignment alignment /* = TextHAlignment::CENTER */, int lineSize /* = 0 */)
{
Label *ret = new Label(nullptr,alignment);
if (!ret)
return nullptr;
if (ret->setTTFConfig(ttfConfig))
{
ret->setMaxLineWidth(lineSize);
ret->setString(text);
ret->autorelease();
return ret;
}
else
{
delete ret;
return nullptr;
}
}
示例7: createWithTTF
Label* Label::createWithTTF(const TTFConfig& ttfConfig, const std::string& text, TextHAlignment alignment /* = TextHAlignment::CENTER */, int lineSize /* = 0 */)
{
Label *ret = new Label(nullptr,alignment);
if (!ret)
return nullptr;
if (ret->setTTFConfig(ttfConfig))
{
if(ttfConfig.distanceFieldEnabled)
ret->setFontScale(1.0f * ttfConfig.fontSize / DISTANCEFIELD_ATLAS_FONTSIZE);
ret->setMaxLineWidth(lineSize);
ret->setString(text);
ret->autorelease();
return ret;
}
else
{
delete ret;
return nullptr;
}
}