Cocos2D-X General Questions
- Posts: 18
I am currently thinking about starting a new game using Cocos2d-X and have a few question before making my final decision.
I am already quite familiar with Cocos2d-iPhone having started using it over a year ago but now I want to make a multi-platform game (Android and iOS) using the same source code for both, so Cocos2D-X looks perfect for the situation.
So here are my questions:
1) is there a simple way for handling (localized) strings independently from the platform without having to update simultaneously Localizable.strings for iOS and strings.xml for Android and needing different functions to get them?
2) is there an easy way of saving simple data types (int, Bool and strings) independently from the platform (without having to use #ifdef each time with on one side NSUserDefaults and the other Android preferences)?
3) do zwoptex sprite sheets work and if so is it the same export format?
4) What is considered the best way of doing an Android and iOS game, create the game for iOS first then port to Android, the opposite way round or work on them both simultaneously so as to find out immediately if something cannot be done on one platform or the other and find a way around it.
5) I see mention of Cocos2D-X being for iPhone 3 and 4 but nothing about iPad, are there any reasons why it would not be usable for iPad (or any specific difficulties)?
6) I have used the create-android-project.sh script to create a new project and imported it into eclipse but do not see a Classes folder there, do I have to edit the classes independently and run build_native.sh every time I want to rebuild after modifying the code?
7) reading this http://www.cocos2d-x.org/boards/10/topics/2350 forum post I see there are function that need to be overridden, I have this issue, where must I do this?
8) is there anything that I should know before starting my project, anything you would have wanted to know before starting your own Cocos2D-X projects?
Thanks for any help that can be provided.
- Posts: 2082
- Location: Xiamen, China
I am trying to answer your questions:
Now, there is not simple way for handling (localized) strings. You should choose different strings by codes, but there is a function CCApplication::getCurrentLanguage() to get the current language. You can use it to get the current language, and choose the corresponding strings.
There is a class named CCUserDefault you can use to save simple data types. It is platform independant.
zwoptex sprite sheets work, and it is the same format.
The best way is creating the game for iOS first then port to Android.
Cocos2d-x works ok on iPad.
Because Classes folder is not in android/, so you can not see it in Eclipse. Yes, you should rebuild it after you modifing the code. There may be a way to integer the build_native.sh into Eclipse, but I don’t know.
When you use higher version of Android SDK, and some Interface add more methods, you will meet it. And it is simple to resolve it, just implement the adding method, return default value for the return type.
I think you can refer the wiki page and find something you want. May be HelloWorld and tests are good starting point.
I hope it helps you something.
- Posts: 18
Thank you very much for you answers, they have been very useful.
- Posts: 13
- I usually create new android and iOS projects and then merge them together. Then I develop in Xcode and occasionally build_native to maintain and test the android build. I find this works really well and it far less boring than debugging tons of code later on.
P.s. remember to change the resource folder to resources in the android project to merge it with the iPhone project.
- Posts: 61
- I write in the win32 platform mostly, using Visual Studio, and maintain the android version as I go. It’s super effective!