`
renzhe20092584
  • 浏览: 10544 次
  • 性别: Icon_minigender_1
最近访客 更多访客>>
社区版块
存档分类
最新评论

eclipse cocos2dx

 
阅读更多

参考网址 

http://blog.csdn.net/stupidcodegenerator/article/details/8590821

http://www.himigame.com/android-game/725.html

http://blog.sina.com.cn/s/blog_663b47050100hh94.html

http://andilyliao.iteye.com/blog/494255

 

0.eclipse上编写C++

stringHelloWorld::init() {} //无return程序会崩溃

 

 

1.文件

CCFileUtils::sharedFileUtils()->fullPathFromRelativePath("")

CCFileUtils::sharedFileUtils()-> getWritablePath("")

fullPathFromRelativePath android上是读 assets

getWritablePath android上是 /data/data/包名/

 

可能是大多程序的路径

Environment.getExternalStorageDirectory() + "/Android/data/" + pApplicationInfo.packageName + "/files/" + pPath;

 

2.JNI

java返回String类型给C++

 JniMethodInfo minfo

 JniMethodInfo minfo.env  //env JNIEnV 

 (Ljava/lang/String;)Ljava/lang/String;

返回jstring类型必须用jobject obj接受否则不能编译通过

再把jobject转换成jstring jRet = (jstring) obj;

const char* msg3 = (minfo.env)->GetStringUTFChars(jRet, NULL); //jstring转换const char*

 

 

 

 

 

 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics