Pages

Cocos2dx: Combine iOS and Android Project Files

Wednesday, March 27, 2013

In the previous two tutorials I have discussed on setting up Cocos2d-x environment for both iOS and Android.  So, now we have two project structure, one for iOS and another fore Android. In this tutorial I will discuss on how to combine this two project and develop the game in Cocos2d-x using the same code base and structure.

Both iOS and Android project source directory consists of C++ files and these files are located under the "Classes" directory. Open the project explorer and you will find this two identical folder.



So, we can use the same files for developing two different game application by linking the files. To do so, open up your SampleGame project in Xcode. Select the Classes group, click Delete, and select “Move to Trash” when the popup appears.

Next, right click the project in the Project Navigator, select “New Group”, and rename the new group to Classes. Right click the Classes group, and select Add Files.



Select the following files from your $PROJECT_HOME\Classes folder and make sure that the Copy items into destination group’s folder checkbox is not checked before you click Add.



Rebuild the project in Xcode to check everything is correctly configured. Run the Application if everything is OK.  

No comments:

Post a Comment