gpt4 book ai didi

c++ - cocos2d-x 3 以不推荐的方式创建标签

转载 作者:行者123 更新时间:2023-11-30 01:17:19 25 4
gpt4 key购买 nike

我想使用 Arial 字体创建标签。我尝试了 2 种方式,但都被宣布弃用。创建标签的好方法是什么?

Label::create("Hello World", "Arial", 32); //declared deprecated
LabelTTF::create("Hello World", "Arial", 32); //declared deprecated

最佳答案

您可以尝试下面的代码:

std::string str = "五十嵐信介あろほほほaaaaaaaaaaaa";
cocos2d::ui::Text* titleLable = cocos2d::ui::Text::create(str,"AmericanTypewriter",35);
titleLable->setColor(Color3B::WHITE);
titleLable->setTextHorizontalAlignment(TextHAlignment::CENTER);
titleLable->setAnchorPoint(Vec2(0, 0));
titleLable->setPosition(Vec2(130, visibleSize.height - 50));
titleLable->setContentSize(Size(visibleSize.width - 200, 150));
this->addChild(titleLable);

关于c++ - cocos2d-x 3 以不推荐的方式创建标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24657187/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com