Duke
Duke

Reputation: 1731

how to access assets directly in android NDK - cocos2d-x

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!

Upvotes: 1

Views: 735

Answers (1)

Duke
Duke

Reputation: 1731

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

Upvotes: 1

Related Questions