Today, cocos2d-1.0.1-x-0.13.0-beta is released.
And if you want to update to this new version, there are some minor changes you may need to do when you updated.
1. CCTouch remove the view() method.
So, if you want to detect touches, you need change your code like below.
Before:
CCPoint touchPoint = touch->locationInView( touch->view() );
After:
CCPoint touchPoint = touch->locationInView();
2. ccc4() has changed to ccc4f().
That's straight-forward changed. Just rename your function call from ccc4() to ccc4f().
BTW, there is another change that the android.mk under helloworld folder is gone. You may take your eyes on that and check if everything is fine if you build iOS & Android dual-platform project like me.
BTW2, don't forget to take a look on our cocos2d-x game: ChickenEggs both on iOS and Android. Now we have integrated facebook and twitter share features on that.(・ω・)
Thursday, March 29, 2012
Thursday, March 22, 2012
ChickenEggs 2.0 Released !!!
ChickenEggs new version 2.0 has released to Android Market and Apple Store !
You will get this update soon on Android, and several days later on Apple Store.
After update to 2.0, you will get these features.
★ Sharing Your HighScores on Facebook and Twitter !!
★ New Bomb Mode !! You can de-active bombs !!
★ Adding Fantastic Effects with Egg Breaks !!
★ 現在你可以透過Facebook和Twitter和朋友分享你的高分成就!!
★ 全新的炸彈模式,現在可以透過快速點按來解除炸彈了!!
★ 新增加了數種畫面炫麗的特效,玩起來更過癮!!
Hope you will be happy with this new version !
BTW, any comment is welcome, please email me at simon@molioapp.com
Thanks.
Monday, March 12, 2012
Upgrade with cocos2d-1.0.1-x-0.12.0 and integrated with your original JNI functions...
Here are some notes that when I upgraded my game to .12 version what I learned about with new JNI architecture that cocos2d-x used.
Question 1:In the jni\helloworld\main.cpp, you can find there is already JNI_Onload() there. Yes, that means you can't implement your JNI_Onload.
Solution:You can call RegisterNatives() at JNI_Onload() which at main.cpp instead to register your jni class.
Something like the code below :
jclass clazz;
JNIEnv *env;
vm->GetEnv((void**) &env, JNI_VERSION_1_6);
const char *classPathName = "com/zhihmeng/ChickenEggsX/ChickenEggsX";
JNINativeMethod methods[] = {
{"init", "(Ljava/lang/Object;)V",
(void *)Java_com_zhihmeng_ChickenEggsX_ChickenEggsX_init},
};
clazz = env->FindClass(classPathName);
if (clazz == NULL) {
// LOGE("Native registration unable to find class '%s'", className);
return JNI_FALSE;
}
if (env->RegisterNatives(clazz, methods, sizeof(methods) / sizeof(methods[0])) < 0) { // LOGE("RegisterNatives failed for '%s'", className); return JNI_FALSE; } Question 2:You may do some modifications on your JNI class, and JniHelper make these thing easier. Solution:Use JniHelper to get some static method info like MessageJni.cpp(located at cocos2dx\platform\android\jni) does and call your method by it. The code will like below: JniMethodInfo t; if (JniHelper::getStaticMethodInfo(t , "com/zhihmeng/ChickenEggsX/ChickenEggsX" , "exportToShare" , "()V")) { t.env->CallStaticVoidMethod(t.classID, t.methodID);
}
Finally, thanks the tweaks of cocos2d-x new JniHelper, it make jni calling more elegant.
You are also welcome to my studio page to see some of my works : www.molioapp.com
Question 1:In the jni\helloworld\main.cpp, you can find there is already JNI_Onload() there. Yes, that means you can't implement your JNI_Onload.
Solution:You can call RegisterNatives() at JNI_Onload() which at main.cpp instead to register your jni class.
Something like the code below :
jclass clazz;
JNIEnv *env;
vm->GetEnv((void**) &env, JNI_VERSION_1_6);
const char *classPathName = "com/zhihmeng/ChickenEggsX/ChickenEggsX";
JNINativeMethod methods[] = {
{"init", "(Ljava/lang/Object;)V",
(void *)Java_com_zhihmeng_ChickenEggsX_ChickenEggsX_init},
};
clazz = env->FindClass(classPathName);
if (clazz == NULL) {
// LOGE("Native registration unable to find class '%s'", className);
return JNI_FALSE;
}
if (env->RegisterNatives(clazz, methods, sizeof(methods) / sizeof(methods[0])) < 0) { // LOGE("RegisterNatives failed for '%s'", className); return JNI_FALSE; } Question 2:You may do some modifications on your JNI class, and JniHelper make these thing easier. Solution:Use JniHelper to get some static method info like MessageJni.cpp(located at cocos2dx\platform\android\jni) does and call your method by it. The code will like below: JniMethodInfo t; if (JniHelper::getStaticMethodInfo(t , "com/zhihmeng/ChickenEggsX/ChickenEggsX" , "exportToShare" , "()V")) { t.env->CallStaticVoidMethod(t.classID, t.methodID);
}
Finally, thanks the tweaks of cocos2d-x new JniHelper, it make jni calling more elegant.
You are also welcome to my studio page to see some of my works : www.molioapp.com
Subscribe to:
Posts (Atom)