如何在 android NDK 中直接访问资源 - cocos2d-x

发布于 2025-01-05 18:36:53 字数 175 浏览 3 评论 0原文

我想读取 android ndk 中的一些 json 文件!问题是我找不到任何描述直接访问 ndk 中的资源的教程(大多数人说我应该将指针从 java 代码传递到本机,但我不能使用它) 我还尝试找到一些关于 的示例,但再次没有运气!

I want to read some json files in android ndk ! problem is i could not find any tutorials that describe direct access to assets in ndk (most of them say i should pass pointer from java code to native but i cant use that )
I also tried to find some example about <android/asset_manager.h> but again no luck!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

寂寞陪衬 2025-01-12 18:36:53

将 FileOperation.h 和 FileOperation.cpp 复制到 cocos2d-x/HelloWorld 中。
在 HelloWorld::init() 中调用 FileOperation::saveFile() 和 FileOperation::readFile()。
修改cocos2d-x/HelloWorld/android/jni/helloworld/Android.mk。

重建并运行

Copy FileOperation.h and FileOperation.cpp into cocos2d-x/HelloWorld.
Invoke FileOperation::saveFile() and FileOperation::readFile() in HelloWorld::init().
Modify cocos2d-x/HelloWorld/android/jni/helloworld/Android.mk.

Rebuild and run

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文