无法解决cocos2dx中的fullPathForFilename: Possible missing file 错误

Unable to solve fullPathForFilename: Possible missing file error in cocos2dx

我目前遇到以下错误。我确定我在 Resources -> fonts 文件夹中有 Mark Felt.ttf 文件。目前,我正在 android-studio.I 上为 android 开发,想知道问题是什么?我很想听听你的消息!

cocos2d: fullPathForFilename: No file found at Mark Felt. Possible missing file.

代码

auto highscoreLabelHeader = Label::createWithSystemFont("HIGHSCORE", "Mark Felt", 16);

您应该使用字体文件的相对路径,从资源文件夹作为根目录开始。也就是说,如果您有子文件夹,只需使用 fonts/Mark Felt.ttf

auto label= Label::createWithSystemFont("xyz", "fonts/Mark Felt.ttf", 16);

并确保 Mark Felt 是 systemFont 否则使用

auto label= Label::createWithTTF("xyz", "fonts/Mark Felt.ttf", 16)

另外你也可以查看这个帖子

http://discuss.cocos2d-x.org/t/fonts-not-working-on-android-device/7535