[IOS-cocos2d-X Game Development 2] [must see] summarizes the difference between Cocos2d-X and Cocos2d-iphone;

Source: Internet
Author: User

All articles on this site areLi huaming himiOriginal, reprinted must be explicitly noted:
Reprinted from[Heimi gamedev block]Link: http://www.himigame.com/iphone-cocos2dx/603.html

 

Many children's shoes may be confused -. -Yesterday I just wrote how to set up the Cocos2d-X development environment, this article began to summarize .....

I have to say to sum up, because the Cocos2d-X code and the Cocos2d-iphone are two engines except for different languages (Cocos2d-X uses C ++, Cocos2d-iphone uses Object-C) and can say there is no other difference =. =

The following himi example compares several pieces of code:

Create and add a compare sprite code:

Use Cocos2d-X:

// --------- Cocos2d-X code section -- // create an genie ccsprite * spritetemp = ccsprite: spritewithfile ("icon.png "); // set spritetemp-> setposition (CCP (size. width * 0.5, size. height * 0.5); // Add the sprite to the layer. This-> addchild (spritetemp, 1 );

Use Cocos2d-iphone:

// --------- Cocos2d-iphone code section -- // create an genie ccsprite * spritetemp = [ccsprite spritewithfile: @ "icon.png"]; // set spritetemp. position = CCP (size. width * 0.5, size. height * 0.5); // Add the genie to the layer [self addchild: spritetemp Z: 0 Tag: 1];

Add a Particle Code comparison:

Use Cocos2d-X:

// --------- Cocos2d-X code part -- ccparticlesystem * tempsystem = arch_optimal_participant le_system: Participant lewithfile ("himi. plist "); tempsystem-> setposition (CCP (100,100); this-> addchild (tempsystem );

Use Cocos2d-iphone:

// --------- Cocos2d-iphone code section -- ccparticlesystem * tempsystem = [arch_optimal_participant le_system participant lewithfile: @ "himi. plist"]; tempsystem. Position = CCP (100,100); [self addchild: tempsystem];

Okay, no more examples. We can see from the two paragraphs of the code above that there is basically no difference .. So ~ This is why himi is not necessary to update the Cocos2d-X blog, and will continue to update the cocos2d (Cocos2d-iphone) blog later, after the children's shoes whether it is to do Cocos2d-X or do Cocos2d-iphone can look at my [iOS-Cocos2d Game Development Series blog] who let them universal? =. =

There are three more points:

 

First: Now many game companies tend to develop Cocos2d-X engine game trends, have to say Cocos2d-X multi-platform translation is indeed very tempting, and through the net dragon "91 tribe" Mobile Online Games successfully released, have to say Cocos2d-X is mature!

Second: A lot of children's shoes will certainly want to know How Cocos2d-X can pan platform, so how translation stability?

Through the understanding of himi, Cocos2d-X development will use the unified C ++ language development, for example in iOS development using xcode + cocos2d-X, eclipse + Android ndk + ADT ....

In fact, to sum up a sentence, Cocos2d-iphone is not like a lot of shoes that as long as one person development can package multi-platform package like this ~ If you use a more appropriate word to describe Cocos2d-X, himi will use "Cocos2d-X code universal" to describe;

From the CC (cocochina) I saw Wang Zhe Walzer (author of cocos2d-x game engine) say this in response to a question about kids shoes:

Q: I am a newbie on how to package the cocos2d-x program, would like to ask how to package the Cocos2d-x Win32 program into the iPhone can run the program, please do not hesitate to enlighten me! Thank you!

Wang Zhe WalzerA: Win32 just let you debug convenience, to release to appstore, you still have to have a Mac machine, install cocos2d-x template, create a new project, and then copy the code on Win32, manually add to the xcode project and compile and run the project

From the above dialog, we can prove that the Cocos2d-X himi mentioned is common to the code! OK. Let's talk about these points. Continue to be busy ~

 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.