在Cocos2d-x 3.17中,CCBMFontConfiguration类的结构发生了变化,不再使用m_pKerningDictionary这个成员变量。因此,您需要对代码进行修改。\n\n以下是修改后的代码:\n\nint MultilineText::kerningAmountForFirst(unsigned short first, unsigned short second, CCBMFontConfiguration *config)\n{\n\t int ret = 0;\n\t unsigned int key = (first << 16) | (second & 0xffff);\n\n\t if (config->m_pKerningTable) {\n\t\t std::map<unsigned int, int>::iterator it = config->m_pKerningTable->find(key);\n\t\t if (it != config->m_pKerningTable->end())\n\t\t\t ret = it->second;\n\t }\n\t return ret;\n}\n\n在新版本中,使用了一个名为m_pKerningTable的std::map来存储字距数据。您需要使用find()函数在字距表中查找给定的键,并将结果赋值给ret变量。\n\n请注意,这只是修改的一部分,您可能需要根据其他代码的变化进行进一步的修改。


原文地址: https://www.cveoy.top/t/topic/pHHR 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录