mirror of https://github.com/axmolengine/axmol.git
1.Makes the create functions of Label clear.
This commit is contained in:
parent
a9714f1859
commit
67652357e1
|
@ -47,176 +47,133 @@ Label* Label::create()
|
|||
{
|
||||
auto ret = new Label();
|
||||
|
||||
if (!ret)
|
||||
return nullptr;
|
||||
|
||||
ret->autorelease();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
Label* Label::createWithFontDefinition(const std::string& text, const FontDefinition &textDefinition)
|
||||
{
|
||||
auto ret = new Label();
|
||||
|
||||
if (ret)
|
||||
{
|
||||
ret->setFontDefinition(textDefinition);
|
||||
ret->setString(text);
|
||||
ret->autorelease();
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
Label* Label::create(const std::string& text, const std::string& fontName, float fontSize, const Size& dimensions /* = Size::ZERO */, TextHAlignment hAlignment /* = TextHAlignment::LEFT */, TextVAlignment vAlignment /* = TextVAlignment::TOP */)
|
||||
Label* Label::createWithFont(const std::string& text, const std::string& fontNameOrFontFile, float fontSize, const Size& dimensions /* = Size::ZERO */, TextHAlignment hAlignment /* = TextHAlignment::LEFT */, TextVAlignment vAlignment /* = TextVAlignment::TOP */)
|
||||
{
|
||||
auto ret = new Label(nullptr,hAlignment,vAlignment);
|
||||
|
||||
if (ret)
|
||||
{
|
||||
do
|
||||
if (FileUtils::getInstance()->isFileExist(fontNameOrFontFile))
|
||||
{
|
||||
if (FileUtils::getInstance()->isFileExist(fontName))
|
||||
{
|
||||
TTFConfig ttfConfig(fontName.c_str(),fontSize,GlyphCollection::DYNAMIC);
|
||||
TTFConfig ttfConfig(fontNameOrFontFile.c_str(),fontSize,GlyphCollection::DYNAMIC);
|
||||
if (ret->setTTFConfig(ttfConfig))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
FontDefinition fontDef;
|
||||
fontDef._fontName = fontName;
|
||||
fontDef._fontSize = fontSize;
|
||||
fontDef._dimensions = dimensions;
|
||||
fontDef._alignment = hAlignment;
|
||||
fontDef._vertAlignment = vAlignment;
|
||||
ret->setFontDefinition(fontDef);
|
||||
} while (0);
|
||||
|
||||
ret->setDimensions(dimensions.width,dimensions.height);
|
||||
ret->setString(text);
|
||||
|
||||
ret->autorelease();
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ret->setFont(fontNameOrFontFile);
|
||||
ret->setFontSize(fontSize);
|
||||
ret->setDimensions(dimensions.width, dimensions.height);
|
||||
ret->setString(text);
|
||||
|
||||
ret->autorelease();
|
||||
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
delete ret;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Label* Label::createWithTTF(const TTFConfig& ttfConfig, const std::string& text, TextHAlignment alignment /* = TextHAlignment::CENTER */, int maxLineWidth /* = 0 */)
|
||||
{
|
||||
auto ret = new Label(nullptr,alignment);
|
||||
|
||||
if (!ret)
|
||||
if (ret && FileUtils::getInstance()->isFileExist(ttfConfig.fontFilePath) && ret->setTTFConfig(ttfConfig))
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
if( FileUtils::getInstance()->isFileExist(ttfConfig.fontFilePath) && ret->setTTFConfig(ttfConfig))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
FontDefinition fontDef;
|
||||
fontDef._fontName = ttfConfig.fontFilePath;
|
||||
fontDef._fontSize = ttfConfig.fontSize;
|
||||
fontDef._dimensions = Size::ZERO;
|
||||
fontDef._alignment = alignment;
|
||||
fontDef._vertAlignment = TextVAlignment::TOP;
|
||||
ret->setFontDefinition(fontDef);
|
||||
} while (0);
|
||||
|
||||
ret->setMaxLineWidth(maxLineWidth);
|
||||
ret->setString(text);
|
||||
ret->autorelease();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
delete ret;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Label* Label::createWithTTF(const std::string& text, const std::string& fontFilePath, int fontSize, int maxLineWidth /* = 0 */, TextHAlignment alignment /* = TextHAlignment::CENTER */, GlyphCollection glyphs /* = GlyphCollection::NEHE */, const char *customGlyphs /* = 0 */, bool useDistanceField /* = false */)
|
||||
Label* Label::createWithTTF(const std::string& text, const std::string& fontFile, float fontSize, const Size& dimensions /* = Size::ZERO */, TextHAlignment hAlignment /* = TextHAlignment::LEFT */, TextVAlignment vAlignment /* = TextVAlignment::TOP */)
|
||||
{
|
||||
TTFConfig ttfConfig(fontFilePath.c_str(),fontSize,glyphs,customGlyphs,useDistanceField);
|
||||
return createWithTTF(ttfConfig,text,alignment,maxLineWidth);
|
||||
if (FileUtils::getInstance()->isFileExist(fontFile))
|
||||
{
|
||||
return createWithFont(text, fontFile, fontSize, dimensions, hAlignment, vAlignment);
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Label* Label::createWithBMFont(const std::string& bmfontFilePath, const std::string& text,const TextHAlignment& alignment /* = TextHAlignment::LEFT */, int maxLineWidth /* = 0 */, const Point& imageOffset /* = Point::ZERO */)
|
||||
{
|
||||
auto ret = new Label(nullptr,alignment);
|
||||
|
||||
if (!ret)
|
||||
return nullptr;
|
||||
|
||||
if (ret->setBMFontFilePath(bmfontFilePath,imageOffset))
|
||||
if (ret && ret->setBMFontFilePath(bmfontFilePath,imageOffset))
|
||||
{
|
||||
ret->setMaxLineWidth(maxLineWidth);
|
||||
ret->setString(text);
|
||||
ret->autorelease();
|
||||
|
||||
return ret;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
delete ret;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
Label* Label::createWithCharMap(const std::string& plistFile)
|
||||
{
|
||||
auto ret = new Label();
|
||||
|
||||
if (!ret)
|
||||
return nullptr;
|
||||
|
||||
if (ret->setCharMap(plistFile))
|
||||
if (ret && ret->setCharMap(plistFile))
|
||||
{
|
||||
ret->autorelease();
|
||||
return ret;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
delete ret;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
Label* Label::createWithCharMap(Texture2D* texture, int itemWidth, int itemHeight, int startCharMap)
|
||||
{
|
||||
auto ret = new Label();
|
||||
|
||||
if (!ret)
|
||||
return nullptr;
|
||||
|
||||
if (ret->setCharMap(texture,itemWidth,itemHeight,startCharMap))
|
||||
if (ret && ret->setCharMap(texture,itemWidth,itemHeight,startCharMap))
|
||||
{
|
||||
ret->autorelease();
|
||||
return ret;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
delete ret;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
Label* Label::createWithCharMap(const std::string& charMapFile, int itemWidth, int itemHeight, int startCharMap)
|
||||
{
|
||||
auto ret = new Label();
|
||||
|
||||
if (!ret)
|
||||
return nullptr;
|
||||
|
||||
if (ret->setCharMap(charMapFile,itemWidth,itemHeight,startCharMap))
|
||||
if (ret && ret->setCharMap(charMapFile,itemWidth,itemHeight,startCharMap))
|
||||
{
|
||||
ret->autorelease();
|
||||
return ret;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
delete ret;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
bool Label::setCharMap(const std::string& plistFile)
|
||||
|
@ -296,11 +253,22 @@ Label::Label(FontAtlas *atlas /* = nullptr */, TextHAlignment hAlignment /* = Te
|
|||
reset();
|
||||
|
||||
#if CC_ENABLE_CACHE_TEXTURE_DATA
|
||||
auto toBackgroundListener = EventListenerCustom::create(EVENT_COME_TO_BACKGROUND, CC_CALLBACK_1(Label::listenToBackground, this));
|
||||
auto toBackgroundListener = EventListenerCustom::create(EVENT_COME_TO_BACKGROUND, [this](EventCustom* event){
|
||||
if (_fontAtlas && _currentLabelType == LabelType::TTF)
|
||||
{
|
||||
_batchNodes.clear();
|
||||
_batchNodes.push_back(this);
|
||||
Node::removeAllChildrenWithCleanup(true);
|
||||
}
|
||||
});
|
||||
_eventDispatcher->addEventListenerWithSceneGraphPriority(toBackgroundListener, this);
|
||||
#endif
|
||||
|
||||
auto purgeTextureListener = EventListenerCustom::create(FontAtlas::EVENT_PURGE_TEXTURES, CC_CALLBACK_1(Label::listenToFontAtlasPurge, this));
|
||||
auto purgeTextureListener = EventListenerCustom::create(FontAtlas::EVENT_PURGE_TEXTURES, [this](EventCustom* event){
|
||||
if (_fontAtlas && _currentLabelType == LabelType::TTF && event->getUserData() == _fontAtlas)
|
||||
{
|
||||
alignText();
|
||||
}
|
||||
});
|
||||
_eventDispatcher->addEventListenerWithSceneGraphPriority(purgeTextureListener, this);
|
||||
}
|
||||
|
||||
|
@ -323,13 +291,8 @@ void Label::reset()
|
|||
TTFConfig temp;
|
||||
_fontConfig = temp;
|
||||
|
||||
_fontDefinition._fontName = "Helvetica";
|
||||
_fontDefinition._fontSize = 12;
|
||||
_fontDefinition._alignment = _hAlignment;
|
||||
_fontDefinition._vertAlignment = _vAlignment;
|
||||
|
||||
_fontDirty = false;
|
||||
_fontName = "Helvetica";
|
||||
_fontNameOrFontFile = "Helvetica";
|
||||
_fontSize = 12;
|
||||
|
||||
_batchNodes.clear();
|
||||
|
@ -476,9 +439,6 @@ bool Label::setTTFConfig(const TTFConfig& ttfConfig)
|
|||
}
|
||||
}
|
||||
|
||||
_fontDefinition._shadow._shadowEnabled = false;
|
||||
_fontDefinition._stroke._strokeEnabled = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -498,27 +458,6 @@ bool Label::setBMFontFilePath(const std::string& bmfontFilePath, const Point& im
|
|||
return true;
|
||||
}
|
||||
|
||||
void Label::setFontDefinition(const FontDefinition& textDefinition)
|
||||
{
|
||||
reset();
|
||||
_fontDefinition = textDefinition;
|
||||
_fontName = textDefinition._fontName;
|
||||
_fontSize = textDefinition._fontSize;
|
||||
|
||||
_shadowEnabled = textDefinition._shadow._shadowEnabled;
|
||||
if (_shadowEnabled)
|
||||
{
|
||||
enableShadow(Color4B::BLACK,_fontDefinition._shadow._shadowOffset,_fontDefinition._shadow._shadowBlur);
|
||||
}
|
||||
|
||||
_textColor = Color4B(_fontDefinition._fontFillColor);
|
||||
_textColorF.r = _textColor.r / 255.0f;
|
||||
_textColorF.g = _textColor.g / 255.0f;
|
||||
_textColorF.b = _textColor.b / 255.0f;
|
||||
_textColorF.a = _textColor.a / 255.0f;
|
||||
_contentDirty = true;
|
||||
}
|
||||
|
||||
void Label::setString(const std::string& text)
|
||||
{
|
||||
_originalUTF8String = text;
|
||||
|
@ -529,9 +468,6 @@ void Label::setAlignment(TextHAlignment hAlignment,TextVAlignment vAlignment)
|
|||
{
|
||||
if (hAlignment != _hAlignment || vAlignment != _vAlignment)
|
||||
{
|
||||
_fontDefinition._alignment = hAlignment;
|
||||
_fontDefinition._vertAlignment = vAlignment;
|
||||
|
||||
_hAlignment = hAlignment;
|
||||
_vAlignment = vAlignment;
|
||||
|
||||
|
@ -552,9 +488,6 @@ void Label::setDimensions(unsigned int width,unsigned int height)
|
|||
{
|
||||
if (height != _labelHeight || width != _labelWidth)
|
||||
{
|
||||
_fontDefinition._dimensions.width = width;
|
||||
_fontDefinition._dimensions.height = height;
|
||||
|
||||
_labelWidth = width;
|
||||
_labelHeight = height;
|
||||
_labelDimensions.width = width;
|
||||
|
@ -802,27 +735,6 @@ void Label::sortAllChildren()
|
|||
// Label ignore sort children
|
||||
}
|
||||
|
||||
void Label::setLabelEffect(LabelEffect effect,const Color3B& effectColor)
|
||||
{
|
||||
switch (effect)
|
||||
{
|
||||
case cocos2d::LabelEffect::NORMAL:
|
||||
disableEffect();
|
||||
break;
|
||||
case cocos2d::LabelEffect::OUTLINE:
|
||||
enableOutline(Color4B(effectColor));
|
||||
break;
|
||||
case cocos2d::LabelEffect::SHADOW:
|
||||
enableShadow(Color4B(effectColor));
|
||||
break;
|
||||
case cocos2d::LabelEffect::GLOW:
|
||||
enableGlow(Color4B(effectColor));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void Label::enableGlow(const Color4B& glowColor)
|
||||
{
|
||||
if(! _useDistanceField)
|
||||
|
@ -846,6 +758,7 @@ void Label::enableOutline(const Color4B& outlineColor,int outlineSize /* = -1 */
|
|||
|
||||
if (outlineSize > 0)
|
||||
{
|
||||
_outlineSize = outlineSize;
|
||||
if (_currentLabelType == LabelType::TTF)
|
||||
{
|
||||
if (_fontConfig.outlineSize != outlineSize)
|
||||
|
@ -856,9 +769,6 @@ void Label::enableOutline(const Color4B& outlineColor,int outlineSize /* = -1 */
|
|||
updateShaderProgram();
|
||||
}
|
||||
}
|
||||
_fontDefinition._stroke._strokeEnabled = true;
|
||||
_fontDefinition._stroke._strokeSize = outlineSize;
|
||||
_fontDefinition._stroke._strokeColor = Color3B(outlineColor.r,outlineColor.g,outlineColor.b);
|
||||
|
||||
_currLabelEffect = LabelEffect::OUTLINE;
|
||||
_contentDirty = true;
|
||||
|
@ -868,7 +778,6 @@ void Label::enableOutline(const Color4B& outlineColor,int outlineSize /* = -1 */
|
|||
void Label::enableShadow(const Color4B& shadowColor /* = Color4B::BLACK */,const Size &offset /* = Size(2 ,-2)*/, int blurRadius /* = 0 */)
|
||||
{
|
||||
_shadowEnabled = true;
|
||||
_fontDefinition._shadow._shadowEnabled = false;
|
||||
_shadowDirty = true;
|
||||
|
||||
_shadowColor.r = shadowColor.r;
|
||||
|
@ -991,15 +900,8 @@ void Label::draw(Renderer *renderer, const kmMat4 &transform, bool transformUpda
|
|||
void Label::createSpriteWithFontDefinition()
|
||||
{
|
||||
_currentLabelType = LabelType::STRING_TEXTURE;
|
||||
|
||||
auto texture = new Texture2D;
|
||||
#if (CC_TARGET_PLATFORM != CC_PLATFORM_ANDROID) && (CC_TARGET_PLATFORM != CC_PLATFORM_IOS)
|
||||
if (_fontDefinition._shadow._shadowEnabled || _fontDefinition._stroke._strokeEnabled)
|
||||
{
|
||||
CCLOGERROR("Currently only supported on iOS and Android!");
|
||||
}
|
||||
_fontDefinition._shadow._shadowEnabled = false;
|
||||
_fontDefinition._stroke._strokeEnabled = false;
|
||||
#endif
|
||||
texture->initWithString(_originalUTF8String.c_str(),_fontDefinition);
|
||||
|
||||
_textSprite = Sprite::createWithTexture(texture);
|
||||
|
@ -1016,11 +918,29 @@ void Label::createSpriteWithFontDefinition()
|
|||
_textSprite->updateDisplayedColor(_displayedColor);
|
||||
}
|
||||
|
||||
void Label::setFontDefinition(const FontDefinition& textDefinition)
|
||||
{
|
||||
_fontDefinition = textDefinition;
|
||||
#if (CC_TARGET_PLATFORM != CC_PLATFORM_ANDROID) && (CC_TARGET_PLATFORM != CC_PLATFORM_IOS)
|
||||
if (_fontDefinition._stroke._strokeEnabled)
|
||||
{
|
||||
CCLOGERROR("Currently only supported on iOS and Android!");
|
||||
}
|
||||
_fontDefinition._stroke._strokeEnabled = false;
|
||||
#endif
|
||||
if (_fontDefinition._shadow._shadowEnabled)
|
||||
{
|
||||
_fontDefinition._shadow._shadowEnabled = false;
|
||||
enableShadow(Color4B(0,0,0,255 * _fontDefinition._shadow._shadowOpacity),_fontDefinition._shadow._shadowOffset,_fontDefinition._shadow._shadowBlur);
|
||||
}
|
||||
}
|
||||
|
||||
void Label::updateContent()
|
||||
{
|
||||
auto utf16String = cc_utf8_to_utf16(_originalUTF8String.c_str());
|
||||
setCurrentString(utf16String);
|
||||
setOriginalString(utf16String);
|
||||
|
||||
if (_textSprite)
|
||||
{
|
||||
Node::removeChild(_textSprite,true);
|
||||
|
@ -1031,16 +951,49 @@ void Label::updateContent()
|
|||
_shadowNode = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
if (_fontAtlas)
|
||||
{
|
||||
alignText();
|
||||
}
|
||||
else
|
||||
{
|
||||
_fontDefinition._fontName = _fontNameOrFontFile;
|
||||
_fontDefinition._fontSize = _fontSize;
|
||||
|
||||
_fontDefinition._alignment = _hAlignment;
|
||||
_fontDefinition._vertAlignment = _vAlignment;
|
||||
|
||||
_fontDefinition._dimensions.width = _labelWidth;
|
||||
_fontDefinition._dimensions.height = _labelHeight;
|
||||
|
||||
_fontDefinition._fontFillColor.r = _textColor.r;
|
||||
_fontDefinition._fontFillColor.g = _textColor.g;
|
||||
_fontDefinition._fontFillColor.b = _textColor.b;
|
||||
|
||||
_fontDefinition._shadow._shadowEnabled = false;
|
||||
|
||||
if (_currLabelEffect == LabelEffect::OUTLINE && _outlineSize > 0)
|
||||
{
|
||||
_fontDefinition._stroke._strokeEnabled = true;
|
||||
_fontDefinition._stroke._strokeSize = _outlineSize;
|
||||
_fontDefinition._stroke._strokeColor.r = _effectColor.r;
|
||||
_fontDefinition._stroke._strokeColor.g = _effectColor.g;
|
||||
_fontDefinition._stroke._strokeColor.b = _effectColor.b;
|
||||
}
|
||||
else
|
||||
{
|
||||
_fontDefinition._stroke._strokeEnabled = false;
|
||||
}
|
||||
|
||||
#if (CC_TARGET_PLATFORM != CC_PLATFORM_ANDROID) && (CC_TARGET_PLATFORM != CC_PLATFORM_IOS)
|
||||
if (_fontDefinition._stroke._strokeEnabled)
|
||||
{
|
||||
CCLOGERROR("Currently only supported on iOS and Android!");
|
||||
}
|
||||
_fontDefinition._stroke._strokeEnabled = false;
|
||||
#endif
|
||||
|
||||
createSpriteWithFontDefinition();
|
||||
}
|
||||
_contentDirty = false;
|
||||
|
@ -1048,14 +1001,21 @@ void Label::updateContent()
|
|||
|
||||
void Label::updateFont()
|
||||
{
|
||||
if (FileUtils::getInstance()->isFileExist(_fontName))
|
||||
if (FileUtils::getInstance()->isFileExist(_fontNameOrFontFile))
|
||||
{
|
||||
_fontConfig.fontFilePath = _fontName;
|
||||
_fontConfig.fontFilePath = _fontNameOrFontFile;
|
||||
_fontConfig.fontSize = _fontSize;
|
||||
setTTFConfig(_fontConfig);
|
||||
}
|
||||
_fontDefinition._fontName = _fontName;
|
||||
_fontDefinition._fontSize = _fontSize;
|
||||
else if (_fontAtlas)
|
||||
{
|
||||
_batchNodes.clear();
|
||||
_batchNodes.push_back(this);
|
||||
|
||||
FontAtlasCache::releaseFontAtlas(_fontAtlas);
|
||||
_fontAtlas = nullptr;
|
||||
}
|
||||
|
||||
_contentDirty = true;
|
||||
_fontDirty = false;
|
||||
}
|
||||
|
@ -1064,18 +1024,7 @@ void Label::drawTextSprite(Renderer *renderer, bool parentTransformUpdated)
|
|||
{
|
||||
if (_fontDefinition._fontFillColor != _textColor)
|
||||
{
|
||||
Node::removeChild(_textSprite,true);
|
||||
_textSprite = nullptr;
|
||||
if (_shadowNode)
|
||||
{
|
||||
Node::removeChild(_shadowNode,true);
|
||||
_shadowNode = nullptr;
|
||||
}
|
||||
|
||||
_fontDefinition._fontFillColor.r = _textColor.r;
|
||||
_fontDefinition._fontFillColor.g = _textColor.g;
|
||||
_fontDefinition._fontFillColor.b = _textColor.b;
|
||||
createSpriteWithFontDefinition();
|
||||
updateContent();
|
||||
}
|
||||
|
||||
if (_shadowEnabled && _shadowNode == nullptr)
|
||||
|
@ -1084,8 +1033,9 @@ void Label::drawTextSprite(Renderer *renderer, bool parentTransformUpdated)
|
|||
if (_shadowNode)
|
||||
{
|
||||
if (_blendFuncDirty)
|
||||
{
|
||||
_shadowNode->setBlendFunc(_blendFunc);
|
||||
|
||||
}
|
||||
_shadowNode->setAnchorPoint(Point::ANCHOR_BOTTOM_LEFT);
|
||||
_shadowNode->setColor(_shadowColor);
|
||||
_shadowNode->setOpacity(_shadowOpacity * _displayedOpacity);
|
||||
|
@ -1158,18 +1108,18 @@ void Label::visit(Renderer *renderer, const kmMat4 &parentTransform, bool parent
|
|||
setOrderOfArrival(0);
|
||||
}
|
||||
|
||||
void Label::setFontName(const std::string& fontName)
|
||||
void Label::setFont(const std::string& fontNameOrFileFile)
|
||||
{
|
||||
if (fontName != _fontName)
|
||||
if (fontNameOrFileFile != _fontNameOrFontFile)
|
||||
{
|
||||
_fontName = fontName;
|
||||
_fontNameOrFontFile = fontNameOrFileFile;
|
||||
_fontDirty = true;
|
||||
}
|
||||
}
|
||||
|
||||
const std::string& Label::getFontName() const
|
||||
const std::string& Label::getFont() const
|
||||
{
|
||||
return _fontName;
|
||||
return _fontNameOrFontFile;
|
||||
}
|
||||
|
||||
void Label::setFontSize(float fontSize)
|
||||
|
@ -1381,26 +1331,6 @@ Rect Label::getBoundingBox() const
|
|||
return Node::getBoundingBox();
|
||||
}
|
||||
|
||||
void Label::listenToBackground(EventCustom *event)
|
||||
{
|
||||
#if CC_ENABLE_CACHE_TEXTURE_DATA
|
||||
if (_fontAtlas && _currentLabelType == LabelType::TTF)
|
||||
{
|
||||
_batchNodes.clear();
|
||||
_batchNodes.push_back(this);
|
||||
Node::removeAllChildrenWithCleanup(true);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void Label::listenToFontAtlasPurge(EventCustom *event)
|
||||
{
|
||||
if (_fontAtlas && _currentLabelType == LabelType::TTF && event->getUserData() == _fontAtlas)
|
||||
{
|
||||
alignText();
|
||||
}
|
||||
}
|
||||
|
||||
void Label::setBlendFunc(const BlendFunc &blendFunc)
|
||||
{
|
||||
_blendFunc = blendFunc;
|
||||
|
|
|
@ -82,18 +82,19 @@ public:
|
|||
|
||||
static Label* create();
|
||||
|
||||
/** creates a Label from a font name, horizontal alignment, dimension in points, and font size in points.
|
||||
* @warning It will generate texture by the platform-dependent code if [fontName] not a font file.
|
||||
/** Creates a label with an initial string,font[font name or font file],font size, dimension in points, horizontal alignment and vertical alignment.
|
||||
*
|
||||
*/
|
||||
static Label * create(const std::string& text, const std::string& fontName, float fontSize,
|
||||
static Label * createWithFont(const std::string& text, const std::string& fontNameOrFontFile, float fontSize,
|
||||
const Size& dimensions = Size::ZERO, TextHAlignment hAlignment = TextHAlignment::LEFT,
|
||||
TextVAlignment vAlignment = TextVAlignment::TOP);
|
||||
|
||||
/** create a label with TTF configuration
|
||||
* It will generate texture of character by freetype.
|
||||
/** Create a label with TTF configuration
|
||||
* It not support font name.
|
||||
*/
|
||||
static Label* createWithTTF(const TTFConfig& ttfConfig, const std::string& text, TextHAlignment alignment = TextHAlignment::LEFT, int maxLineWidth = 0);
|
||||
|
||||
/* Creates a label with an FNT file,an initial string,horizontal alignment,max line width and the offset of image*/
|
||||
static Label* createWithBMFont(const std::string& bmfontFilePath, const std::string& text,
|
||||
const TextHAlignment& alignment = TextHAlignment::LEFT, int maxLineWidth = 0,
|
||||
const Point& imageOffset = Point::ZERO);
|
||||
|
@ -102,12 +103,6 @@ public:
|
|||
static Label * createWithCharMap(Texture2D* texture, int itemWidth, int itemHeight, int startCharMap);
|
||||
static Label * createWithCharMap(const std::string& plistFile);
|
||||
|
||||
/** create a lable with string and a font definition
|
||||
* @warning It will generate texture by the platform-dependent code and create Sprite for show text.
|
||||
* To obtain better performance use createWithTTF/createWithBMFont/createWithCharMap
|
||||
*/
|
||||
static Label * createWithFontDefinition(const std::string& text, const FontDefinition &textDefinition);
|
||||
|
||||
/** set TTF configuration for Label */
|
||||
virtual bool setTTFConfig(const TTFConfig& ttfConfig);
|
||||
|
||||
|
@ -118,14 +113,6 @@ public:
|
|||
virtual bool setCharMap(Texture2D* texture, int itemWidth, int itemHeight, int startCharMap);
|
||||
virtual bool setCharMap(const std::string& plistFile);
|
||||
|
||||
/** set the text definition used by this label
|
||||
* It will create Sprite for show text if you haven't set up using TTF/BMFont/CharMap.
|
||||
*/
|
||||
virtual void setFontDefinition(const FontDefinition& textDefinition);
|
||||
|
||||
/** get the text definition used by this label */
|
||||
const FontDefinition& getFontDefinition() const { return _fontDefinition; }
|
||||
|
||||
/** changes the string to render
|
||||
* @warning It is as expensive as changing the string if you haven't set up TTF/BMFont/CharMap for the label.
|
||||
*/
|
||||
|
@ -190,8 +177,8 @@ public:
|
|||
/** update content immediately.*/
|
||||
virtual void updateContent();
|
||||
|
||||
virtual void setFontName(const std::string& fontName);
|
||||
virtual const std::string& getFontName() const;
|
||||
virtual void setFont(const std::string& fontNameOrFileFile);
|
||||
virtual const std::string& getFont() const;
|
||||
|
||||
virtual void setFontSize(float fontSize);
|
||||
virtual float getFontSize() const;
|
||||
|
@ -243,22 +230,25 @@ public:
|
|||
virtual void visit(Renderer *renderer, const kmMat4 &parentTransform, bool parentTransformUpdated) override;
|
||||
virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated) override;
|
||||
|
||||
/** Listen "come to background" message
|
||||
It only has effect on Android.
|
||||
CC_DEPRECATED_ATTRIBUTE static Label * create(const std::string& text, const std::string& fontNameOrFontFile, float fontSize,
|
||||
const Size& dimensions = Size::ZERO, TextHAlignment hAlignment = TextHAlignment::LEFT,
|
||||
TextVAlignment vAlignment = TextVAlignment::TOP) {
|
||||
return createWithFont(text, fontNameOrFontFile, fontSize, dimensions, hAlignment, vAlignment);
|
||||
}
|
||||
|
||||
/** creates a Label from a font name, horizontal alignment, dimension in points, and font size in points.
|
||||
* @warning It will generate texture by the platform-dependent code if [fontName] not a font file.
|
||||
*/
|
||||
void listenToBackground(EventCustom *event);
|
||||
CC_DEPRECATED_ATTRIBUTE static Label * createWithTTF(const std::string& text, const std::string& fontFile, float fontSize,
|
||||
const Size& dimensions = Size::ZERO, TextHAlignment hAlignment = TextHAlignment::LEFT,
|
||||
TextVAlignment vAlignment = TextVAlignment::TOP);
|
||||
|
||||
/** Listen "FontAtlas purge textures" message
|
||||
*/
|
||||
void listenToFontAtlasPurge(EventCustom *event);
|
||||
CC_DEPRECATED_ATTRIBUTE virtual void setFontName(const std::string& fontName) { setFont(fontName);}
|
||||
CC_DEPRECATED_ATTRIBUTE virtual const std::string& getFontName() const { return getFont();}
|
||||
|
||||
CC_DEPRECATED_ATTRIBUTE static Label* createWithTTF(const std::string& label, const std::string& fontFilePath,
|
||||
int fontSize, int maxLineWidth = 0, TextHAlignment alignment = TextHAlignment::LEFT,
|
||||
GlyphCollection glyphs = GlyphCollection::DYNAMIC, const char *customGlyphs = 0, bool useDistanceField = false);
|
||||
CC_DEPRECATED_ATTRIBUTE virtual void setFontDefinition(const FontDefinition& textDefinition);
|
||||
CC_DEPRECATED_ATTRIBUTE const FontDefinition& getFontDefinition() const { return _fontDefinition; }
|
||||
|
||||
CC_DEPRECATED_ATTRIBUTE int getStringLenght() const { return getStringLength(); }
|
||||
|
||||
CC_DEPRECATED_ATTRIBUTE void setLabelEffect(LabelEffect effect,const Color3B& effectColor);
|
||||
protected:
|
||||
void onDraw(const kmMat4& transform, bool transformUpdated);
|
||||
|
||||
|
@ -318,12 +308,14 @@ protected:
|
|||
void updateFont();
|
||||
void reset();
|
||||
|
||||
|
||||
|
||||
std::string _bmFontPath;
|
||||
|
||||
bool _isOpacityModifyRGB;
|
||||
bool _contentDirty;
|
||||
bool _fontDirty;
|
||||
std::string _fontName;
|
||||
std::string _fontNameOrFontFile;
|
||||
float _fontSize;
|
||||
LabelType _currentLabelType;
|
||||
|
||||
|
@ -380,6 +372,8 @@ protected:
|
|||
float _shadowOpacity;
|
||||
Sprite* _shadowNode;
|
||||
|
||||
int _outlineSize;
|
||||
|
||||
Color4B _textColor;
|
||||
Color4F _textColorF;
|
||||
|
||||
|
|
|
@ -100,7 +100,7 @@ bool LabelTTF::initWithString(const std::string& string, const std::string& font
|
|||
_renderLabel->setFontSize(fontSize);
|
||||
_renderLabel->setDimensions(dimensions.width,dimensions.height);
|
||||
_renderLabel->setAlignment(hAlignment,vAlignment);
|
||||
_renderLabel->setFontName(fontName);
|
||||
_renderLabel->setFont(fontName);
|
||||
_contentDirty = true;
|
||||
|
||||
return true;
|
||||
|
@ -128,7 +128,7 @@ const std::string& LabelTTF::getString() const
|
|||
|
||||
std::string LabelTTF::getDescription() const
|
||||
{
|
||||
return StringUtils::format("<LabelTTF | FontName = %s, FontSize = %f, Label = '%s'>", _renderLabel->getFontName().c_str(), _renderLabel->getFontSize(), _renderLabel->getString().c_str());
|
||||
return StringUtils::format("<LabelTTF | FontName = %s, FontSize = %f, Label = '%s'>", _renderLabel->getFont().c_str(), _renderLabel->getFontSize(), _renderLabel->getString().c_str());
|
||||
}
|
||||
|
||||
TextHAlignment LabelTTF::getHorizontalAlignment() const
|
||||
|
@ -177,12 +177,12 @@ void LabelTTF::setFontSize(float fontSize)
|
|||
|
||||
const std::string& LabelTTF::getFontName() const
|
||||
{
|
||||
return _renderLabel->getFontName();
|
||||
return _renderLabel->getFont();
|
||||
}
|
||||
|
||||
void LabelTTF::setFontName(const std::string& fontName)
|
||||
{
|
||||
_renderLabel->setFontName(fontName);
|
||||
_renderLabel->setFont(fontName);
|
||||
_contentDirty = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -439,7 +439,7 @@ bool MenuItemFont::initWithString(const std::string& value, const ccMenuCallback
|
|||
_fontName = _globalFontName;
|
||||
_fontSize = _globalFontSize;
|
||||
|
||||
Label *label = Label::create(value, _fontName, _fontSize);
|
||||
Label *label = Label::createWithFont(value, _fontName, _fontSize);
|
||||
if (MenuItemLabel::initWithLabel(label, callback))
|
||||
{
|
||||
// do something ?
|
||||
|
@ -462,7 +462,7 @@ int MenuItemFont::getFontSizeObj() const
|
|||
void MenuItemFont::setFontNameObj(const std::string& name)
|
||||
{
|
||||
_fontName = name;
|
||||
dynamic_cast<Label*>(_label)->setFontName(_fontName);
|
||||
dynamic_cast<Label*>(_label)->setFont(_fontName);
|
||||
this->setContentSize(dynamic_cast<Label*>(_label)->getContentSize());
|
||||
}
|
||||
|
||||
|
|
|
@ -111,7 +111,7 @@ bool TextFieldTTF::initWithPlaceHolder(const std::string& placeholder, const Siz
|
|||
{
|
||||
_placeHolder = placeholder;
|
||||
setDimensions(dimensions.width,dimensions.height);
|
||||
setFontName(fontName);
|
||||
setFont(fontName);
|
||||
setFontSize(fontSize);
|
||||
setAlignment(alignment,TextVAlignment::CENTER);
|
||||
Label::setTextColor(_colorSpaceHolder);
|
||||
|
@ -122,7 +122,7 @@ bool TextFieldTTF::initWithPlaceHolder(const std::string& placeholder, const Siz
|
|||
bool TextFieldTTF::initWithPlaceHolder(const std::string& placeholder, const std::string& fontName, float fontSize)
|
||||
{
|
||||
_placeHolder = std::string(placeholder);
|
||||
setFontName(fontName);
|
||||
setFont(fontName);
|
||||
setFontSize(fontSize);
|
||||
Label::setTextColor(_colorSpaceHolder);
|
||||
Label::setString(_placeHolder);
|
||||
|
|
|
@ -40,7 +40,7 @@ void LabelTTFLoader::onHandlePropTypeBlendFunc(Node * pNode, Node * pParent, con
|
|||
|
||||
void LabelTTFLoader::onHandlePropTypeFontTTF(Node * pNode, Node * pParent, const char * pPropertyName, const char * pFontTTF, CCBReader * ccbReader) {
|
||||
if(strcmp(pPropertyName, PROPERTY_FONTNAME) == 0) {
|
||||
((Label *)pNode)->setFontName(pFontTTF);
|
||||
((Label *)pNode)->setFont(pFontTTF);
|
||||
} else {
|
||||
NodeLoader::onHandlePropTypeFontTTF(pNode, pParent, pPropertyName, pFontTTF, ccbReader);
|
||||
}
|
||||
|
|
|
@ -699,12 +699,12 @@ float Button::getTitleFontSize() const
|
|||
|
||||
void Button::setTitleFontName(const std::string& fontName)
|
||||
{
|
||||
_titleRenderer->setFontName(fontName);
|
||||
_titleRenderer->setFont(fontName);
|
||||
}
|
||||
|
||||
const std::string& Button::getTitleFontName() const
|
||||
{
|
||||
return _titleRenderer->getFontName();
|
||||
return _titleRenderer->getFont();
|
||||
}
|
||||
|
||||
std::string Button::getDescription() const
|
||||
|
|
|
@ -210,7 +210,7 @@ void RichText::formatText()
|
|||
case RICH_TEXT:
|
||||
{
|
||||
RichElementText* elmtText = static_cast<RichElementText*>(element);
|
||||
elementRenderer = Label::create(elmtText->_text.c_str(), elmtText->_fontName.c_str(), elmtText->_fontSize);
|
||||
elementRenderer = Label::createWithFont(elmtText->_text.c_str(), elmtText->_fontName.c_str(), elmtText->_fontSize);
|
||||
break;
|
||||
}
|
||||
case RICH_IMAGE:
|
||||
|
@ -272,7 +272,7 @@ void RichText::formatText()
|
|||
|
||||
void RichText::handleTextRenderer(const char *text, const char *fontName, float fontSize, const Color3B &color, GLubyte opacity)
|
||||
{
|
||||
Label* textRenderer = Label::create(text, fontName, fontSize);
|
||||
Label* textRenderer = Label::createWithFont(text, fontName, fontSize);
|
||||
float textRendererWidth = textRenderer->getContentSize().width;
|
||||
_leftSpaceWidth -= textRendererWidth;
|
||||
if (_leftSpaceWidth < 0.0f)
|
||||
|
@ -285,7 +285,7 @@ void RichText::handleTextRenderer(const char *text, const char *fontName, float
|
|||
std::string cutWords = curText.substr(leftLength, curText.length()-1);
|
||||
if (leftLength > 0)
|
||||
{
|
||||
Label* leftRenderer = Label::create(leftWords.substr(0, leftLength).c_str(), fontName, fontSize);
|
||||
Label* leftRenderer = Label::createWithFont(leftWords.substr(0, leftLength).c_str(), fontName, fontSize);
|
||||
leftRenderer->setColor(color);
|
||||
leftRenderer->setOpacity(opacity);
|
||||
pushToContainer(leftRenderer);
|
||||
|
|
|
@ -132,7 +132,7 @@ int Text::getFontSize()
|
|||
void Text::setFontName(const std::string& name)
|
||||
{
|
||||
_fontName = name;
|
||||
_labelRenderer->setFontName(name);
|
||||
_labelRenderer->setFont(name);
|
||||
labelScaleChangedWithSize();
|
||||
}
|
||||
|
||||
|
|
|
@ -542,13 +542,13 @@ int TextField::getFontSize()
|
|||
|
||||
void TextField::setFontName(const std::string& name)
|
||||
{
|
||||
_textFieldRenderer->setFontName(name);
|
||||
_textFieldRenderer->setFont(name);
|
||||
textfieldRendererScaleChangedWithSize();
|
||||
}
|
||||
|
||||
const std::string& TextField::getFontName()
|
||||
{
|
||||
return _textFieldRenderer->getFontName();
|
||||
return _textFieldRenderer->getFont();
|
||||
}
|
||||
|
||||
void TextField::didNotSelectSelf()
|
||||
|
@ -807,7 +807,7 @@ void TextField::copySpecialProperties(Widget *widget)
|
|||
setText(textField->_textFieldRenderer->getString());
|
||||
setPlaceHolder(textField->getStringValue());
|
||||
setFontSize(textField->_textFieldRenderer->getFontSize());
|
||||
setFontName(textField->_textFieldRenderer->getFontName().c_str());
|
||||
setFontName(textField->_textFieldRenderer->getFont().c_str());
|
||||
setMaxLengthEnabled(textField->isMaxLengthEnabled());
|
||||
setMaxLength(textField->getMaxLength());
|
||||
setPasswordEnabled(textField->isPasswordEnabled());
|
||||
|
|
|
@ -64,7 +64,7 @@ ControlButton::~ControlButton()
|
|||
|
||||
bool ControlButton::init()
|
||||
{
|
||||
return this->initWithLabelAndBackgroundSprite(Label::create("", "Helvetica", 12), Scale9Sprite::create());
|
||||
return this->initWithLabelAndBackgroundSprite(Label::createWithFont("", "Helvetica", 12), Scale9Sprite::create());
|
||||
}
|
||||
|
||||
bool ControlButton::initWithLabelAndBackgroundSprite(Node* node, Scale9Sprite* backgroundSprite)
|
||||
|
@ -131,8 +131,7 @@ ControlButton* ControlButton::create(Node* label, Scale9Sprite* backgroundSprite
|
|||
|
||||
bool ControlButton::initWithTitleAndFontNameAndFontSize(const std::string& title, const std::string& fontName, float fontSize)
|
||||
{
|
||||
Label *label = Label::create(title, fontName, fontSize);
|
||||
return initWithLabelAndBackgroundSprite(label, Scale9Sprite::create());
|
||||
return initWithLabelAndBackgroundSprite(Label::createWithFont(title, fontName, fontSize), Scale9Sprite::create());
|
||||
}
|
||||
|
||||
ControlButton* ControlButton::create(const std::string& title, const std::string& fontName, float fontSize)
|
||||
|
@ -145,7 +144,7 @@ ControlButton* ControlButton::create(const std::string& title, const std::string
|
|||
|
||||
bool ControlButton::initWithBackgroundSprite(Scale9Sprite* sprite)
|
||||
{
|
||||
Label *label = Label::create("", "Arial", 30);//
|
||||
Label *label = Label::createWithFont("", "Arial", 30);//
|
||||
return initWithLabelAndBackgroundSprite(label, sprite);
|
||||
}
|
||||
|
||||
|
@ -359,10 +358,9 @@ void ControlButton::setTitleLabelForState(Node* titleLabel, State state)
|
|||
}
|
||||
}
|
||||
|
||||
void ControlButton::setTitleTTFForState(const std::string& fntFile, State state)
|
||||
void ControlButton::setTitleTTFForState(const std::string& fontName, State state)
|
||||
{
|
||||
std::string title = this->getTitleForState(state);
|
||||
this->setTitleLabelForState(Label::create(title, fntFile, 12), state);
|
||||
this->setTitleLabelForState(Label::createWithFont(getTitleForState(state), fontName, 12), state);
|
||||
}
|
||||
|
||||
const std::string& ControlButton::getTitleTTFForState(State state)
|
||||
|
@ -371,7 +369,7 @@ const std::string& ControlButton::getTitleTTFForState(State state)
|
|||
Label* labelTTF = dynamic_cast<Label*>(label);
|
||||
if(labelTTF != 0)
|
||||
{
|
||||
return labelTTF->getFontName();
|
||||
return labelTTF->getFont();
|
||||
}
|
||||
|
||||
static std::string ret("");
|
||||
|
|
|
@ -89,7 +89,7 @@ bool ControlStepper::initWithMinusSpriteAndPlusSprite(Sprite *minusSprite, Sprit
|
|||
_minusSprite->setPosition( Point(minusSprite->getContentSize().width / 2, minusSprite->getContentSize().height / 2) );
|
||||
this->addChild(_minusSprite);
|
||||
|
||||
this->setMinusLabel( Label::create("-", ControlStepperLabelFont, 40));
|
||||
this->setMinusLabel( Label::createWithFont("-", ControlStepperLabelFont, 40));
|
||||
_minusLabel->setColor(ControlStepperLabelColorDisabled);
|
||||
_minusLabel->setAnchorPoint(Point::ANCHOR_MIDDLE);
|
||||
_minusLabel->setPosition(Point(_minusSprite->getContentSize().width / 2, _minusSprite->getContentSize().height / 2) );
|
||||
|
@ -101,7 +101,7 @@ bool ControlStepper::initWithMinusSpriteAndPlusSprite(Sprite *minusSprite, Sprit
|
|||
minusSprite->getContentSize().height / 2) );
|
||||
this->addChild(_plusSprite);
|
||||
|
||||
this->setPlusLabel( Label::create("+", ControlStepperLabelFont, 40 ));
|
||||
this->setPlusLabel( Label::createWithFont("+", ControlStepperLabelFont, 40 ));
|
||||
_plusLabel->setColor( ControlStepperLabelColorEnabled );
|
||||
_plusLabel->setAnchorPoint(Point::ANCHOR_MIDDLE);
|
||||
_plusLabel->setPosition( Point(_plusSprite->getContentSize().width / 2, _plusSprite->getContentSize().height / 2) );
|
||||
|
|
|
@ -94,12 +94,12 @@ bool EditBoxImplWin::initWithSize(const Size& size)
|
|||
void EditBoxImplWin::setFont(const char* pFontName, int fontSize)
|
||||
{
|
||||
if(_label != NULL) {
|
||||
_label->setFontName(pFontName);
|
||||
_label->setFont(pFontName);
|
||||
_label->setFontSize(fontSize);
|
||||
}
|
||||
|
||||
if(_labelPlaceHolder != NULL) {
|
||||
_labelPlaceHolder->setFontName(pFontName);
|
||||
_labelPlaceHolder->setFont(pFontName);
|
||||
_labelPlaceHolder->setFontSize(fontSize);
|
||||
}
|
||||
}
|
||||
|
@ -113,7 +113,7 @@ void EditBoxImplWin::setFontColor(const Color3B& color)
|
|||
void EditBoxImplWin::setPlaceholderFont(const char* pFontName, int fontSize)
|
||||
{
|
||||
if(_labelPlaceHolder != NULL) {
|
||||
_labelPlaceHolder->setFontName(pFontName);
|
||||
_labelPlaceHolder->setFont(pFontName);
|
||||
_labelPlaceHolder->setFontSize(fontSize);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ void AccelerometerTest::onEnter()
|
|||
auto listener = EventListenerAcceleration::create(CC_CALLBACK_2(AccelerometerTest::onAcceleration, this));
|
||||
_eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this);
|
||||
|
||||
auto label = Label::create(title().c_str(), "fonts/arial.ttf", 32.0f);
|
||||
auto label = Label::createWithFont(title().c_str(), "fonts/arial.ttf", 32.0f);
|
||||
addChild(label, 1);
|
||||
label->setPosition( Point(VisibleRect::center().x, VisibleRect::top().y-50) );
|
||||
|
||||
|
|
|
@ -198,7 +198,7 @@ void PauseTest::onEnter()
|
|||
ActionManagerTest::onEnter();
|
||||
|
||||
|
||||
auto l = Label::create("After 5 seconds grossini should move", "fonts/Thonburi.ttf", 16.0f);
|
||||
auto l = Label::createWithFont("After 5 seconds grossini should move", "fonts/Thonburi.ttf", 16.0f);
|
||||
addChild(l);
|
||||
l->setPosition( Point(VisibleRect::center().x, VisibleRect::top().y-75) );
|
||||
|
||||
|
@ -240,7 +240,7 @@ void StopActionTest::onEnter()
|
|||
{
|
||||
ActionManagerTest::onEnter();
|
||||
|
||||
auto l = Label::create("Should not crash", "fonts/Thonburi.ttf", 16.0f);
|
||||
auto l = Label::createWithFont("Should not crash", "fonts/Thonburi.ttf", 16.0f);
|
||||
addChild(l);
|
||||
l->setPosition( Point(VisibleRect::center().x, VisibleRect::top().y - 75) );
|
||||
|
||||
|
@ -281,7 +281,7 @@ void ResumeTest::onEnter()
|
|||
{
|
||||
ActionManagerTest::onEnter();
|
||||
|
||||
auto l = Label::create("Grossini only rotate/scale in 3 seconds", "fonts/Thonburi.ttf", 16.0f);
|
||||
auto l = Label::createWithFont("Grossini only rotate/scale in 3 seconds", "fonts/Thonburi.ttf", 16.0f);
|
||||
addChild(l);
|
||||
l->setPosition( Point(VisibleRect::center().x, VisibleRect::top().y - 75));
|
||||
|
||||
|
|
|
@ -388,7 +388,7 @@ void SpriteProgressBarTintAndFade::onEnter()
|
|||
left->runAction(RepeatForever::create(to->clone()));
|
||||
left->runAction(RepeatForever::create(tint->clone()));
|
||||
|
||||
left->addChild(Label::create("Tint", "fonts/Marker Felt.ttf", 20.0f));
|
||||
left->addChild(Label::createWithFont("Tint", "fonts/Marker Felt.ttf", 20.0f));
|
||||
|
||||
auto middle = ProgressTimer::create(Sprite::create(s_pathSister2));
|
||||
middle->setType(ProgressTimer::Type::BAR);
|
||||
|
@ -401,7 +401,7 @@ void SpriteProgressBarTintAndFade::onEnter()
|
|||
middle->runAction(RepeatForever::create(to->clone()));
|
||||
middle->runAction(RepeatForever::create(fade->clone()));
|
||||
|
||||
middle->addChild(Label::create("Fade", "fonts/Marker Felt.ttf", 20.0f));
|
||||
middle->addChild(Label::createWithFont("Fade", "fonts/Marker Felt.ttf", 20.0f));
|
||||
|
||||
auto right = ProgressTimer::create(Sprite::create(s_pathSister2));
|
||||
right->setType(ProgressTimer::Type::BAR);
|
||||
|
@ -415,7 +415,7 @@ void SpriteProgressBarTintAndFade::onEnter()
|
|||
right->runAction(RepeatForever::create(tint->clone()));
|
||||
right->runAction(RepeatForever::create(fade->clone()));
|
||||
|
||||
right->addChild(Label::create("Tint and Fade", "fonts/Marker Felt.ttf", 20.0f));
|
||||
right->addChild(Label::createWithFont("Tint and Fade", "fonts/Marker Felt.ttf", 20.0f));
|
||||
}
|
||||
|
||||
std::string SpriteProgressBarTintAndFade::subtitle() const
|
||||
|
|
|
@ -398,7 +398,7 @@ void ActionRotationalSkewVSStandardSkew::onEnter()
|
|||
box->setPosition(Point(s.width/2, s.height - 100 - box->getContentSize().height/2));
|
||||
this->addChild(box);
|
||||
|
||||
auto label = Label::create("Standard cocos2d Skew", "fonts/Marker Felt.ttf", 16.0f);
|
||||
auto label = Label::createWithFont("Standard cocos2d Skew", "fonts/Marker Felt.ttf", 16.0f);
|
||||
label->setPosition(Point(s.width/2, s.height - 100 + label->getContentSize().height));
|
||||
this->addChild(label);
|
||||
|
||||
|
@ -414,7 +414,7 @@ void ActionRotationalSkewVSStandardSkew::onEnter()
|
|||
box->setPosition(Point(s.width/2, s.height - 250 - box->getContentSize().height/2));
|
||||
this->addChild(box);
|
||||
|
||||
label = Label::create("Rotational Skew", "fonts/Marker Felt.ttf", 16.0f);
|
||||
label = Label::createWithFont("Rotational Skew", "fonts/Marker Felt.ttf", 16.0f);
|
||||
label->setPosition(Point(s.width/2, s.height - 250 + label->getContentSize().height/2));
|
||||
this->addChild(label);
|
||||
auto actionTo2 = RotateBy::create(2, 360, 0);
|
||||
|
@ -811,7 +811,7 @@ void ActionSequence2::onEnter()
|
|||
void ActionSequence2::callback1()
|
||||
{
|
||||
auto s = Director::getInstance()->getWinSize();
|
||||
auto label = Label::create("callback 1 called", "fonts/Marker Felt.ttf", 16.0f);
|
||||
auto label = Label::createWithFont("callback 1 called", "fonts/Marker Felt.ttf", 16.0f);
|
||||
label->setPosition(Point( s.width/4*1,s.height/2));
|
||||
|
||||
addChild(label);
|
||||
|
@ -820,7 +820,7 @@ void ActionSequence2::callback1()
|
|||
void ActionSequence2::callback2(Node* sender)
|
||||
{
|
||||
auto s = Director::getInstance()->getWinSize();
|
||||
auto label = Label::create("callback 2 called", "fonts/Marker Felt.ttf", 16.0f);
|
||||
auto label = Label::createWithFont("callback 2 called", "fonts/Marker Felt.ttf", 16.0f);
|
||||
label->setPosition(Point( s.width/4*2,s.height/2));
|
||||
|
||||
addChild(label);
|
||||
|
@ -829,7 +829,7 @@ void ActionSequence2::callback2(Node* sender)
|
|||
void ActionSequence2::callback3(Node* sender, long data)
|
||||
{
|
||||
auto s = Director::getInstance()->getWinSize();
|
||||
auto label = Label::create("callback 3 called", "fonts/Marker Felt.ttf", 16.0f);
|
||||
auto label = Label::createWithFont("callback 3 called", "fonts/Marker Felt.ttf", 16.0f);
|
||||
label->setPosition(Point( s.width/4*3,s.height/2));
|
||||
|
||||
addChild(label);
|
||||
|
@ -962,7 +962,7 @@ void ActionCallFunction::onEnter()
|
|||
// lambda
|
||||
[&](){
|
||||
auto s = Director::getInstance()->getWinSize();
|
||||
auto label = Label::create("called:lambda callback", "fonts/Marker Felt.ttf", 16.0f);
|
||||
auto label = Label::createWithFont("called:lambda callback", "fonts/Marker Felt.ttf", 16.0f);
|
||||
label->setPosition(Point( s.width/4*1,s.height/2-40));
|
||||
this->addChild(label);
|
||||
} ),
|
||||
|
@ -989,7 +989,7 @@ void ActionCallFunction::onEnter()
|
|||
void ActionCallFunction::callback1()
|
||||
{
|
||||
auto s = Director::getInstance()->getWinSize();
|
||||
auto label = Label::create("callback 1 called", "fonts/Marker Felt.ttf", 16.0f);
|
||||
auto label = Label::createWithFont("callback 1 called", "fonts/Marker Felt.ttf", 16.0f);
|
||||
label->setPosition(Point( s.width/4*1,s.height/2));
|
||||
|
||||
addChild(label);
|
||||
|
@ -998,7 +998,7 @@ void ActionCallFunction::callback1()
|
|||
void ActionCallFunction::callback2(Node* sender)
|
||||
{
|
||||
auto s = Director::getInstance()->getWinSize();
|
||||
auto label = Label::create("callback 2 called", "fonts/Marker Felt.ttf", 16.0f);
|
||||
auto label = Label::createWithFont("callback 2 called", "fonts/Marker Felt.ttf", 16.0f);
|
||||
label->setPosition(Point( s.width/4*2,s.height/2));
|
||||
|
||||
addChild(label);
|
||||
|
@ -1009,7 +1009,7 @@ void ActionCallFunction::callback2(Node* sender)
|
|||
void ActionCallFunction::callback3(Node* sender, long data)
|
||||
{
|
||||
auto s = Director::getInstance()->getWinSize();
|
||||
auto label = Label::create("callback 3 called", "fonts/Marker Felt.ttf", 16.0f);
|
||||
auto label = Label::createWithFont("callback 3 called", "fonts/Marker Felt.ttf", 16.0f);
|
||||
label->setPosition(Point( s.width/4*3,s.height/2));
|
||||
addChild(label);
|
||||
|
||||
|
|
|
@ -43,14 +43,14 @@ Box2DTestLayer::Box2DTestLayer()
|
|||
|
||||
addNewSpriteAtPosition(VisibleRect::center());
|
||||
|
||||
auto label = Label::create("Tap screen", "fonts/Marker Felt.ttf", 32.0f);
|
||||
auto label = Label::createWithFont("Tap screen", "fonts/Marker Felt.ttf", 32.0f);
|
||||
addChild(label, 0);
|
||||
label->setColor(Color3B(0,0,255));
|
||||
label->setPosition(Point( VisibleRect::center().x, VisibleRect::top().y-50));
|
||||
|
||||
scheduleUpdate();
|
||||
#else
|
||||
auto label = Label::create("Should define CC_ENABLE_BOX2D_INTEGRATION=1\n to run this test case",
|
||||
auto label = Label::createWithFont("Should define CC_ENABLE_BOX2D_INTEGRATION=1\n to run this test case",
|
||||
"fonts/arial.ttf",
|
||||
18);
|
||||
auto size = Director::getInstance()->getWinSize();
|
||||
|
|
|
@ -59,7 +59,7 @@ bool MenuLayer::initWithEntryID(int entryId)
|
|||
view->setScale(15);
|
||||
view->setAnchorPoint( Point(0,0) );
|
||||
view->setPosition( Point(visibleOrigin.x+visibleSize.width/2, visibleOrigin.y+visibleSize.height/3) );
|
||||
auto label = Label::create(view->title().c_str(), "fonts/arial.ttf", 28);
|
||||
auto label = Label::createWithFont(view->title().c_str(), "fonts/arial.ttf", 28);
|
||||
addChild(label, 1);
|
||||
label->setPosition( Point(visibleOrigin.x+visibleSize.width/2, visibleOrigin.y+visibleSize.height-50) );
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ bool Bug1159Layer::init()
|
|||
sprite_b->setPosition(Point(s.width/2, s.height/2));
|
||||
addChild(sprite_b);
|
||||
|
||||
auto label = MenuItemLabel::create(Label::create("Flip Me", "Helvetica", 24), CC_CALLBACK_1(Bug1159Layer::callBack, this) );
|
||||
auto label = MenuItemLabel::create(Label::createWithFont("Flip Me", "Helvetica", 24), CC_CALLBACK_1(Bug1159Layer::callBack, this) );
|
||||
auto menu = Menu::create(label, NULL);
|
||||
menu->setPosition(Point(s.width - 200.0f, 50.0f));
|
||||
addChild(menu);
|
||||
|
|
|
@ -9,7 +9,7 @@ bool QuestionContainerSprite::init()
|
|||
if (Sprite::init())
|
||||
{
|
||||
//Add label
|
||||
auto label = Label::create("Answer 1", "fonts/arial.ttf", 12);
|
||||
auto label = Label::createWithFont("Answer 1", "fonts/arial.ttf", 12);
|
||||
label->setTag(100);
|
||||
|
||||
//Add the background
|
||||
|
|
|
@ -20,7 +20,7 @@ bool Bug624Layer::init()
|
|||
if(BugsTestBaseLayer::init())
|
||||
{
|
||||
auto size = Director::getInstance()->getWinSize();
|
||||
auto label = Label::create("Layer1", "fonts/Marker Felt.ttf", 36.0f);
|
||||
auto label = Label::createWithFont("Layer1", "fonts/Marker Felt.ttf", 36.0f);
|
||||
|
||||
label->setPosition(Point(size.width/2, size.height/2));
|
||||
addChild(label);
|
||||
|
@ -66,7 +66,7 @@ bool Bug624Layer2::init()
|
|||
if(BugsTestBaseLayer::init())
|
||||
{
|
||||
auto size = Director::getInstance()->getWinSize();
|
||||
auto label = Label::create("Layer2", "fonts/Marker Felt.ttf", 36.0f);
|
||||
auto label = Label::createWithFont("Layer2", "fonts/Marker Felt.ttf", 36.0f);
|
||||
|
||||
label->setPosition(Point(size.width/2, size.height/2));
|
||||
addChild(label);
|
||||
|
|
|
@ -49,7 +49,7 @@ bool Bug914Layer::init()
|
|||
}
|
||||
|
||||
// create and initialize a Label
|
||||
auto label = Label::create("Hello World", "fonts/Marker Felt.ttf", 64.0f);
|
||||
auto label = Label::createWithFont("Hello World", "fonts/Marker Felt.ttf", 64.0f);
|
||||
auto item1 = MenuItemFont::create("restart", CC_CALLBACK_1(Bug914Layer::restart, this));
|
||||
|
||||
auto menu = Menu::create(item1, NULL);
|
||||
|
|
|
@ -31,7 +31,7 @@ ChipmunkTestLayer::ChipmunkTestLayer()
|
|||
_eventDispatcher->addEventListenerWithSceneGraphPriority(accListener, this);
|
||||
|
||||
// title
|
||||
auto label = Label::create("Multi touch the screen", "fonts/Marker Felt.ttf", 36.0f);
|
||||
auto label = Label::createWithFont("Multi touch the screen", "fonts/Marker Felt.ttf", 36.0f);
|
||||
label->setPosition(cocos2d::Point( VisibleRect::center().x, VisibleRect::top().y - 30));
|
||||
this->addChild(label, -1);
|
||||
|
||||
|
@ -64,7 +64,7 @@ ChipmunkTestLayer::ChipmunkTestLayer()
|
|||
|
||||
scheduleUpdate();
|
||||
#else
|
||||
auto label = Label::create("Should define CC_ENABLE_CHIPMUNK_INTEGRATION=1\n to run this test case",
|
||||
auto label = Label::createWithFont("Should define CC_ENABLE_CHIPMUNK_INTEGRATION=1\n to run this test case",
|
||||
"fonts/arial.ttf",
|
||||
18);
|
||||
auto size = Director::getInstance()->getWinSize();
|
||||
|
|
|
@ -827,7 +827,7 @@ void RawStencilBufferTest6::setup()
|
|||
glClear(GL_STENCIL_BUFFER_BIT);
|
||||
glFlush();
|
||||
glReadPixels(0, 0, 1, 1, GL_STENCIL_INDEX, GL_UNSIGNED_BYTE, &bits);
|
||||
auto clearToZeroLabel = Label::create(String::createWithFormat("00=%02x", bits[0])->getCString(), "fonts/arial.ttf", 20);
|
||||
auto clearToZeroLabel = Label::createWithFont(String::createWithFormat("00=%02x", bits[0])->getCString(), "fonts/arial.ttf", 20);
|
||||
clearToZeroLabel->setPosition( Point((winPoint.x / 3) * 1, winPoint.y - 10) );
|
||||
this->addChild(clearToZeroLabel);
|
||||
glStencilMask(0x0F);
|
||||
|
@ -835,7 +835,7 @@ void RawStencilBufferTest6::setup()
|
|||
glClear(GL_STENCIL_BUFFER_BIT);
|
||||
glFlush();
|
||||
glReadPixels(0, 0, 1, 1, GL_STENCIL_INDEX, GL_UNSIGNED_BYTE, &bits);
|
||||
auto clearToMaskLabel = Label::create(String::createWithFormat("0a=%02x", bits[0])->getCString(), "fonts/arial.ttf", 20);
|
||||
auto clearToMaskLabel = Label::createWithFont(String::createWithFormat("0a=%02x", bits[0])->getCString(), "fonts/arial.ttf", 20);
|
||||
clearToMaskLabel->setPosition( Point((winPoint.x / 3) * 2, winPoint.y - 10) );
|
||||
this->addChild(clearToMaskLabel);
|
||||
#endif
|
||||
|
|
|
@ -91,7 +91,7 @@ private:
|
|||
|
||||
bool initTextButton(const char *text)
|
||||
{
|
||||
_child = Label::create(text, "fonts/arial.ttf", 16);
|
||||
_child = Label::createWithFont(text, "fonts/arial.ttf", 16);
|
||||
addChild(_child);
|
||||
return true;
|
||||
}
|
||||
|
@ -172,7 +172,7 @@ public:
|
|||
|
||||
sprintf(buffer, "%.2f", minValue);
|
||||
if (!_lblMinValue) {
|
||||
_lblMinValue = Label::create(buffer, "fonts/arial.ttf", 8);
|
||||
_lblMinValue = Label::createWithFont(buffer, "fonts/arial.ttf", 8);
|
||||
addChild(_lblMinValue);
|
||||
if (_direction == Vertical)
|
||||
_lblMinValue->setPosition(Point(12.0, -50.0));
|
||||
|
@ -184,7 +184,7 @@ public:
|
|||
|
||||
sprintf(buffer, "%.2f", maxValue);
|
||||
if (!_lblMaxValue) {
|
||||
_lblMaxValue = Label::create(buffer, "fonts/arial.ttf", 8);
|
||||
_lblMaxValue = Label::createWithFont(buffer, "fonts/arial.ttf", 8);
|
||||
addChild(_lblMaxValue);
|
||||
if (_direction == Vertical)
|
||||
_lblMaxValue->setPosition(Point(12.0, 50.0));
|
||||
|
@ -256,7 +256,7 @@ void CocosDenshionTest::onExit()
|
|||
|
||||
void CocosDenshionTest::addButtons()
|
||||
{
|
||||
auto lblMusic = Label::create("Control Music", "fonts/arial.ttf", 24);
|
||||
auto lblMusic = Label::createWithFont("Control Music", "fonts/arial.ttf", 24);
|
||||
addChildAt(lblMusic, 0.25f, 0.9f);
|
||||
|
||||
Button *btnPlay = Button::createWithText("play");
|
||||
|
@ -298,7 +298,7 @@ void CocosDenshionTest::addButtons()
|
|||
});
|
||||
addChildAt(btnIsPlayingMusic, 0.4f, 0.65f);
|
||||
|
||||
auto lblSound = Label::create("Control Effects", "fonts/arial.ttf", 24);
|
||||
auto lblSound = Label::createWithFont("Control Effects", "fonts/arial.ttf", 24);
|
||||
addChildAt(lblSound, 0.75f, 0.9f);
|
||||
|
||||
Button *btnPlayEffect = Button::createWithText("play");
|
||||
|
@ -364,31 +364,31 @@ void CocosDenshionTest::addButtons()
|
|||
|
||||
void CocosDenshionTest::addSliders()
|
||||
{
|
||||
auto lblPitch = Label::create("Pitch", "fonts/arial.ttf", 14);
|
||||
auto lblPitch = Label::createWithFont("Pitch", "fonts/arial.ttf", 14);
|
||||
addChildAt(lblPitch, 0.67f, 0.4f);
|
||||
_sliderPitch = AudioSlider::create(AudioSlider::Horizontal);
|
||||
_sliderPitch->setValue(0.5, 2, 1);
|
||||
addChildAt(_sliderPitch, 0.85f, 0.4f);
|
||||
|
||||
auto lblPan = Label::create("Pan", "fonts/arial.ttf", 14);
|
||||
auto lblPan = Label::createWithFont("Pan", "fonts/arial.ttf", 14);
|
||||
addChildAt(lblPan, 0.67f, 0.3f);
|
||||
_sliderPan = AudioSlider::create(AudioSlider::Horizontal);
|
||||
_sliderPan->setValue(-1, 1, 0);
|
||||
addChildAt(_sliderPan, 0.85f, 0.3f);
|
||||
|
||||
auto lblGain = Label::create("Gain", "fonts/arial.ttf", 14);
|
||||
auto lblGain = Label::createWithFont("Gain", "fonts/arial.ttf", 14);
|
||||
addChildAt(lblGain, 0.67f, 0.2f);
|
||||
_sliderGain = AudioSlider::create(AudioSlider::Horizontal);
|
||||
_sliderGain->setValue(0, 1, 1);
|
||||
addChildAt(_sliderGain, 0.85f, 0.2f);
|
||||
|
||||
auto lblEffectsVolume = Label::create("Effects Volume", "fonts/arial.ttf", 14);
|
||||
auto lblEffectsVolume = Label::createWithFont("Effects Volume", "fonts/arial.ttf", 14);
|
||||
addChildAt(lblEffectsVolume, 0.62f, 0.5f);
|
||||
_sliderEffectsVolume = AudioSlider::create(AudioSlider::Horizontal);
|
||||
_sliderEffectsVolume->setValue(0, 1, 1);
|
||||
addChildAt(_sliderEffectsVolume, 0.85f, 0.5f);
|
||||
|
||||
auto lblMusicVolume = Label::create("Music Volume", "fonts/arial.ttf", 14);
|
||||
auto lblMusicVolume = Label::createWithFont("Music Volume", "fonts/arial.ttf", 14);
|
||||
addChildAt(lblMusicVolume, 0.12f, 0.5f);
|
||||
_sliderMusicVolume = AudioSlider::create(AudioSlider::Horizontal);
|
||||
_sliderMusicVolume->setValue(0, 1, 1);
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
CurlTest::CurlTest()
|
||||
{
|
||||
auto label = Label::create("Curl Test", "fonts/arial.ttf", 28);
|
||||
auto label = Label::createWithFont("Curl Test", "fonts/arial.ttf", 28);
|
||||
addChild(label, 0);
|
||||
label->setPosition( Point(VisibleRect::center().x, VisibleRect::top().y-50) );
|
||||
|
||||
|
@ -14,7 +14,7 @@ CurlTest::CurlTest()
|
|||
_eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this);
|
||||
|
||||
// create a label to display the tip string
|
||||
_label = Label::create("Touch the screen to connect", "fonts/arial.ttf", 22);
|
||||
_label = Label::createWithFont("Touch the screen to connect", "fonts/arial.ttf", 22);
|
||||
_label->setPosition(VisibleRect::center());
|
||||
addChild(_label, 0);
|
||||
|
||||
|
|
|
@ -2,11 +2,11 @@
|
|||
|
||||
CurrentLanguageTest::CurrentLanguageTest()
|
||||
{
|
||||
auto label = Label::create("Current language Test", "fonts/arial.ttf", 28);
|
||||
auto label = Label::createWithFont("Current language Test", "fonts/arial.ttf", 28);
|
||||
addChild(label, 0);
|
||||
label->setPosition( Point(VisibleRect::center().x, VisibleRect::top().y-50) );
|
||||
|
||||
auto labelLanguage = Label::create("", "fonts/arial.ttf", 20);
|
||||
auto labelLanguage = Label::createWithFont("", "fonts/arial.ttf", 20);
|
||||
labelLanguage->setPosition(VisibleRect::center());
|
||||
|
||||
LanguageType currentLanguageType = Application::getInstance()->getCurrentLanguage();
|
||||
|
|
|
@ -39,14 +39,14 @@ void PrettyPrinterDemo::onEnter()
|
|||
Layer::onEnter();
|
||||
auto s = Director::getInstance()->getWinSize();
|
||||
|
||||
auto label = Label::create(title().c_str(), "fonts/arial.ttf", 28);
|
||||
auto label = Label::createWithFont(title().c_str(), "fonts/arial.ttf", 28);
|
||||
label->setPosition( Point(s.width/2, s.height * 4/5) );
|
||||
this->addChild(label, 1);
|
||||
|
||||
std::string strSubtitle = subtitle();
|
||||
if(strSubtitle.empty() == false)
|
||||
{
|
||||
auto subLabel = Label::create(strSubtitle.c_str(), "fonts/Thonburi.ttf", 16);
|
||||
auto subLabel = Label::createWithFont(strSubtitle.c_str(), "fonts/Thonburi.ttf", 16);
|
||||
subLabel->setPosition( Point(s.width/2, s.height * 3/5) );
|
||||
this->addChild(subLabel, 1);
|
||||
}
|
||||
|
|
|
@ -366,7 +366,7 @@ TextLayer::TextLayer(void)
|
|||
auto sc2_back = sc2->reverse();
|
||||
tamara->runAction( RepeatForever::create(Sequence::create(sc2, sc2_back, NULL)) );
|
||||
|
||||
auto label = Label::create((effectsList[actionIdx]).c_str(), "fonts/Marker Felt.ttf", 32);
|
||||
auto label = Label::createWithFont((effectsList[actionIdx]).c_str(), "fonts/Marker Felt.ttf", 32);
|
||||
|
||||
label->setPosition( Point(VisibleRect::center().x,VisibleRect::top().y-80) );
|
||||
addChild(label);
|
||||
|
|
|
@ -160,7 +160,7 @@ void ArmatureTestLayer::onEnter()
|
|||
// add title and subtitle
|
||||
std::string str = title();
|
||||
const char *pTitle = str.c_str();
|
||||
auto label = Label::create(pTitle, "fonts/arial.ttf", 18);
|
||||
auto label = Label::createWithFont(pTitle, "fonts/arial.ttf", 18);
|
||||
label->setColor(Color3B::BLACK);
|
||||
addChild(label, 1, 10000);
|
||||
label->setPosition( Point(VisibleRect::center().x, VisibleRect::top().y - 30) );
|
||||
|
@ -168,7 +168,7 @@ void ArmatureTestLayer::onEnter()
|
|||
std::string strSubtitle = subtitle();
|
||||
if( ! strSubtitle.empty() )
|
||||
{
|
||||
auto l = Label::create(strSubtitle.c_str(), "fonts/arial.ttf", 18);
|
||||
auto l = Label::createWithFont(strSubtitle.c_str(), "fonts/arial.ttf", 18);
|
||||
l->setColor(Color3B::BLACK);
|
||||
addChild(l, 1, 10001);
|
||||
l->setPosition( Point(VisibleRect::center().x, VisibleRect::top().y - 60) );
|
||||
|
@ -703,7 +703,7 @@ void TestUseMutiplePicture::onEnter()
|
|||
// armature->getBone("weapon")->addDisplay(&displayData, i);
|
||||
// }
|
||||
|
||||
auto l = Label::create("This is a weapon!", "fonts/arial.ttf", 18);
|
||||
auto l = Label::createWithFont("This is a weapon!", "fonts/arial.ttf", 18);
|
||||
l->setAnchorPoint(Point(0.2f, 0.5f));
|
||||
armature->getBone("weapon")->addDisplay(l, 7);
|
||||
}
|
||||
|
@ -1275,7 +1275,7 @@ void TestArmatureNesting2::onEnter()
|
|||
|
||||
touchedMenu = false;
|
||||
|
||||
auto label = Label::create("Change Mount", "fonts/arial.ttf", 20);
|
||||
auto label = Label::createWithFont("Change Mount", "fonts/arial.ttf", 20);
|
||||
MenuItemLabel* pMenuItem = CCMenuItemLabel::create(label, CC_CALLBACK_1(TestArmatureNesting2::changeMountCallback, this));
|
||||
|
||||
Menu* pMenu =Menu::create(pMenuItem, nullptr);
|
||||
|
|
|
@ -60,7 +60,7 @@ bool GameOverLayer::init()
|
|||
if ( LayerColor::initWithColor( Color4B(255,255,255,255) ) )
|
||||
{
|
||||
auto winSize = Director::getInstance()->getWinSize();
|
||||
this->_label = Label::create("","fonts/arial.ttf", 32);
|
||||
this->_label = Label::createWithFont("","fonts/arial.ttf", 32);
|
||||
_label->retain();
|
||||
_label->setColor( Color3B(0, 0, 0) );
|
||||
_label->setPosition( Point(winSize.width/2, winSize.height/2) );
|
||||
|
|
|
@ -133,7 +133,7 @@ void CocoStudioGUITestScene::onEnter()
|
|||
{
|
||||
CCScene::onEnter();
|
||||
|
||||
auto label = Label::create("Back", "fonts/arial.ttf", 20);
|
||||
auto label = Label::createWithFont("Back", "fonts/arial.ttf", 20);
|
||||
//#endif
|
||||
MenuItemLabel* pMenuItem = MenuItemLabel::create(label, CC_CALLBACK_1(CocoStudioGUITestScene::BackCallback, this));
|
||||
|
||||
|
|
|
@ -348,7 +348,7 @@ void CocosGUITestScene::onEnter()
|
|||
{
|
||||
Scene::onEnter();
|
||||
|
||||
auto label = Label::create("Back", "fonts/arial.ttf", 20);
|
||||
auto label = Label::createWithFont("Back", "fonts/arial.ttf", 20);
|
||||
//#endif
|
||||
auto pMenuItem = MenuItemLabel::create(label, CC_CALLBACK_1(CocosGUITestScene::BackCallback, this));
|
||||
|
||||
|
|
|
@ -118,7 +118,7 @@ void CustomGUITestScene::onEnter()
|
|||
{
|
||||
CCScene::onEnter();
|
||||
|
||||
auto label = Label::create("Back", "fonts/arial.ttf", 20);
|
||||
auto label = Label::createWithFont("Back", "fonts/arial.ttf", 20);
|
||||
//#endif
|
||||
MenuItemLabel* pMenuItem = MenuItemLabel::create(label, CC_CALLBACK_1(CustomGUITestScene::BackCallback, this));
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ void CustomImageScene::onEnter()
|
|||
{
|
||||
CCScene::onEnter();
|
||||
|
||||
auto label = Label::create("Back", "fonts/arial.ttf", 20);
|
||||
auto label = Label::createWithFont("Back", "fonts/arial.ttf", 20);
|
||||
//#endif
|
||||
MenuItemLabel* pMenuItem = MenuItemLabel::create(label, CC_CALLBACK_1(CustomImageScene::BackCallback, this));
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ void CustomParticleWidgetScene::onEnter()
|
|||
addChild(pLayer);
|
||||
pLayer->release();
|
||||
|
||||
auto label = Label::create("Back", "fonts/arial.ttf", 20);
|
||||
auto label = Label::createWithFont("Back", "fonts/arial.ttf", 20);
|
||||
//#endif
|
||||
MenuItemLabel* pMenuItem = MenuItemLabel::create(label, CC_CALLBACK_1(CustomParticleWidgetScene::BackCallback, this));
|
||||
|
||||
|
|
|
@ -333,7 +333,7 @@ void GUIEditorTestScene::onEnter()
|
|||
{
|
||||
Scene::onEnter();
|
||||
|
||||
auto label = Label::create("Back", "fonts/arial.ttf", 20);
|
||||
auto label = Label::createWithFont("Back", "fonts/arial.ttf", 20);
|
||||
|
||||
auto pMenuItem = MenuItemLabel::create(label, CC_CALLBACK_1(GUIEditorTestScene::BackCallback, this));
|
||||
|
||||
|
|
|
@ -114,7 +114,7 @@ void SceneEditorTestLayer::onEnter()
|
|||
// add title and subtitle
|
||||
std::string str = title();
|
||||
const char *pTitle = str.c_str();
|
||||
auto label = Label::create(pTitle, "fonts/arial.ttf", 18);
|
||||
auto label = Label::createWithFont(pTitle, "fonts/arial.ttf", 18);
|
||||
label->setTextColor(Color4B::WHITE);
|
||||
addChild(label, 1, 10000);
|
||||
label->setPosition( Point(VisibleRect::center().x, VisibleRect::top().y - 30) );
|
||||
|
@ -122,7 +122,7 @@ void SceneEditorTestLayer::onEnter()
|
|||
std::string strSubtitle = subtitle();
|
||||
if( ! strSubtitle.empty() )
|
||||
{
|
||||
auto l = Label::create(strSubtitle.c_str(), "fonts/arial.ttf", 18);
|
||||
auto l = Label::createWithFont(strSubtitle.c_str(), "fonts/arial.ttf", 18);
|
||||
l->setTextColor(Color4B::BLACK);
|
||||
addChild(l, 1, 10001);
|
||||
l->setPosition(Point(VisibleRect::center().x, VisibleRect::top().y - 60) );
|
||||
|
|
|
@ -94,7 +94,7 @@ ControlButton *ControlButtonTest_HelloVariableSize::standardButtonWithTitle(cons
|
|||
auto backgroundButton = Scale9Sprite::create("extensions/button.png");
|
||||
auto backgroundHighlightedButton = Scale9Sprite::create("extensions/buttonHighlighted.png");
|
||||
|
||||
auto titleButton = Label::create(title, "fonts/Marker Felt.ttf", 30);
|
||||
auto titleButton = Label::createWithFont(title, "fonts/Marker Felt.ttf", 30);
|
||||
|
||||
titleButton->setColor(Color3B(159, 168, 176));
|
||||
|
||||
|
@ -125,12 +125,12 @@ bool ControlButtonTest_Event::init()
|
|||
auto screenSize = Director::getInstance()->getWinSize();
|
||||
|
||||
// Add a label in which the button events will be displayed
|
||||
setDisplayValueLabel(Label::create("No Event", "fonts/Marker Felt.ttf", 32));
|
||||
setDisplayValueLabel(Label::createWithFont("No Event", "fonts/Marker Felt.ttf", 32));
|
||||
_displayValueLabel->setAnchorPoint(Point(0.5f, -1));
|
||||
_displayValueLabel->setPosition(Point(screenSize.width / 2.0f, screenSize.height / 2.0f));
|
||||
addChild(_displayValueLabel, 1);
|
||||
|
||||
setDisplayBitmaskLabel(Label::create("No bitmask event", "fonts/Marker Felt.ttf", 24));
|
||||
setDisplayBitmaskLabel(Label::createWithFont("No bitmask event", "fonts/Marker Felt.ttf", 24));
|
||||
_displayBitmaskLabel->setAnchorPoint(Point(0.5f, -1));
|
||||
Point bitmaskLabelPos = _displayValueLabel->getPosition() - Point(0, _displayBitmaskLabel->getBoundingBox().size.height);
|
||||
_displayBitmaskLabel->setPosition(bitmaskLabelPos);
|
||||
|
@ -140,7 +140,7 @@ bool ControlButtonTest_Event::init()
|
|||
auto backgroundButton = Scale9Sprite::create("extensions/button.png");
|
||||
auto backgroundHighlightedButton = Scale9Sprite::create("extensions/buttonHighlighted.png");
|
||||
|
||||
auto titleButton = Label::create("Touch Me!", "fonts/Marker Felt.ttf", 30);
|
||||
auto titleButton = Label::createWithFont("Touch Me!", "fonts/Marker Felt.ttf", 30);
|
||||
|
||||
titleButton->setColor(Color3B(159, 168, 176));
|
||||
|
||||
|
@ -278,7 +278,7 @@ ControlButton *ControlButtonTest_Styling::standardButtonWithTitle(const char *ti
|
|||
auto backgroundHighlightedButton = Scale9Sprite::create("extensions/buttonHighlighted.png");
|
||||
backgroundHighlightedButton->setPreferredSize(Size(45, 45)); // Set the prefered size
|
||||
|
||||
auto titleButton = Label::create(title, "fonts/Marker Felt.ttf", 30);
|
||||
auto titleButton = Label::createWithFont(title, "fonts/Marker Felt.ttf", 30);
|
||||
|
||||
titleButton->setColor(Color3B(159, 168, 176));
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ bool ControlColourPickerTest::init()
|
|||
|
||||
layer_width += background->getContentSize().width;
|
||||
|
||||
_colorLabel = Label::create("#color", "fonts/Marker Felt.ttf", 30);
|
||||
_colorLabel = Label::createWithFont("#color", "fonts/Marker Felt.ttf", 30);
|
||||
_colorLabel->retain();
|
||||
|
||||
_colorLabel->setPosition(background->getPosition());
|
||||
|
|
|
@ -55,7 +55,7 @@ bool ControlPotentiometerTest::init()
|
|||
|
||||
layer_width += background->getContentSize().width;
|
||||
|
||||
this->setDisplayValueLabel(Label::create("", "HelveticaNeue-Bold", 30));
|
||||
this->setDisplayValueLabel(Label::createWithFont("", "HelveticaNeue-Bold", 30));
|
||||
|
||||
_displayValueLabel->setPosition(background->getPosition());
|
||||
layer->addChild(_displayValueLabel);
|
||||
|
|
|
@ -60,7 +60,7 @@ bool ControlScene::init()
|
|||
addChild(ribbon);
|
||||
|
||||
// Add the title
|
||||
setSceneTitleLabel(Label::create("Title", "fonts/arial.ttf", 12));
|
||||
setSceneTitleLabel(Label::createWithFont("Title", "fonts/arial.ttf", 12));
|
||||
_sceneTitleLabel->setPosition(Point (VisibleRect::center().x, VisibleRect::top().y - _sceneTitleLabel->getContentSize().height / 2 - 5));
|
||||
addChild(_sceneTitleLabel, 1);
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ bool ControlSliderTest::init()
|
|||
auto screenSize = Director::getInstance()->getWinSize();
|
||||
|
||||
// Add a label in which the slider value will be displayed
|
||||
_displayValueLabel = Label::create("Move the slider thumb!\nThe lower slider is restricted." ,"fonts/Marker Felt.ttf", 32);
|
||||
_displayValueLabel = Label::createWithFont("Move the slider thumb!\nThe lower slider is restricted." ,"fonts/Marker Felt.ttf", 32);
|
||||
_displayValueLabel->retain();
|
||||
_displayValueLabel->setAnchorPoint(Point(0.5f, -1.0f));
|
||||
_displayValueLabel->setPosition(Point(screenSize.width / 1.7f, screenSize.height / 2.0f));
|
||||
|
|
|
@ -54,7 +54,7 @@ bool ControlStepperTest::init()
|
|||
background->setPosition(Point(layer_width + background->getContentSize().width / 2.0f, 0));
|
||||
layer->addChild(background);
|
||||
|
||||
this->setDisplayValueLabel(Label::create("0", "HelveticaNeue-Bold", 30));
|
||||
this->setDisplayValueLabel(Label::createWithFont("0", "HelveticaNeue-Bold", 30));
|
||||
|
||||
_displayValueLabel->setPosition(background->getPosition());
|
||||
layer->addChild(_displayValueLabel);
|
||||
|
|
|
@ -51,7 +51,7 @@ bool ControlSwitchTest::init()
|
|||
|
||||
layer_width += background->getContentSize().width;
|
||||
|
||||
_displayValueLabel = Label::create("#color" ,"fonts/Marker Felt.ttf" ,30);
|
||||
_displayValueLabel = Label::createWithFont("#color" ,"fonts/Marker Felt.ttf" ,30);
|
||||
_displayValueLabel->retain();
|
||||
|
||||
_displayValueLabel->setPosition(background->getPosition());
|
||||
|
@ -64,8 +64,8 @@ bool ControlSwitchTest::init()
|
|||
Sprite::create("extensions/switch-on.png"),
|
||||
Sprite::create("extensions/switch-off.png"),
|
||||
Sprite::create("extensions/switch-thumb.png"),
|
||||
Label::create("On", "Arial-BoldMT", 16),
|
||||
Label::create("Off", "Arial-BoldMT", 16)
|
||||
Label::createWithFont("On", "Arial-BoldMT", 16),
|
||||
Label::createWithFont("Off", "Arial-BoldMT", 16)
|
||||
);
|
||||
switchControl->setPosition(Point(layer_width + 10 + switchControl->getContentSize().width / 2, 0));
|
||||
layer->addChild(switchControl);
|
||||
|
|
|
@ -23,7 +23,7 @@ EditBoxTest::EditBoxTest()
|
|||
pBg->setPosition(Point(visibleOrigin.x+visibleSize.width/2, visibleOrigin.y+visibleSize.height/2));
|
||||
addChild(pBg);
|
||||
|
||||
_TTFShowEditReturn = Label::create("No edit control return!", "", 30);
|
||||
_TTFShowEditReturn = Label::createWithFont("No edit control return!", "", 30);
|
||||
_TTFShowEditReturn->setPosition(Point(visibleOrigin.x+visibleSize.width/2, visibleOrigin.y + visibleSize.height - 50));
|
||||
addChild(_TTFShowEditReturn);
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ HttpClientTest::HttpClientTest()
|
|||
const int MARGIN = 40;
|
||||
const int SPACE = 35;
|
||||
|
||||
auto label = Label::create("Http Request Test", "fonts/arial.ttf", 28);
|
||||
auto label = Label::createWithFont("Http Request Test", "fonts/arial.ttf", 28);
|
||||
label->setPosition(Point(winSize.width / 2, winSize.height - MARGIN));
|
||||
addChild(label, 0);
|
||||
|
||||
|
@ -23,37 +23,37 @@ HttpClientTest::HttpClientTest()
|
|||
addChild(menuRequest);
|
||||
|
||||
// Get
|
||||
auto labelGet = Label::create("Test Get", "fonts/arial.ttf", 22);
|
||||
auto labelGet = Label::createWithFont("Test Get", "fonts/arial.ttf", 22);
|
||||
auto itemGet = MenuItemLabel::create(labelGet, CC_CALLBACK_1(HttpClientTest::onMenuGetTestClicked, this));
|
||||
itemGet->setPosition(Point(winSize.width / 2, winSize.height - MARGIN - SPACE));
|
||||
menuRequest->addChild(itemGet);
|
||||
|
||||
// Post
|
||||
auto labelPost = Label::create("Test Post", "fonts/arial.ttf", 22);
|
||||
auto labelPost = Label::createWithFont("Test Post", "fonts/arial.ttf", 22);
|
||||
auto itemPost = MenuItemLabel::create(labelPost, CC_CALLBACK_1(HttpClientTest::onMenuPostTestClicked, this));
|
||||
itemPost->setPosition(Point(winSize.width / 2, winSize.height - MARGIN - 2 * SPACE));
|
||||
menuRequest->addChild(itemPost);
|
||||
|
||||
// Post Binary
|
||||
auto labelPostBinary = Label::create("Test Post Binary", "fonts/arial.ttf", 22);
|
||||
auto labelPostBinary = Label::createWithFont("Test Post Binary", "fonts/arial.ttf", 22);
|
||||
auto itemPostBinary = MenuItemLabel::create(labelPostBinary, CC_CALLBACK_1(HttpClientTest::onMenuPostBinaryTestClicked, this));
|
||||
itemPostBinary->setPosition(Point(winSize.width / 2, winSize.height - MARGIN - 3 * SPACE));
|
||||
menuRequest->addChild(itemPostBinary);
|
||||
|
||||
// Put
|
||||
auto labelPut = Label::create("Test Put", "fonts/arial.ttf", 22);
|
||||
auto labelPut = Label::createWithFont("Test Put", "fonts/arial.ttf", 22);
|
||||
auto itemPut = MenuItemLabel::create(labelPut, CC_CALLBACK_1(HttpClientTest::onMenuPutTestClicked, this));
|
||||
itemPut->setPosition(Point(winSize.width / 2, winSize.height - MARGIN - 4 * SPACE));
|
||||
menuRequest->addChild(itemPut);
|
||||
|
||||
// Delete
|
||||
auto labelDelete = Label::create("Test Delete", "fonts/arial.ttf", 22);
|
||||
auto labelDelete = Label::createWithFont("Test Delete", "fonts/arial.ttf", 22);
|
||||
auto itemDelete = MenuItemLabel::create(labelDelete, CC_CALLBACK_1(HttpClientTest::onMenuDeleteTestClicked, this));
|
||||
itemDelete->setPosition(Point(winSize.width / 2, winSize.height - MARGIN - 5 * SPACE));
|
||||
menuRequest->addChild(itemDelete);
|
||||
|
||||
// Response Code Label
|
||||
_labelStatusCode = Label::create("HTTP Status Code", "fonts/arial.ttf", 22);
|
||||
_labelStatusCode = Label::createWithFont("HTTP Status Code", "fonts/arial.ttf", 22);
|
||||
_labelStatusCode->setPosition(Point(winSize.width / 2, winSize.height - MARGIN - 6 * SPACE));
|
||||
addChild(_labelStatusCode);
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ SocketIOTestLayer::SocketIOTestLayer(void)
|
|||
const int MARGIN = 40;
|
||||
const int SPACE = 35;
|
||||
|
||||
auto label = Label::create("SocketIO Extension Test", "fonts/arial.ttf", 28);
|
||||
auto label = Label::createWithFont("SocketIO Extension Test", "fonts/arial.ttf", 28);
|
||||
label->setPosition(Point(winSize.width / 2, winSize.height - MARGIN));
|
||||
addChild(label, 0);
|
||||
|
||||
|
@ -34,55 +34,55 @@ SocketIOTestLayer::SocketIOTestLayer(void)
|
|||
addChild(menuRequest);
|
||||
|
||||
// Test to create basic client in the default namespace
|
||||
auto labelSIOClient = Label::create("Open SocketIO Client", "fonts/arial.ttf", 22);
|
||||
auto labelSIOClient = Label::createWithFont("Open SocketIO Client", "fonts/arial.ttf", 22);
|
||||
auto itemSIOClient = MenuItemLabel::create(labelSIOClient, CC_CALLBACK_1(SocketIOTestLayer::onMenuSIOClientClicked, this));
|
||||
itemSIOClient->setPosition(Point(VisibleRect::left().x + labelSIOClient->getContentSize().width / 2 + 5, winSize.height - MARGIN - SPACE));
|
||||
menuRequest->addChild(itemSIOClient);
|
||||
|
||||
// Test to create a client at the endpoint '/testpoint'
|
||||
auto labelSIOEndpoint = Label::create("Open SocketIO Endpoint", "fonts/arial.ttf", 22);
|
||||
auto labelSIOEndpoint = Label::createWithFont("Open SocketIO Endpoint", "fonts/arial.ttf", 22);
|
||||
auto itemSIOEndpoint = MenuItemLabel::create(labelSIOEndpoint, CC_CALLBACK_1(SocketIOTestLayer::onMenuSIOEndpointClicked, this));
|
||||
itemSIOEndpoint->setPosition(Point(VisibleRect::right().x - labelSIOEndpoint->getContentSize().width / 2 - 5, winSize.height - MARGIN - SPACE));
|
||||
menuRequest->addChild(itemSIOEndpoint);
|
||||
|
||||
// Test sending message to default namespace
|
||||
auto labelTestMessage = Label::create("Send Test Message", "fonts/arial.ttf", 22);
|
||||
auto labelTestMessage = Label::createWithFont("Send Test Message", "fonts/arial.ttf", 22);
|
||||
auto itemTestMessage = MenuItemLabel::create(labelTestMessage, CC_CALLBACK_1(SocketIOTestLayer::onMenuTestMessageClicked, this));
|
||||
itemTestMessage->setPosition(Point(VisibleRect::left().x + labelTestMessage->getContentSize().width / 2 + 5, winSize.height - MARGIN - 2 * SPACE));
|
||||
menuRequest->addChild(itemTestMessage);
|
||||
|
||||
// Test sending message to the endpoint '/testpoint'
|
||||
auto labelTestMessageEndpoint = Label::create("Test Endpoint Message", "fonts/arial.ttf", 22);
|
||||
auto labelTestMessageEndpoint = Label::createWithFont("Test Endpoint Message", "fonts/arial.ttf", 22);
|
||||
auto itemTestMessageEndpoint = MenuItemLabel::create(labelTestMessageEndpoint, CC_CALLBACK_1(SocketIOTestLayer::onMenuTestMessageEndpointClicked, this));
|
||||
itemTestMessageEndpoint->setPosition(Point(VisibleRect::right().x - labelTestMessageEndpoint->getContentSize().width / 2 - 5, winSize.height - MARGIN - 2 * SPACE));
|
||||
menuRequest->addChild(itemTestMessageEndpoint);
|
||||
|
||||
// Test sending event 'echotest' to default namespace
|
||||
auto labelTestEvent = Label::create("Send Test Event", "fonts/arial.ttf", 22);
|
||||
auto labelTestEvent = Label::createWithFont("Send Test Event", "fonts/arial.ttf", 22);
|
||||
auto itemTestEvent = MenuItemLabel::create(labelTestEvent, CC_CALLBACK_1(SocketIOTestLayer::onMenuTestEventClicked, this));
|
||||
itemTestEvent->setPosition(Point(VisibleRect::left().x + labelTestEvent->getContentSize().width / 2 + 5, winSize.height - MARGIN - 3 * SPACE));
|
||||
menuRequest->addChild(itemTestEvent);
|
||||
|
||||
// Test sending event 'echotest' to the endpoint '/testpoint'
|
||||
auto labelTestEventEndpoint = Label::create("Test Endpoint Event", "fonts/arial.ttf", 22);
|
||||
auto labelTestEventEndpoint = Label::createWithFont("Test Endpoint Event", "fonts/arial.ttf", 22);
|
||||
auto itemTestEventEndpoint = MenuItemLabel::create(labelTestEventEndpoint, CC_CALLBACK_1(SocketIOTestLayer::onMenuTestEventEndpointClicked, this));
|
||||
itemTestEventEndpoint->setPosition(Point(VisibleRect::right().x - labelTestEventEndpoint->getContentSize().width / 2 - 5, winSize.height - MARGIN - 3 * SPACE));
|
||||
menuRequest->addChild(itemTestEventEndpoint);
|
||||
|
||||
// Test disconnecting basic client
|
||||
auto labelTestClientDisconnect = Label::create("Disconnect Socket", "fonts/arial.ttf", 22);
|
||||
auto labelTestClientDisconnect = Label::createWithFont("Disconnect Socket", "fonts/arial.ttf", 22);
|
||||
auto itemClientDisconnect = MenuItemLabel::create(labelTestClientDisconnect, CC_CALLBACK_1(SocketIOTestLayer::onMenuTestClientDisconnectClicked, this));
|
||||
itemClientDisconnect->setPosition(Point(VisibleRect::left().x + labelTestClientDisconnect->getContentSize().width / 2 + 5, winSize.height - MARGIN - 4 * SPACE));
|
||||
menuRequest->addChild(itemClientDisconnect);
|
||||
|
||||
// Test disconnecting the endpoint '/testpoint'
|
||||
auto labelTestEndpointDisconnect = Label::create("Disconnect Endpoint", "fonts/arial.ttf", 22);
|
||||
auto labelTestEndpointDisconnect = Label::createWithFont("Disconnect Endpoint", "fonts/arial.ttf", 22);
|
||||
auto itemTestEndpointDisconnect = MenuItemLabel::create(labelTestEndpointDisconnect, CC_CALLBACK_1(SocketIOTestLayer::onMenuTestEndpointDisconnectClicked, this));
|
||||
itemTestEndpointDisconnect->setPosition(Point(VisibleRect::right().x - labelTestEndpointDisconnect->getContentSize().width / 2 - 5, winSize.height - MARGIN - 4 * SPACE));
|
||||
menuRequest->addChild(itemTestEndpointDisconnect);
|
||||
|
||||
// Sahred Status Label
|
||||
_sioClientStatus = Label::create("Not connected...", "fonts/arial.ttf", 14, Size(320, 100), TextHAlignment::LEFT);
|
||||
_sioClientStatus = Label::createWithFont("Not connected...", "fonts/arial.ttf", 14, Size(320, 100), TextHAlignment::LEFT);
|
||||
_sioClientStatus->setAnchorPoint(Point(0, 0));
|
||||
_sioClientStatus->setPosition(Point(VisibleRect::left().x, VisibleRect::rightBottom().y));
|
||||
this->addChild(_sioClientStatus);
|
||||
|
|
|
@ -27,7 +27,7 @@ WebSocketTestLayer::WebSocketTestLayer()
|
|||
const int MARGIN = 40;
|
||||
const int SPACE = 35;
|
||||
|
||||
auto label = Label::create("WebSocket Test", "fonts/arial.ttf", 28);
|
||||
auto label = Label::createWithFont("WebSocket Test", "fonts/arial.ttf", 28);
|
||||
label->setPosition(Point(winSize.width / 2, winSize.height - MARGIN));
|
||||
addChild(label, 0);
|
||||
|
||||
|
@ -36,32 +36,32 @@ WebSocketTestLayer::WebSocketTestLayer()
|
|||
addChild(menuRequest);
|
||||
|
||||
// Send Text
|
||||
auto labelSendText = Label::create("Send Text", "fonts/arial.ttf", 22);
|
||||
auto labelSendText = Label::createWithFont("Send Text", "fonts/arial.ttf", 22);
|
||||
auto itemSendText = MenuItemLabel::create(labelSendText, CC_CALLBACK_1(WebSocketTestLayer::onMenuSendTextClicked, this));
|
||||
itemSendText->setPosition(Point(winSize.width / 2, winSize.height - MARGIN - SPACE));
|
||||
menuRequest->addChild(itemSendText);
|
||||
|
||||
// Send Binary
|
||||
auto labelSendBinary = Label::create("Send Binary", "fonts/arial.ttf", 22);
|
||||
auto labelSendBinary = Label::createWithFont("Send Binary", "fonts/arial.ttf", 22);
|
||||
auto itemSendBinary = MenuItemLabel::create(labelSendBinary, CC_CALLBACK_1(WebSocketTestLayer::onMenuSendBinaryClicked, this));
|
||||
itemSendBinary->setPosition(Point(winSize.width / 2, winSize.height - MARGIN - 2 * SPACE));
|
||||
menuRequest->addChild(itemSendBinary);
|
||||
|
||||
|
||||
// Send Text Status Label
|
||||
_sendTextStatus = Label::create("Send Text WS is waiting...", "fonts/arial.ttf", 14, Size(160, 100), TextHAlignment::CENTER, TextVAlignment::TOP);
|
||||
_sendTextStatus = Label::createWithFont("Send Text WS is waiting...", "fonts/arial.ttf", 14, Size(160, 100), TextHAlignment::CENTER, TextVAlignment::TOP);
|
||||
_sendTextStatus->setAnchorPoint(Point(0, 0));
|
||||
_sendTextStatus->setPosition(Point(VisibleRect::left().x, VisibleRect::rightBottom().y + 25));
|
||||
this->addChild(_sendTextStatus);
|
||||
|
||||
// Send Binary Status Label
|
||||
_sendBinaryStatus = Label::create("Send Binary WS is waiting...", "fonts/arial.ttf", 14, Size(160, 100), TextHAlignment::CENTER, TextVAlignment::TOP);
|
||||
_sendBinaryStatus = Label::createWithFont("Send Binary WS is waiting...", "fonts/arial.ttf", 14, Size(160, 100), TextHAlignment::CENTER, TextVAlignment::TOP);
|
||||
_sendBinaryStatus->setAnchorPoint(Point(0, 0));
|
||||
_sendBinaryStatus->setPosition(Point(VisibleRect::left().x + 160, VisibleRect::rightBottom().y + 25));
|
||||
this->addChild(_sendBinaryStatus);
|
||||
|
||||
// Error Label
|
||||
_errorStatus = Label::create("Error WS is waiting...", "fonts/arial.ttf", 14, Size(160, 100), TextHAlignment::CENTER, TextVAlignment::TOP);
|
||||
_errorStatus = Label::createWithFont("Error WS is waiting...", "fonts/arial.ttf", 14, Size(160, 100), TextHAlignment::CENTER, TextVAlignment::TOP);
|
||||
_errorStatus->setAnchorPoint(Point(0, 0));
|
||||
_errorStatus->setPosition(Point(VisibleRect::left().x + 320, VisibleRect::rightBottom().y + 25));
|
||||
this->addChild(_errorStatus);
|
||||
|
|
|
@ -88,8 +88,8 @@ NotificationCenterTest::NotificationCenterTest()
|
|||
pBackMenu->setPosition( Point::ZERO );
|
||||
addChild(pBackMenu);
|
||||
|
||||
auto label1 = Label::create("switch off", "fonts/Marker Felt.ttf", 26);
|
||||
auto label2 = Label::create("switch on", "fonts/Marker Felt.ttf", 26);
|
||||
auto label1 = Label::createWithFont("switch off", "fonts/Marker Felt.ttf", 26);
|
||||
auto label2 = Label::createWithFont("switch on", "fonts/Marker Felt.ttf", 26);
|
||||
auto item1 = MenuItemLabel::create(label1);
|
||||
auto item2 = MenuItemLabel::create(label2);
|
||||
auto item = MenuItemToggle::createWithCallback( CC_CALLBACK_1(NotificationCenterTest::toggleSwitch, this), item1, item2, NULL);
|
||||
|
@ -110,8 +110,8 @@ NotificationCenterTest::NotificationCenterTest()
|
|||
light->setPosition(Point(100, s.height/4*i));
|
||||
addChild(light);
|
||||
|
||||
auto label1 = Label::create("not connected", "fonts/Marker Felt.ttf", 26);
|
||||
auto label2 = Label::create("connected", "fonts/Marker Felt.ttf", 26);
|
||||
auto label1 = Label::createWithFont("not connected", "fonts/Marker Felt.ttf", 26);
|
||||
auto label2 = Label::createWithFont("connected", "fonts/Marker Felt.ttf", 26);
|
||||
auto item1 = MenuItemLabel::create(label1);
|
||||
auto item2 = MenuItemLabel::create(label2);
|
||||
auto item = MenuItemToggle::createWithCallback( CC_CALLBACK_1(NotificationCenterTest::connectToSwitch, this), item1, item2, NULL);
|
||||
|
|
|
@ -80,7 +80,7 @@ TableViewCell* TableViewTestLayer::tableCellAtIndex(TableView *table, ssize_t id
|
|||
sprite->setPosition(Point(0, 0));
|
||||
cell->addChild(sprite);
|
||||
|
||||
auto label = Label::create(string->getCString(), "Helvetica", 20.0);
|
||||
auto label = Label::createWithFont(string->getCString(), "Helvetica", 20.0);
|
||||
label->setPosition(Point::ZERO);
|
||||
label->setAnchorPoint(Point::ZERO);
|
||||
label->setTag(123);
|
||||
|
|
|
@ -276,12 +276,12 @@ void TestIsFileExist::onEnter()
|
|||
|
||||
isExist = sharedFileUtils->isFileExist("Images/grossini.png");
|
||||
|
||||
pTTF = Label::create(isExist ? "Images/grossini.png exists" : "Images/grossini.png doesn't exist", "", 20);
|
||||
pTTF = Label::createWithFont(isExist ? "Images/grossini.png exists" : "Images/grossini.png doesn't exist", "", 20);
|
||||
pTTF->setPosition(Point(s.width/2, s.height/3));
|
||||
this->addChild(pTTF);
|
||||
|
||||
isExist = sharedFileUtils->isFileExist("Images/grossini.xcf");
|
||||
pTTF = Label::create(isExist ? "Images/grossini.xcf exists" : "Images/grossini.xcf doesn't exist", "", 20);
|
||||
pTTF = Label::createWithFont(isExist ? "Images/grossini.xcf exists" : "Images/grossini.xcf doesn't exist", "", 20);
|
||||
pTTF->setPosition(Point(s.width/2, s.height/3*2));
|
||||
this->addChild(pTTF);
|
||||
}
|
||||
|
@ -363,7 +363,7 @@ void TextWritePlist::onEnter()
|
|||
else
|
||||
log("write plist file failed");
|
||||
|
||||
auto label = Label::create(fullPath.c_str(), "fonts/Thonburi.ttf", 6);
|
||||
auto label = Label::createWithFont(fullPath.c_str(), "fonts/Thonburi.ttf", 6);
|
||||
this->addChild(label);
|
||||
auto winSize = Director::getInstance()->getWinSize();
|
||||
label->setPosition(Point(winSize.width/2, winSize.height/3));
|
||||
|
|
|
@ -97,12 +97,12 @@ void FontTest::showFont(const char *pFont)
|
|||
removeChildByTag(kTagColor2, true);
|
||||
removeChildByTag(kTagColor3, true);
|
||||
|
||||
auto top = Label::create(pFont, pFont, 24);
|
||||
auto left = Label::create("alignment left", pFont, fontSize,
|
||||
auto top = Label::createWithFont(pFont, pFont, 24);
|
||||
auto left = Label::createWithFont("alignment left", pFont, fontSize,
|
||||
blockSize, TextHAlignment::LEFT, verticalAlignment[vAlignIdx]);
|
||||
auto center = Label::create("alignment center", pFont, fontSize,
|
||||
auto center = Label::createWithFont("alignment center", pFont, fontSize,
|
||||
blockSize, TextHAlignment::CENTER, verticalAlignment[vAlignIdx]);
|
||||
auto right = Label::create("alignment right", pFont, fontSize,
|
||||
auto right = Label::createWithFont("alignment right", pFont, fontSize,
|
||||
blockSize, TextHAlignment::RIGHT, verticalAlignment[vAlignIdx]);
|
||||
|
||||
auto leftColor = LayerColor::create(Color4B(100, 100, 100, 255), blockSize.width, blockSize.height);
|
||||
|
|
|
@ -3,17 +3,17 @@
|
|||
MouseTest::MouseTest()
|
||||
{
|
||||
auto s = Director::getInstance()->getWinSize();
|
||||
auto title = Label::create("Mouse Test", "fonts/arial.ttf", 28);
|
||||
auto title = Label::createWithFont("Mouse Test", "fonts/arial.ttf", 28);
|
||||
addChild(title, 0);
|
||||
title->setPosition( Point(s.width/2, s.height-50) );
|
||||
|
||||
//Create a label to display the mouse action
|
||||
_labelAction = Label::create("Click mouse button and see this change", "fonts/arial.ttf", 22);
|
||||
_labelAction = Label::createWithFont("Click mouse button and see this change", "fonts/arial.ttf", 22);
|
||||
_labelAction->setPosition(Point(s.width/2, s.height*2/3));
|
||||
addChild(_labelAction, 0);
|
||||
|
||||
//Create a label to display the mouse position
|
||||
_labelPosition = Label::create("Mouse not supported on this device", "fonts/arial.ttf", 22);
|
||||
_labelPosition = Label::createWithFont("Mouse not supported on this device", "fonts/arial.ttf", 22);
|
||||
_labelPosition->setPosition(Point(s.width/2, s.height/3));
|
||||
addChild(_labelPosition);
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
KeyboardTest::KeyboardTest()
|
||||
{
|
||||
auto s = Director::getInstance()->getWinSize();
|
||||
auto label = Label::create("Keyboard Test", "fonts/arial.ttf", 28);
|
||||
auto label = Label::createWithFont("Keyboard Test", "fonts/arial.ttf", 28);
|
||||
addChild(label, 0);
|
||||
label->setPosition( Point(s.width/2, s.height-50) );
|
||||
|
||||
|
@ -14,7 +14,7 @@ KeyboardTest::KeyboardTest()
|
|||
_eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this);
|
||||
|
||||
// create a label to display the tip string
|
||||
_label = Label::create("Please press any key and see console log...", "fonts/arial.ttf", 22);
|
||||
_label = Label::createWithFont("Please press any key and see console log...", "fonts/arial.ttf", 22);
|
||||
_label->setPosition(Point(s.width / 2, s.height / 2));
|
||||
addChild(_label, 0);
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
KeypadTest::KeypadTest()
|
||||
{
|
||||
auto s = Director::getInstance()->getWinSize();
|
||||
auto label = Label::create("Keypad Test", "fonts/arial.ttf", 28);
|
||||
auto label = Label::createWithFont("Keypad Test", "fonts/arial.ttf", 28);
|
||||
addChild(label, 0);
|
||||
label->setPosition( Point(s.width/2, s.height-50) );
|
||||
|
||||
|
@ -13,7 +13,7 @@ KeypadTest::KeypadTest()
|
|||
_eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this);
|
||||
|
||||
// create a label to display the tip string
|
||||
_label = Label::create("Please press any key...", "fonts/arial.ttf", 22);
|
||||
_label = Label::createWithFont("Please press any key...", "fonts/arial.ttf", 22);
|
||||
_label->setPosition(Point(s.width / 2, s.height / 2));
|
||||
addChild(_label, 0);
|
||||
|
||||
|
|
|
@ -1503,7 +1503,7 @@ LabelTTFOldNew::LabelTTFOldNew()
|
|||
auto s = Director::getInstance()->getWinSize();
|
||||
float delta = s.height/4;
|
||||
|
||||
auto label1 = Label::create("Cocos2d-x Label Test", "arial", 24);
|
||||
auto label1 = Label::createWithFont("Cocos2d-x Label Test", "arial", 24);
|
||||
addChild(label1, 0, kTagBitmapAtlas1);
|
||||
label1->setPosition(Point(s.width/2, delta * 2));
|
||||
label1->setColor(Color3B::RED);
|
||||
|
@ -1582,14 +1582,7 @@ LabelFontNameTest::LabelFontNameTest()
|
|||
label1->setPosition( Point(size.width/2, size.height * 0.7) );
|
||||
addChild(label1);
|
||||
|
||||
FontDefinition fontDef;
|
||||
fontDef._fontName = "fonts/Marker Felt.ttf";
|
||||
fontDef._fontSize = 32;
|
||||
auto label2 = Label::createWithFontDefinition("Create with FontDefinition",fontDef);
|
||||
label2->setPosition( Point(size.width/2, size.height * 0.6) );
|
||||
addChild(label2);
|
||||
|
||||
auto label3 = Label::create("fonts/Marker Felt.ttf","fonts/Marker Felt.ttf",32);
|
||||
auto label3 = Label::createWithFont("Marker Felt","Marker Felt",32);
|
||||
label3->setPosition( Point(size.width/2, size.height * 0.5) );
|
||||
addChild(label3);
|
||||
}
|
||||
|
|
|
@ -588,8 +588,8 @@ LayerGradientTest::LayerGradientTest()
|
|||
listener->onTouchesMoved = CC_CALLBACK_2(LayerGradientTest::onTouchesMoved, this);
|
||||
_eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this);
|
||||
|
||||
auto label1 = Label::create("Compressed Interpolation: Enabled", "fonts/Marker Felt.ttf", 26);
|
||||
auto label2 = Label::create("Compressed Interpolation: Disabled", "fonts/Marker Felt.ttf", 26);
|
||||
auto label1 = Label::createWithFont("Compressed Interpolation: Enabled", "fonts/Marker Felt.ttf", 26);
|
||||
auto label2 = Label::createWithFont("Compressed Interpolation: Disabled", "fonts/Marker Felt.ttf", 26);
|
||||
auto item1 = MenuItemLabel::create(label1);
|
||||
auto item2 = MenuItemLabel::create(label2);
|
||||
auto item = MenuItemToggle::createWithCallback( CC_CALLBACK_1(LayerGradientTest::toggleItem, this), item1, item2, NULL);
|
||||
|
|
|
@ -509,7 +509,7 @@ RemoveMenuItemWhenMove::RemoveMenuItemWhenMove()
|
|||
{
|
||||
auto s = Director::getInstance()->getWinSize();
|
||||
|
||||
auto label = Label::create("click item and move, should not crash", "fonts/arial.ttf", 20);
|
||||
auto label = Label::createWithFont("click item and move, should not crash", "fonts/arial.ttf", 20);
|
||||
label->setPosition(Point(s.width/2, s.height - 30));
|
||||
addChild(label);
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ bool MutiTouchTestLayer::init()
|
|||
listener->onTouchesEnded = CC_CALLBACK_2(MutiTouchTestLayer::onTouchesEnded, this);
|
||||
_eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this);
|
||||
|
||||
auto title = Label::create("Please touch the screen!", "", 24);
|
||||
auto title = Label::createWithFont("Please touch the screen!", "", 24);
|
||||
title->setPosition(VisibleRect::top()+Point(0, -40));
|
||||
addChild(title);
|
||||
|
||||
|
|
|
@ -384,7 +384,7 @@ void RemoveListenerWhenDispatching::onEnter()
|
|||
|
||||
_eventDispatcher->addEventListenerWithSceneGraphPriority(listener1, sprite1);
|
||||
|
||||
auto statusLabel = Label::create("The sprite could be touched!", "", 20);
|
||||
auto statusLabel = Label::createWithFont("The sprite could be touched!", "", 20);
|
||||
statusLabel->setPosition(origin + Point(size.width/2, size.height-90));
|
||||
addChild(statusLabel);
|
||||
std::shared_ptr<bool> enable(new bool(true));
|
||||
|
@ -433,7 +433,7 @@ void CustomEventTest::onEnter()
|
|||
|
||||
MenuItemFont::setFontSize(20);
|
||||
|
||||
auto statusLabel = Label::create("No custom event 1 received!", "", 20);
|
||||
auto statusLabel = Label::createWithFont("No custom event 1 received!", "", 20);
|
||||
statusLabel->setPosition(origin + Point(size.width/2, size.height-90));
|
||||
addChild(statusLabel);
|
||||
|
||||
|
@ -459,7 +459,7 @@ void CustomEventTest::onEnter()
|
|||
});
|
||||
sendItem->setPosition(origin + Point(size.width/2, size.height/2));
|
||||
|
||||
auto statusLabel2 = Label::create("No custom event 2 received!", "", 20);
|
||||
auto statusLabel2 = Label::createWithFont("No custom event 2 received!", "", 20);
|
||||
statusLabel2->setPosition(origin + Point(size.width/2, size.height-120));
|
||||
addChild(statusLabel2);
|
||||
|
||||
|
@ -516,7 +516,7 @@ void LabelKeyboardEventTest::onEnter()
|
|||
Point origin = Director::getInstance()->getVisibleOrigin();
|
||||
Size size = Director::getInstance()->getVisibleSize();
|
||||
|
||||
auto statusLabel = Label::create("No keyboard event received!", "", 20);
|
||||
auto statusLabel = Label::createWithFont("No keyboard event received!", "", 20);
|
||||
statusLabel->setPosition(origin + Point(size.width/2, size.height/2));
|
||||
addChild(statusLabel);
|
||||
|
||||
|
@ -1189,7 +1189,7 @@ Issue4129::Issue4129()
|
|||
{
|
||||
_customlistener = _eventDispatcher->addCustomEventListener(EVENT_COME_TO_BACKGROUND, [this](EventCustom* event){
|
||||
|
||||
auto label = Label::create("Yeah, this issue was fixed.", "", 20);
|
||||
auto label = Label::createWithFont("Yeah, this issue was fixed.", "", 20);
|
||||
label->setAnchorPoint(Point(0, 0.5f));
|
||||
label->setPosition(Point(VisibleRect::left()));
|
||||
this->addChild(label);
|
||||
|
|
|
@ -94,7 +94,7 @@ void PerformceAllocScene::initWithQuantityOfNodes(unsigned int nNodes)
|
|||
auto s = Director::getInstance()->getWinSize();
|
||||
|
||||
// Title
|
||||
auto label = Label::create(title().c_str(), "fonts/arial.ttf", 32);
|
||||
auto label = Label::createWithFont(title().c_str(), "fonts/arial.ttf", 32);
|
||||
addChild(label, 1);
|
||||
label->setPosition(Point(s.width/2, s.height-50));
|
||||
|
||||
|
@ -102,7 +102,7 @@ void PerformceAllocScene::initWithQuantityOfNodes(unsigned int nNodes)
|
|||
std::string strSubTitle = subtitle();
|
||||
if(strSubTitle.length())
|
||||
{
|
||||
auto l = Label::create(strSubTitle.c_str(), "fonts/Thonburi.ttf", 16);
|
||||
auto l = Label::createWithFont(strSubTitle.c_str(), "fonts/Thonburi.ttf", 16);
|
||||
addChild(l, 1);
|
||||
l->setPosition(Point(s.width/2, s.height-80));
|
||||
}
|
||||
|
@ -142,7 +142,7 @@ void PerformceAllocScene::initWithQuantityOfNodes(unsigned int nNodes)
|
|||
menu->setPosition(Point(s.width/2, s.height/2+15));
|
||||
addChild(menu, 1);
|
||||
|
||||
auto infoLabel = Label::create("0 nodes", "fonts/Marker Felt.ttf", 30);
|
||||
auto infoLabel = Label::createWithFont("0 nodes", "fonts/Marker Felt.ttf", 30);
|
||||
infoLabel->setColor(Color3B(0,200,20));
|
||||
infoLabel->setPosition(Point(s.width/2, s.height/2-15));
|
||||
addChild(infoLabel, 1, kTagInfoLayer);
|
||||
|
|
|
@ -96,7 +96,7 @@ void PerformanceContainerScene::initWithQuantityOfNodes(unsigned int nNodes)
|
|||
auto s = Director::getInstance()->getWinSize();
|
||||
|
||||
// Title
|
||||
auto label = Label::create(title().c_str(), "fonts/arial.ttf", 32);
|
||||
auto label = Label::createWithFont(title().c_str(), "fonts/arial.ttf", 32);
|
||||
addChild(label, 1, TAG_TITLE);
|
||||
label->setPosition(Point(s.width/2, s.height-50));
|
||||
|
||||
|
@ -104,7 +104,7 @@ void PerformanceContainerScene::initWithQuantityOfNodes(unsigned int nNodes)
|
|||
std::string strSubTitle = subtitle();
|
||||
if(strSubTitle.length())
|
||||
{
|
||||
auto l = Label::create(strSubTitle.c_str(), "fonts/Thonburi.ttf", 16);
|
||||
auto l = Label::createWithFont(strSubTitle.c_str(), "fonts/Thonburi.ttf", 16);
|
||||
addChild(l, 1, TAG_SUBTITLE);
|
||||
l->setPosition(Point(s.width/2, s.height-80));
|
||||
}
|
||||
|
@ -147,7 +147,7 @@ void PerformanceContainerScene::initWithQuantityOfNodes(unsigned int nNodes)
|
|||
menu->setPosition(Point(s.width/2, s.height/2+15));
|
||||
addChild(menu, 1);
|
||||
|
||||
auto infoLabel = Label::create("0 nodes", "fonts/Marker Felt.ttf", 30);
|
||||
auto infoLabel = Label::createWithFont("0 nodes", "fonts/Marker Felt.ttf", 30);
|
||||
infoLabel->setColor(Color3B(0,200,20));
|
||||
infoLabel->setPosition(Point(s.width/2, s.height/2-15));
|
||||
addChild(infoLabel, 1, kTagInfoLayer);
|
||||
|
|
|
@ -94,7 +94,7 @@ void PerformanceEventDispatcherScene::initWithQuantityOfNodes(unsigned int nNode
|
|||
auto s = Director::getInstance()->getWinSize();
|
||||
|
||||
// Title
|
||||
auto label = Label::create(title().c_str(), "fonts/arial.ttf", 32);
|
||||
auto label = Label::createWithFont(title().c_str(), "fonts/arial.ttf", 32);
|
||||
addChild(label, 1, TAG_TITLE);
|
||||
label->setPosition(Point(s.width/2, s.height-50));
|
||||
|
||||
|
@ -102,7 +102,7 @@ void PerformanceEventDispatcherScene::initWithQuantityOfNodes(unsigned int nNode
|
|||
std::string strSubTitle = subtitle();
|
||||
if(strSubTitle.length())
|
||||
{
|
||||
auto l = Label::create(strSubTitle.c_str(), "fonts/Thonburi.ttf", 16);
|
||||
auto l = Label::createWithFont(strSubTitle.c_str(), "fonts/Thonburi.ttf", 16);
|
||||
addChild(l, 1, TAG_SUBTITLE);
|
||||
l->setPosition(Point(s.width/2, s.height-80));
|
||||
}
|
||||
|
@ -145,7 +145,7 @@ void PerformanceEventDispatcherScene::initWithQuantityOfNodes(unsigned int nNode
|
|||
menu->setPosition(Point(s.width/2, s.height/2+15));
|
||||
addChild(menu, 1);
|
||||
|
||||
auto infoLabel = Label::create("0 listeners", "fonts/Marker Felt.ttf", 30);
|
||||
auto infoLabel = Label::createWithFont("0 listeners", "fonts/Marker Felt.ttf", 30);
|
||||
infoLabel->setColor(Color3B(0,200,20));
|
||||
infoLabel->setPosition(Point(s.width/2, s.height/2-15));
|
||||
addChild(infoLabel, 1, kTagInfoLayer);
|
||||
|
|
|
@ -102,7 +102,7 @@ void LabelMainScene::initWithSubTest(int nodes)
|
|||
menu->setPosition(Point(s.width/2, s.height-65));
|
||||
addChild(menu, 1);
|
||||
|
||||
auto infoLabel = Label::create("0 nodes", "fonts/Marker Felt.ttf", 30);
|
||||
auto infoLabel = Label::createWithFont("0 nodes", "fonts/Marker Felt.ttf", 30);
|
||||
infoLabel->setColor(Color3B(0,200,20));
|
||||
infoLabel->setPosition(Point(s.width/2, s.height-90));
|
||||
addChild(infoLabel, 1, kTagInfoLayer);
|
||||
|
@ -136,7 +136,7 @@ void LabelMainScene::initWithSubTest(int nodes)
|
|||
menuAutoTest->addChild(autoTestItem);
|
||||
addChild( menuAutoTest, 3, kTagAutoTestMenu );
|
||||
|
||||
_title = Label::create(title().c_str(), "fonts/arial.ttf", 32);
|
||||
_title = Label::createWithFont(title().c_str(), "fonts/arial.ttf", 32);
|
||||
addChild(_title, 1);
|
||||
_title->setPosition(Point(s.width/2, s.height-50));
|
||||
|
||||
|
@ -194,7 +194,7 @@ void LabelMainScene::onIncrease(Ref* sender)
|
|||
case kCaseLabelTTFUpdate:
|
||||
for( int i=0;i< kNodesIncrease;i++)
|
||||
{
|
||||
auto label = Label::create("LabelTTF", "Marker Felt", 30);
|
||||
auto label = Label::createWithFont("LabelTTF", "Marker Felt", 30);
|
||||
label->setPosition(Point((size.width/2 + rand() % 50), ((int)size.height/2 + rand() % 50)));
|
||||
_labelContainer->addChild(label, 1, _quantityNodes);
|
||||
|
||||
|
|
|
@ -123,7 +123,7 @@ void NodeChildrenMainScene::initWithQuantityOfNodes(unsigned int nNodes)
|
|||
auto s = Director::getInstance()->getWinSize();
|
||||
|
||||
// Title
|
||||
auto label = Label::create(title().c_str(), "fonts/arial.ttf", 32);
|
||||
auto label = Label::createWithFont(title().c_str(), "fonts/arial.ttf", 32);
|
||||
addChild(label, 1);
|
||||
label->setPosition(Point(s.width/2, s.height-50));
|
||||
|
||||
|
@ -131,7 +131,7 @@ void NodeChildrenMainScene::initWithQuantityOfNodes(unsigned int nNodes)
|
|||
std::string strSubTitle = subtitle();
|
||||
if(strSubTitle.length())
|
||||
{
|
||||
auto l = Label::create(strSubTitle.c_str(), "fonts/Thonburi.ttf", 16);
|
||||
auto l = Label::createWithFont(strSubTitle.c_str(), "fonts/Thonburi.ttf", 16);
|
||||
addChild(l, 1);
|
||||
l->setPosition(Point(s.width/2, s.height-80));
|
||||
}
|
||||
|
@ -171,7 +171,7 @@ void NodeChildrenMainScene::initWithQuantityOfNodes(unsigned int nNodes)
|
|||
menu->setPosition(Point(s.width/2, s.height/2+15));
|
||||
addChild(menu, 1);
|
||||
|
||||
auto infoLabel = Label::create("0 nodes", "fonts/Marker Felt.ttf", 30);
|
||||
auto infoLabel = Label::createWithFont("0 nodes", "fonts/Marker Felt.ttf", 30);
|
||||
infoLabel->setColor(Color3B(0,200,20));
|
||||
infoLabel->setPosition(Point(s.width/2, s.height/2-15));
|
||||
addChild(infoLabel, 1, kTagInfoLayer);
|
||||
|
|
|
@ -103,7 +103,7 @@ void ParticleMainScene::initWithSubTest(int asubtest, int particles)
|
|||
menu->setPosition(Point(s.width/2, s.height/2+15));
|
||||
addChild(menu, 1);
|
||||
|
||||
auto infoLabel = Label::create("0 nodes", "fonts/Marker Felt.ttf", 30);
|
||||
auto infoLabel = Label::createWithFont("0 nodes", "fonts/Marker Felt.ttf", 30);
|
||||
infoLabel->setColor(Color3B(0,200,20));
|
||||
infoLabel->setPosition(Point(s.width/2, s.height - 90));
|
||||
addChild(infoLabel, 1, kTagInfoLayer);
|
||||
|
@ -142,7 +142,7 @@ void ParticleMainScene::initWithSubTest(int asubtest, int particles)
|
|||
pSubMenu->setPosition(Point(s.width/2, 80));
|
||||
addChild(pSubMenu, 2);
|
||||
|
||||
auto label = Label::create(title().c_str(), "fonts/arial.ttf", 32);
|
||||
auto label = Label::createWithFont(title().c_str(), "fonts/arial.ttf", 32);
|
||||
addChild(label, 1);
|
||||
label->setPosition(Point(s.width/2, s.height-50));
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ void ScenarioMenuLayer::onEnter()
|
|||
auto s = Director::getInstance()->getWinSize();
|
||||
|
||||
// Title
|
||||
auto label = Label::create(title().c_str(), "fonts/arial.ttf", 32);
|
||||
auto label = Label::createWithFont(title().c_str(), "fonts/arial.ttf", 32);
|
||||
addChild(label, 1);
|
||||
label->setPosition(Point(s.width/2, s.height-50));
|
||||
|
||||
|
@ -46,7 +46,7 @@ void ScenarioMenuLayer::onEnter()
|
|||
std::string strSubTitle = subtitle();
|
||||
if(strSubTitle.length())
|
||||
{
|
||||
auto l = Label::create(strSubTitle.c_str(), "fonts/Thonburi.ttf", 16);
|
||||
auto l = Label::createWithFont(strSubTitle.c_str(), "fonts/Thonburi.ttf", 16);
|
||||
addChild(l, 1);
|
||||
l->setPosition(Point(s.width/2, s.height-80));
|
||||
}
|
||||
|
@ -154,19 +154,19 @@ void ScenarioTest::performTests()
|
|||
|
||||
|
||||
// add tip labels
|
||||
_spriteLabel = Label::create("Sprites : 0", "fonts/arial.ttf", 15);
|
||||
_spriteLabel = Label::createWithFont("Sprites : 0", "fonts/arial.ttf", 15);
|
||||
_spriteLabel->setAnchorPoint(Point(0.0f, 0.5f));
|
||||
addChild(_spriteLabel, 10);
|
||||
_spriteLabel->setPosition(Point(origin.x, origin.y + s.height/2 + 70));
|
||||
|
||||
char str[32] = { 0 };
|
||||
sprintf(str, "Particles : %d", _particleNumber);
|
||||
_particleLabel = Label::create(str, "fonts/arial.ttf", 15);
|
||||
_particleLabel = Label::createWithFont(str, "fonts/arial.ttf", 15);
|
||||
_particleLabel->setAnchorPoint(Point(0.0f, 0.5f));
|
||||
addChild(_particleLabel, 10);
|
||||
_particleLabel->setPosition(Point(origin.x, origin.y + s.height/2 + 45));
|
||||
|
||||
_parsysLabel = Label::create("Particle System : 0", "fonts/arial.ttf", 15);
|
||||
_parsysLabel = Label::createWithFont("Particle System : 0", "fonts/arial.ttf", 15);
|
||||
_parsysLabel->setAnchorPoint(Point(0.0f, 0.5f));
|
||||
addChild(_parsysLabel, 10);
|
||||
_parsysLabel->setPosition(Point(origin.x, origin.y + s.height/2 + 20));
|
||||
|
|
|
@ -391,7 +391,7 @@ void SpriteMainScene::initWithSubTest(int asubtest, int nNodes)
|
|||
menu->setPosition(Point(s.width/2, s.height-65));
|
||||
addChild(menu, 1);
|
||||
|
||||
auto infoLabel = Label::create("0 nodes", "fonts/Marker Felt.ttf", 30);
|
||||
auto infoLabel = Label::createWithFont("0 nodes", "fonts/Marker Felt.ttf", 30);
|
||||
infoLabel->setColor(Color3B(0,200,20));
|
||||
infoLabel->setPosition(Point(s.width/2, s.height-90));
|
||||
addChild(infoLabel, 1, kTagInfoLayer);
|
||||
|
@ -450,7 +450,7 @@ void SpriteMainScene::initWithSubTest(int asubtest, int nNodes)
|
|||
addChild(subMenu, 2);
|
||||
|
||||
// add title label
|
||||
auto label = Label::create(title(), "fonts/arial.ttf", 32);
|
||||
auto label = Label::createWithFont(title(), "fonts/arial.ttf", 32);
|
||||
addChild(label, 1);
|
||||
label->setPosition(Point(s.width/2, s.height-50));
|
||||
|
||||
|
@ -459,7 +459,7 @@ void SpriteMainScene::initWithSubTest(int asubtest, int nNodes)
|
|||
std::string strSubtitle = subtitle();
|
||||
if( ! strSubtitle.empty() )
|
||||
{
|
||||
auto l = Label::create(strSubtitle.c_str(), "fonts/Thonburi.ttf", 16);
|
||||
auto l = Label::createWithFont(strSubtitle.c_str(), "fonts/Thonburi.ttf", 16);
|
||||
addChild(l, 9999);
|
||||
l->setPosition( Point(VisibleRect::center().x, VisibleRect::top().y - 60) );
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ void TextureMenuLayer::onEnter()
|
|||
auto s = Director::getInstance()->getWinSize();
|
||||
|
||||
// Title
|
||||
auto label = Label::create(title().c_str(), "fonts/arial.ttf", 32);
|
||||
auto label = Label::createWithFont(title().c_str(), "fonts/arial.ttf", 32);
|
||||
addChild(label, 1);
|
||||
label->setPosition(Point(s.width/2, s.height-50));
|
||||
|
||||
|
@ -56,7 +56,7 @@ void TextureMenuLayer::onEnter()
|
|||
std::string strSubTitle = subtitle();
|
||||
if(strSubTitle.length())
|
||||
{
|
||||
auto l = Label::create(strSubTitle.c_str(), "fonts/Thonburi.ttf", 16);
|
||||
auto l = Label::createWithFont(strSubTitle.c_str(), "fonts/Thonburi.ttf", 16);
|
||||
addChild(l, 1);
|
||||
l->setPosition(Point(s.width/2, s.height-80));
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ void TouchesMainScene::onEnter()
|
|||
auto s = Director::getInstance()->getWinSize();
|
||||
|
||||
// add title
|
||||
auto label = Label::create(title().c_str(), "fonts/arial.ttf", 32);
|
||||
auto label = Label::createWithFont(title().c_str(), "fonts/arial.ttf", 32);
|
||||
addChild(label, 1);
|
||||
label->setPosition(Point(s.width/2, s.height-50));
|
||||
|
||||
|
@ -223,7 +223,7 @@ void TouchesPerformTest3::onEnter()
|
|||
auto s = Director::getInstance()->getWinSize();
|
||||
|
||||
// add title
|
||||
auto label = Label::create(title().c_str(), "fonts/arial.ttf", 32);
|
||||
auto label = Label::createWithFont(title().c_str(), "fonts/arial.ttf", 32);
|
||||
addChild(label, 1);
|
||||
label->setPosition(Point(s.width/2, s.height-50));
|
||||
|
||||
|
@ -248,7 +248,7 @@ void TouchesPerformTest3::onEnter()
|
|||
layer->release();
|
||||
}
|
||||
|
||||
auto emitEventlabel = Label::create("Emit Touch Event", "", 24);
|
||||
auto emitEventlabel = Label::createWithFont("Emit Touch Event", "", 24);
|
||||
auto menuItem = MenuItemLabel::create(emitEventlabel, [this](Ref* sender){
|
||||
|
||||
CC_PROFILER_PURGE_ALL();
|
||||
|
|
|
@ -86,7 +86,7 @@ void PhysicsTestScene::toggleDebug()
|
|||
#if CC_USE_PHYSICS == 0
|
||||
void PhysicsDemoDisabled::onEnter()
|
||||
{
|
||||
auto label = Label::create("Should define CC_USE_PHYSICS\n to run this test case",
|
||||
auto label = Label::createWithFont("Should define CC_USE_PHYSICS\n to run this test case",
|
||||
"fonts/arial.ttf",
|
||||
18);
|
||||
auto size = Director::getInstance()->getWinSize();
|
||||
|
@ -1310,7 +1310,7 @@ void PhysicsContactTest::onEnter()
|
|||
menu1->setPosition(Point(s.width/2, s.height-50));
|
||||
addChild(menu1, 1);
|
||||
|
||||
auto label = Label::create("yellow box", "fonts/arial.ttf", 32);
|
||||
auto label = Label::createWithFont("yellow box", "fonts/arial.ttf", 32);
|
||||
addChild(label, 1);
|
||||
label->setPosition(Point(s.width/2 - 150, s.height-50));
|
||||
|
||||
|
@ -1326,7 +1326,7 @@ void PhysicsContactTest::onEnter()
|
|||
menu2->setPosition(Point(s.width/2, s.height-90));
|
||||
addChild(menu2, 1);
|
||||
|
||||
label = Label::create("blue box", "fonts/arial.ttf", 32);
|
||||
label = Label::createWithFont("blue box", "fonts/arial.ttf", 32);
|
||||
addChild(label, 1);
|
||||
label->setPosition(Point(s.width/2 - 150, s.height-90));
|
||||
|
||||
|
@ -1342,7 +1342,7 @@ void PhysicsContactTest::onEnter()
|
|||
menu3->setPosition(Point(s.width/2, s.height-130));
|
||||
addChild(menu3, 1);
|
||||
|
||||
label = Label::create("yellow triangle", "fonts/arial.ttf", 32);
|
||||
label = Label::createWithFont("yellow triangle", "fonts/arial.ttf", 32);
|
||||
addChild(label, 1);
|
||||
label->setPosition(Point(s.width/2 - 150, s.height-130));
|
||||
|
||||
|
@ -1358,7 +1358,7 @@ void PhysicsContactTest::onEnter()
|
|||
menu4->setPosition(Point(s.width/2, s.height-170));
|
||||
addChild(menu4, 1);
|
||||
|
||||
label = Label::create("blue triangle", "fonts/arial.ttf", 32);
|
||||
label = Label::createWithFont("blue triangle", "fonts/arial.ttf", 32);
|
||||
addChild(label, 1);
|
||||
label->setPosition(Point(s.width/2 - 150, s.height-170));
|
||||
|
||||
|
@ -1425,22 +1425,22 @@ void PhysicsContactTest::resetTest()
|
|||
char buffer[10];
|
||||
|
||||
sprintf(buffer, "%d", _yellowBoxNum);
|
||||
auto label = Label::create(buffer, "fonts/arial.ttf", 32);
|
||||
auto label = Label::createWithFont(buffer, "fonts/arial.ttf", 32);
|
||||
root->addChild(label, 1);
|
||||
label->setPosition(Point(s.width/2, s.height-50));
|
||||
|
||||
sprintf(buffer, "%d", _blueBoxNum);
|
||||
label = Label::create(buffer, "fonts/arial.ttf", 32);
|
||||
label = Label::createWithFont(buffer, "fonts/arial.ttf", 32);
|
||||
root->addChild(label, 1);
|
||||
label->setPosition(Point(s.width/2, s.height-90));
|
||||
|
||||
sprintf(buffer, "%d", _yellowTriangleNum);
|
||||
label = Label::create(buffer, "fonts/arial.ttf", 32);
|
||||
label = Label::createWithFont(buffer, "fonts/arial.ttf", 32);
|
||||
root->addChild(label, 1);
|
||||
label->setPosition(Point(s.width/2, s.height-130));
|
||||
|
||||
sprintf(buffer, "%d", _blueTriangleNum);
|
||||
label = Label::create(buffer, "fonts/arial.ttf", 32);
|
||||
label = Label::createWithFont(buffer, "fonts/arial.ttf", 32);
|
||||
root->addChild(label, 1);
|
||||
label->setPosition(Point(s.width/2, s.height-170));
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ private:
|
|||
void ReleasePoolTestScene::runThisTest()
|
||||
{
|
||||
// title
|
||||
auto label = Label::create("AutoreasePool Test", "fonts/arial.ttf", 32);
|
||||
auto label = Label::createWithFont("AutoreasePool Test", "fonts/arial.ttf", 32);
|
||||
addChild(label, 9999);
|
||||
label->setPosition(Point(VisibleRect::center().x, VisibleRect::top().y - 30));
|
||||
|
||||
|
|
|
@ -297,15 +297,15 @@ RenderTextureZbuffer::RenderTextureZbuffer()
|
|||
_eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this);
|
||||
|
||||
auto size = Director::getInstance()->getWinSize();
|
||||
auto label = Label::create("vertexZ = 50", "fonts/Marker Felt.ttf", 64);
|
||||
auto label = Label::createWithFont("vertexZ = 50", "fonts/Marker Felt.ttf", 64);
|
||||
label->setPosition(Point(size.width / 2, size.height * 0.25f));
|
||||
this->addChild(label);
|
||||
|
||||
auto label2 = Label::create("vertexZ = 0", "fonts/Marker Felt.ttf", 64);
|
||||
auto label2 = Label::createWithFont("vertexZ = 0", "fonts/Marker Felt.ttf", 64);
|
||||
label2->setPosition(Point(size.width / 2, size.height * 0.5f));
|
||||
this->addChild(label2);
|
||||
|
||||
auto label3 = Label::create("vertexZ = -50", "fonts/Marker Felt.ttf", 64);
|
||||
auto label3 = Label::createWithFont("vertexZ = -50", "fonts/Marker Felt.ttf", 64);
|
||||
label3->setPosition(Point(size.width / 2, size.height * 0.75f));
|
||||
this->addChild(label3);
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ void TestLayer::onEnter()
|
|||
//auto array = [UIFont familyNames];
|
||||
//for( String *s in array )
|
||||
// NSLog( s );
|
||||
auto label = Label::create("cocos2d", "Tahoma", 64);
|
||||
auto label = Label::createWithFont("cocos2d", "Tahoma", 64);
|
||||
|
||||
label->setPosition( Point(x/2,y/2) );
|
||||
|
||||
|
|
|
@ -371,7 +371,7 @@ bool TextFieldTTFActionTest::onTextFieldInsertText(TextFieldTTF * sender, const
|
|||
}
|
||||
|
||||
// create a insert text sprite and do some action
|
||||
auto label = Label::create(text, FONT_NAME, FONT_SIZE);
|
||||
auto label = Label::createWithFont(text, FONT_NAME, FONT_SIZE);
|
||||
this->addChild(label);
|
||||
Color3B color(226, 121, 7);
|
||||
label->setColor(color);
|
||||
|
@ -404,7 +404,7 @@ bool TextFieldTTFActionTest::onTextFieldInsertText(TextFieldTTF * sender, const
|
|||
bool TextFieldTTFActionTest::onTextFieldDeleteBackward(TextFieldTTF * sender, const char * delText, size_t nLen)
|
||||
{
|
||||
// create a delete text sprite and do some action
|
||||
auto label = Label::create(delText, FONT_NAME, FONT_SIZE);
|
||||
auto label = Label::createWithFont(delText, FONT_NAME, FONT_SIZE);
|
||||
this->addChild(label);
|
||||
|
||||
// move the sprite to fly out
|
||||
|
|
|
@ -1520,7 +1520,7 @@ void TextureAsync::onEnter()
|
|||
|
||||
auto size = Director::getInstance()->getWinSize();
|
||||
|
||||
auto label = Label::create("Loading...", "fonts/Marker Felt.ttf", 32);
|
||||
auto label = Label::createWithFont("Loading...", "fonts/Marker Felt.ttf", 32);
|
||||
label->setPosition(Point( size.width/2, size.height/2));
|
||||
addChild(label, 10);
|
||||
|
||||
|
|
|
@ -12,8 +12,8 @@ TextureCacheTest::TextureCacheTest()
|
|||
{
|
||||
auto size = Director::getInstance()->getWinSize();
|
||||
|
||||
_labelLoading = Label::create("loading...", "fonts/arial.ttf", 15);
|
||||
_labelPercent = Label::create("%0", "fonts/arial.ttf", 15);
|
||||
_labelLoading = Label::createWithFont("loading...", "fonts/arial.ttf", 15);
|
||||
_labelPercent = Label::createWithFont("%0", "fonts/arial.ttf", 15);
|
||||
|
||||
_labelLoading->setPosition(Point(size.width / 2, size.height / 2 - 20));
|
||||
_labelPercent->setPosition(Point(size.width / 2, size.height / 2 + 20));
|
||||
|
|
|
@ -18,14 +18,14 @@ void TextureAtlasEncryptionDemo::onEnter()
|
|||
|
||||
auto s = Director::getInstance()->getWinSize();
|
||||
|
||||
auto label = Label::create(title().c_str(), "fonts/arial.ttf", 28);
|
||||
auto label = Label::createWithFont(title().c_str(), "fonts/arial.ttf", 28);
|
||||
label->setPosition( Point(s.width/2, s.height * 0.75f) );
|
||||
this->addChild(label, 1);
|
||||
|
||||
std::string strSubtitle = subtitle();
|
||||
if(strSubtitle.empty() == false)
|
||||
{
|
||||
auto subLabel = Label::create(strSubtitle.c_str(), "fonts/Thonburi.ttf", 16);
|
||||
auto subLabel = Label::createWithFont(strSubtitle.c_str(), "fonts/Thonburi.ttf", 16);
|
||||
subLabel->setPosition( Point(s.width/2, s.height-80) );
|
||||
this->addChild(subLabel, 1);
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ void TextureAtlasEncryptionDemo::onEnter()
|
|||
nonencryptedSprite->setPosition(Point(s.width * 0.25f, s.height * 0.5f));
|
||||
this->addChild(nonencryptedSprite);
|
||||
|
||||
auto nonencryptedSpriteLabel = Label::create("non-encrypted", "fonts/arial.ttf", 28);
|
||||
auto nonencryptedSpriteLabel = Label::createWithFont("non-encrypted", "fonts/arial.ttf", 28);
|
||||
nonencryptedSpriteLabel->setPosition(Point(s.width * 0.25f, nonencryptedSprite->getBoundingBox().getMinY() - nonencryptedSprite->getContentSize().height/2));
|
||||
this->addChild(nonencryptedSpriteLabel, 1);
|
||||
|
||||
|
@ -65,7 +65,7 @@ void TextureAtlasEncryptionDemo::onEnter()
|
|||
encryptedSprite->setPosition(Point(s.width * 0.75f, s.height * 0.5f));
|
||||
this->addChild(encryptedSprite);
|
||||
|
||||
auto encryptedSpriteLabel = Label::create("encrypted", "fonts/arial.ttf", 28);
|
||||
auto encryptedSpriteLabel = Label::createWithFont("encrypted", "fonts/arial.ttf", 28);
|
||||
encryptedSpriteLabel->setPosition(Point(s.width * 0.75f, encryptedSprite->getBoundingBox().getMinY() - encryptedSpriteLabel->getContentSize().height/2));
|
||||
this->addChild(encryptedSpriteLabel, 1);
|
||||
}
|
||||
|
|
|
@ -266,12 +266,12 @@ TestLayer1::TestLayer1(void)
|
|||
bg1->setPosition( Point(size.width/2, size.height/2) );
|
||||
addChild(bg1, -1);
|
||||
|
||||
auto title = Label::create( (transitions[s_nSceneIdx]).name, "fonts/Thonburi.ttf", 32 );
|
||||
auto title = Label::createWithFont( (transitions[s_nSceneIdx]).name, "fonts/Thonburi.ttf", 32 );
|
||||
addChild(title);
|
||||
title->setColor( Color3B(255,32,32) );
|
||||
title->setPosition( Point(x/2, y-100) );
|
||||
|
||||
auto label = Label::create("SCENE 1", "fonts/Marker Felt.ttf", 38);
|
||||
auto label = Label::createWithFont("SCENE 1", "fonts/Marker Felt.ttf", 38);
|
||||
label->setColor( Color3B(16,16,255));
|
||||
label->setPosition( Point(x/2,y/2));
|
||||
addChild( label);
|
||||
|
@ -395,12 +395,12 @@ TestLayer2::TestLayer2()
|
|||
bg1->setPosition( Point(size.width/2, size.height/2) );
|
||||
addChild(bg1, -1);
|
||||
|
||||
auto title = Label::create((transitions[s_nSceneIdx]).name, "fonts/Thonburi.ttf", 32 );
|
||||
auto title = Label::createWithFont((transitions[s_nSceneIdx]).name, "fonts/Thonburi.ttf", 32 );
|
||||
addChild(title);
|
||||
title->setColor( Color3B(255,32,32) );
|
||||
title->setPosition( Point(x/2, y-100) );
|
||||
|
||||
auto label = Label::create("SCENE 2", "fonts/Marker Felt.ttf", 38);
|
||||
auto label = Label::createWithFont("SCENE 2", "fonts/Marker Felt.ttf", 38);
|
||||
label->setColor( Color3B(16,16,255));
|
||||
label->setPosition( Point(x/2,y/2));
|
||||
addChild( label);
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
UserDefaultTest::UserDefaultTest()
|
||||
{
|
||||
auto s = Director::getInstance()->getWinSize();
|
||||
auto label = Label::create("CCUserDefault test see log", "fonts/arial.ttf", 28);
|
||||
auto label = Label::createWithFont("CCUserDefault test see log", "fonts/arial.ttf", 28);
|
||||
addChild(label, 0);
|
||||
label->setPosition( Point(s.width/2, s.height-50) );
|
||||
|
||||
|
|
Loading…
Reference in New Issue