一开始无法输入中文, 显示出来的是乱码, 修改一个函数, 下面是修改过后的代码

void GLView::onGLFWCharCallback(GLFWwindow *window, unsigned int character)
{
    if (character < 128)
    {
        IMEDispatcher::sharedDispatcher()->dispatchInsertText((const char*)&character, 1);
    }
    else
    {
        long items_read = 0;
        long items_write = 0;
        char* buf = cc_utf16_to_utf8((unsigned short*)&character, 1, &items_read, &items_write);
        IMEDispatcher::sharedDispatcher()->dispatchInsertText(buf, items_write);
        free(buf);
    }    
}

参考文档:
http://blog.csdn.net/xie1xiao1jun/article/details/38711849
http://www.cocoachina.com/bbs/read.php?tid=166857

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-08-03
  • 2021-10-18
  • 2022-12-23
  • 2022-12-23
  • 2021-10-12
  • 2022-03-02
猜你喜欢
  • 2021-09-01
  • 2022-12-23
  • 2021-11-13
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案