Forum > C++ > Cocos2D-X General Questions

Cocos2D-X General Questions

By Jonathan Posted 2011-07-26 08:09 Comments 5
Jonathan
  • Posts: 18

Hello everyone,

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:

In cocos2D-X
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.

zhangxm
  • Posts: 2081
  • Location: Xiamen, China

#1 RE: 2011-07-26 19:11

I am trying to answer your questions:

  1. 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.

  2. There is a class named CCUserDefault you can use to save simple data types. It is platform independant.

  3. zwoptex sprite sheets work, and it is the same format.

  4. The best way is creating the game for iOS first then port to Android.

  5. Cocos2d-x works ok on iPad.

  6. 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.

  7. 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.

  8. 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.

Jonathan
  • Posts: 18

#2 RE: 2011-07-27 00:42

Thank you very much for you answers, they have been very useful.

gmeister26
  • Posts: 13

#3 RE: 2011-07-27 03:25

  1. 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.

Eyesiah
  • Posts: 61

#4 RE: 2011-07-27 06:01

  1. I write in the win32 platform mostly, using Visual Studio, and maintain the android version as I go. It’s super effective!
walzer
  • Posts: 1735
  • Location: Xiamen, China

#5 RE: 2011-07-27 06:32

io Meister wrote:

P.s. remember to change the resource folder to resources in the android project to merge it with the iPhone project.

Sorry, I just create #637 to fix it.

Less is More. Keep Focus.

Loggin to reply

Copyright © 2010 - 2013 Cocos2d-x.orgClustrmaps