您的位置:首页 > 移动开发 > Cocos引擎

lua使用probuf(cocos2dx)

2018-03-12 00:00 281 查看
ios先集成probuf环境网上有教程:http://blog.csdn.net/qq446569365/article/details/46981521
http://gad.qq.com/article/detail/19128
上面的教程的流程是:先加载probuf二进制文件,然后register文件buffer,就可以encode或者decode了如下代码所示:

local pbFilePath = cc.FileUtils:getInstance():fullPathForFilename("res/addressbook.pb")

local pb = require "protobuf"

local buffer = readProtobufFile(pbFilePath)

pb.register(buffer)

pb文件的生成方式为:

protoc -o addressbook.pb addressbook.proto
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: