Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Tutorials

Reply
 
LinkBack Thread Tools Display Modes
Old 08-11-2011, 11:35 AM   #1 (permalink)
SuperSuRaccoon
 
Join Date: Apr 2011
Location: china
Age: 25
Posts: 31
SuperSuRaccoon is on a distinguished road
Send a message via Yahoo to SuperSuRaccoon
Default How to port a simple project to win32,iPhone and Android

I finished the installation and set up for the cocos2d-x(iphone-android) under Mac OS yesterday,
here's the article:

http://www.supersuraccoon-cocos2d.com/2011/08/10/cocos2d-x-iphone-androidide-installation-and-setup-under-mac-os/

so I tried to port a very simple cocos2d-x win32 project I wrote several month ago to iPhone, android platform and win32 of course. The origin demo was here;

http://www.supersuraccoon-cocos2d.com/2011/04/25/cocos2d-x-win32-installdeploy-tutorial/

Here goes the whole process:

1.Create a new project(Xcode) named SimplePortDemo under Mac OS using cocos2d-x-iPhone and make a little bit change of the origin code
2.Create a new project named SimplePortDemo under Mac OS using cocos2d-x-android and then merge it into the iPhone project
3.Create a new project(VS2010) named SimplePortDemo under WinXP using cocos2d-x-win32

Here is the process in detail:

1.Create a project for iPhone and android under Mac OS

1.1 Create a new project named SimplePortDemo in Xcode

1.2 Create a new project named SimplePortDemo using the shell script in cocos2d-x-android

1.3 Copy the Android folder under SimplePortDemo to the following position:


1.4 Edit the config file (according to yesterday's article)

1.5 Rename the "AppDelegate" file (a bug)

1.6 Complie && Run in Xcode and Success!

1.7 Input the project in to Eclipse

1.8 Complie && Run in Xcode and Success!

2. Port the origin project to iPhone

2.1 Copy the HelloWorldScene, MenuScene file into Xcode

2.2 Change some of the codes:
※Some functions, macros, types that starts with NS, CG, UI such as NSSet, UIEvent, CGPoint, CGMakePoint need to be changed into something starts with CC :CCSet, CCEvent, CCPoint, CCMakePoint
※It's OK to use CCLOG here

2.3 Complie && Run in Xcode and Success!

3. Port the origin project to android

3.1 No need to change any code here!The only thing you need to do is to edit the jni/helloworld/Android.mk file under android folder and add the MenuScene

3.2 Run the build_native.sh

3.3 Refresh the project in Eclipse, Complie && Run in Xcode and Success!


4. Port the iPhone-android project (we just ported) to Win32

4.1 Create a new project named SimplePortDemo in VS2010

4.2 Add the HelloWorldScene, MenuScene we ported under Mac OS to the project

4.3 Make a little bit of change
※ It's OK to use CCLOG but you need to cut off the "@" mark

4.4 Complie && Run in Xcode and Success!

Cheers! The whole port job is done now. As you can see from the whole process that you only need to make some small changes to the project to make it support win32, iPhone and android at the same time (at least it is so for a simple demo here) and that is pretty cool right

PS: A litter bit of problems left here:

1. The orientation of the project in the Android emulator since to be wrong (I don't have a real device so...)

2. Before compiling the Android project, we need to add the MenuScene in the Android.mk manually. What if we have a lot of new files? Do we have to add it all manually?

If you know the answer please let me know And if you have any questions about the whole process, feel free to ask and I'll try my best to answer'em .......

SimplePortDemo_iPhone_android:
Source Code

SimplePortDemo_win32:
Source Code

PS: Since I can only post with 5 images and there're actually more images
in the post so if you are interested you can check it here:
http://www.supersuraccoon-cocos2d.co...e-and-android/
__________________

SuperSuRaccoon is offline   Reply With Quote
Old 08-21-2011, 11:26 PM   #2 (permalink)
Registered Member
 
Join Date: Aug 2011
Posts: 1
thebomba is on a distinguished road
Default iphone

Thank you for bringing good things to share.

I like the iphone because the system is operating very well.




C.H. CONSULTANT GROUP CO.,LTD. โทร. 086-314-6501,02-380-067sirirat@creditonhand.com ?????????? ???????????? ?????????????? ??????? ????????:CreditCashPlus บัตรเครดิตโลตัส
thebomba is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 467
13 members and 454 guests
alexeir, David-T, Dj_kades, foslock, iAppDeveloper, jeroenkeij, LunarMoon, Mijator, pipposanta, QuantumDoja, robsmy, sacha1996, usernametaken
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,679
Threads: 94,129
Posts: 402,928
Top Poster: BrianSlick (7,990)
Welcome to our newest member, xzoonxoom
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 09:25 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0