如何在 cocos2d 中使用属性字符串?

发布于 2024-10-08 20:25:42 字数 83 浏览 0 评论 0原文

如何将 CCLabelTTF 与 ZAttributedString 一起使用? 假设我想要一个蓝色文本“向世界问好!”但我想要红色的“to”这个词。

how to use CCLabelTTF with ZAttributedString?
Lets say I want a blue Text "Greetings to the World!" but I want the word "to" in red.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

浅唱ヾ落雨殇 2024-10-15 20:25:42

ZAttributedString 是 FontLabel 的一部分,FontLabel 是 Zynga 的外部库,与 Cocos2D 一起打包。 FontLabel 使用 ZFont,而不是 CCLabelTTF 等...

请参阅此处:https://github.com/zynga/FontLabel< /a>

看起来他们提供了一些非常小的示例,您也可以查看他们的单元测试以查看其他用例。

ZAttributedString is part of FontLabel, an external library from Zynga that is packaged with Cocos2D. FontLabel uses ZFont, not CCLabelTTF, etc ...

Refer to here: https://github.com/zynga/FontLabel

It would appear they provide some very small examples, and you can peek into their UnitTests as well to see additional use cases.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文