gpt4 book ai didi

Cocos2d-Android 自定义字体不工作

转载 作者:行者123 更新时间:2023-12-03 23:36:39 24 4
gpt4 key购买 nike

我正在尝试在 Cocos2d-Android 中使用带有 CClabel 的自定义字体,我已将我的字体文件添加到 Assets 中并尝试按名称“Faraco_Hand.ttf”和“Faraco_Hand”使用它,但它不起作用,我用谷歌搜索周围,​​但还没有找到任何解决办法。这就是我的代码的样子:

currentVideoLabel = CCLabel.makeLabel(VideosLabels[currentSelected], "Faraco_Hand.ttf", winSize.width/41);
currentVideoLabel.setPosition(CGPoint.make(winSize.width/2, 20));
addChild(currentVideoLabel);

如果有人知道这个,请帮助我。

最佳答案

您好,我在这里使用这种方式在我的游戏中添加字体我正在与您分享我的代码检查它希望它对您有帮助我正在标签上设置我的字体这是设置字体的唯一方法......一切顺利

示例:1

 CCLabel labelcontinue = CCLabel.makeLabel("continue", "fonts/JimboStd-Black.otf", 14);
labelcontinue.setPosition(CGPoint.ccp(272, 95));
labelcontinue.setColor(ccColor3B.ccc3(165, 42, 42));
mainPaperNode.addChild(labelcontinue, 25);

例子2:

  CCLabel labelWelcome = CCLabel.makeLabel("Welcome", "fonts/JimboStdBlack.otf",20);
labelWelcome.setColor(ccColor3B.ccc3(139, 69, 19));
labelWelcome.setPosition(CGPoint.ccp(innerArea.getContentSize().getWidth() / 2, (innerArea.getContentSize().getHeight() / 2) + 138));
innerArea.addChild(labelWelcome);

关于Cocos2d-Android 自定义字体不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10959475/

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